Perl/Role/Code.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 3 / 3 totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
new
1.0
CRAP 1.0
« Perl/Number.pm ↑ Summary Perl/Role/Number.pm »
1 package Data::Perl::Role::Code;
2 9 $Data::Perl::Role::Code::VERSION = '0.002011';
3 # ABSTRACT: Wrapping class for Perl coderefs.
4  
5 9 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶sub new { my $cl = shift; bless $_[0], $cl }
Subroutine new: called CC=1 SCAR=0.0
Pod documented
10  
11 2 ▶sub execute { $_[0]->(@_[1..$#_]) }
Subroutine execute: called CC=1 SCAR=0.0
Pod documented
12  
13 #sub execute_method { $_[0]->($_[0], @_[1..$#_]) }
14 1 ▶sub execute_method { die 'This remains unimplemented for now.' }
Subroutine execute_method: called CC=1 SCAR=0.0
Pod documented
15  
16 9 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<new($coderef)>
47  
48 Constructs a new Data::Perl::Code object, initialized to $coderef as passed in,
49 and returns it.
50  
51 =item B<execute(@args)>
52  
53 Calls the coderef with the given args.
54  
55 =item B<execute_method(@args)>
56  
57 Calls the coderef with the the instance as invocant and given args. B<This is
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<Data::Perl>
68  
69 =item * L<MooX::HandlesVia>
70  
71 =back
72  
73 =head1 AUTHOR
74  
75 Matthew Phillips <mattp@cpan.org>
76  
77 =head1 COPYRIGHT AND LICENSE
78  
79 This software is copyright (c) 2020 by Matthew Phillips <mattp@cpan.org>.
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__
« Perl/Number.pm ↑ Summary Perl/Role/Number.pm »