Sub-Exporter

 view release on metacpan or  search on metacpan

t/lib/Test/SubExporter/ObjGen.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!perl
 
use strict;
 
sub new {
  my $class = shift;
  my $code  = $class->can(shift);
 
  bless { code => $code } => $class;
}
 
sub group {
  return {
    foo => sub { return 'FOO' },
    bar => sub { return 'BAR' },
  };
}
 
sub baz {

t/util-currychain.t  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
 
use Test::More tests => 4;
 
BEGIN { use_ok("Sub::Exporter::Util", qw(curry_chain)); }
 
# So, some packages that we'll chain methods through.
{
  sub new          { my ($class, @arg) = @_; bless [ @arg ] => $class; }
  sub next_obj     { shift; return Test::CurryChain::Tail->new(@_); }
  sub false        { return; }
  sub non_invocant { return 1; }
 
  sub new      { my ($class, @arg) = @_; bless [ @arg ] => $class; }
  sub rev_guts { return reverse @{shift()}; }
}
 
{
  # Then the generator which could be put into a Sub::Exporter -setup.
  # This is an optlist.  AREF = args; undef = no args; CODE = args generator
  my $generator = curry_chain(
    next_obj => [ 1, 2, 3 ],
    rev_guts => undef,
  );



( run in 0.330 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )