File Coverage

blib/lib/Data/Perl/Role/Code.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 3 3 100.0
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Data::Perl::Role::Code;
2             $Data::Perl::Role::Code::VERSION = '0.002011';
3             # ABSTRACT: Wrapping class for Perl coderefs.
4              
5 9     9   3944 use strictures 1;
  9         55  
  9         311  
6              
7 9     9   751 use Role::Tiny;
  9         18  
  9         43  
8              
9 5     5 1 12 sub new { my $cl = shift; bless $_[0], $cl }
  5         23  
10              
11 2     2 1 1066 sub execute { $_[0]->(@_[1..$#_]) }
12              
13             #sub execute_method { $_[0]->($_[0], @_[1..$#_]) }
14 1     1 1 621 sub execute_method { die 'This remains unimplemented for now.' }
15              
16             1;
17              
18             =pod
19              
20             =encoding UTF-8
21              
22             =head1 NAME
23              
24             Data::Perl::Role::Code - Wrapping class for Perl coderefs.
25              
26             =head1 VERSION
27              
28             version 0.002011
29              
30             =head1 SYNOPSIS
31              
32             use Data::Perl qw/code/;
33              
34             my $code = code(sub { 'Foo'} );
35              
36             $code->execute(); # returns 'Foo';
37              
38             =head1 DESCRIPTION
39              
40             This class provides a wrapper and methods for interacting with Perl coderefs.
41              
42             =head1 PROVIDED METHODS
43              
44             =over 4
45              
46             =item B
47              
48             Constructs a new Data::Perl::Code object, initialized to $coderef as passed in,
49             and returns it.
50              
51             =item B
52              
53             Calls the coderef with the given args.
54              
55             =item B
56              
57             Calls the coderef with the the instance as invocant and given args. B
58             currently disabled and triggers a die due to implementation details yet to be
59             resolved.>
60              
61             =back
62              
63             =head1 SEE ALSO
64              
65             =over 4
66              
67             =item * L
68              
69             =item * L
70              
71             =back
72              
73             =head1 AUTHOR
74              
75             Matthew Phillips
76              
77             =head1 COPYRIGHT AND LICENSE
78              
79             This software is copyright (c) 2020 by Matthew Phillips .
80              
81             This is free software; you can redistribute it and/or modify it under
82             the same terms as the Perl 5 programming language system itself.
83              
84             =cut
85              
86             __END__