File Coverage

blib/lib/Hydrogen/Curry/CodeRef.pm
Criterion Covered Total %
statement 36 40 90.0
branch 8 16 50.0
condition n/a
subroutine 11 15 73.3
pod 4 4 100.0
total 59 75 78.6


line stmt bran cond sub pod time code
1             # This file was autogenerated.
2 2     2   229282 use 5.008001;
  2         24  
3 2     2   18 use strict;
  2         3  
  2         40  
4 2     2   9 use warnings;
  2         4  
  2         51  
5 2     2   9 no warnings qw( void once );
  2         4  
  2         54  
6 2     2   424 use Hydrogen ();
  2         5  
  2         32  
7 2     2   786 use Hydrogen::CodeRef ();
  2         20  
  2         129  
8              
9             package Hydrogen::Curry::CodeRef;
10              
11             our $AUTHORITY = 'cpan:TOBYINK';
12             our $VERSION = '0.018';
13              
14             =head1 NAME
15              
16             Hydrogen::Curry::CodeRef - easily curry functions from Hydrogen::CodeRef
17              
18             =head1 VERSION
19              
20             This documentation is for Hydrogen::Curry::CodeRef 0.018,
21             which is based on Sub::HandlesVia::HandlerLibrary::Code 0.046.
22              
23             =cut
24              
25             =head1 FUNCTIONS
26              
27             Each function expects a reference to a sub as its only argument and returns a coderef.
28              
29             =cut
30              
31 2         11 use Exporter::Shiny qw(
32             curry_execute
33             curry_execute_list
34             curry_execute_scalar
35             curry_execute_void
36 2     2   18 );
  2         3  
37              
38             =head2 C<< curry_execute( $coderef ) >>
39              
40             Curry the first argument of C<< Hydrogen::CodeRef::execute >>.
41              
42             =cut
43              
44             sub curry_execute {
45 1 50   1 1 7952 @_ == 1
46             or Hydrogen::croak(
47             "Wrong number of parameters in signature for curry_execute: got %d, %s",
48             scalar(@_), "expected exactly 1 parameter"
49             );
50 1 50       5 (ref($_[0]) eq 'CODE')
51             or Hydrogen::croak(
52             "Type check failed in signature for curry_execute: %s should be %s",
53             "\\$_[0]", "CodeRef"
54             );
55 1         2 my $ref = \$_[0];
56 1     0   5 return sub { Hydrogen::CodeRef::execute( $$ref, @_ ) };
  0         0  
57             }
58              
59             =head2 C<< curry_execute_list( $coderef ) >>
60              
61             Curry the first argument of C<< Hydrogen::CodeRef::execute_list >>.
62              
63             =cut
64              
65             sub curry_execute_list {
66 1 50   1 1 4447 @_ == 1
67             or Hydrogen::croak(
68             "Wrong number of parameters in signature for curry_execute_list: got %d, %s",
69             scalar(@_), "expected exactly 1 parameter"
70             );
71 1 50       4 (ref($_[0]) eq 'CODE')
72             or Hydrogen::croak(
73             "Type check failed in signature for curry_execute_list: %s should be %s",
74             "\\$_[0]", "CodeRef"
75             );
76 1         4 my $ref = \$_[0];
77 1     0   5 return sub { Hydrogen::CodeRef::execute_list( $$ref, @_ ) };
  0         0  
78             }
79              
80             =head2 C<< curry_execute_scalar( $coderef ) >>
81              
82             Curry the first argument of C<< Hydrogen::CodeRef::execute_scalar >>.
83              
84             =cut
85              
86             sub curry_execute_scalar {
87 1 50   1 1 3558 @_ == 1
88             or Hydrogen::croak(
89             "Wrong number of parameters in signature for curry_execute_scalar: got %d, %s",
90             scalar(@_), "expected exactly 1 parameter"
91             );
92 1 50       6 (ref($_[0]) eq 'CODE')
93             or Hydrogen::croak(
94             "Type check failed in signature for curry_execute_scalar: %s should be %s",
95             "\\$_[0]", "CodeRef"
96             );
97 1         3 my $ref = \$_[0];
98 1     0   4 return sub { Hydrogen::CodeRef::execute_scalar( $$ref, @_ ) };
  0         0  
99             }
100              
101             =head2 C<< curry_execute_void( $coderef ) >>
102              
103             Curry the first argument of C<< Hydrogen::CodeRef::execute_void >>.
104              
105             =cut
106              
107             sub curry_execute_void {
108 1 50   1 1 3560 @_ == 1
109             or Hydrogen::croak(
110             "Wrong number of parameters in signature for curry_execute_void: got %d, %s",
111             scalar(@_), "expected exactly 1 parameter"
112             );
113 1 50       5 (ref($_[0]) eq 'CODE')
114             or Hydrogen::croak(
115             "Type check failed in signature for curry_execute_void: %s should be %s",
116             "\\$_[0]", "CodeRef"
117             );
118 1         3 my $ref = \$_[0];
119 1     0   4 return sub { Hydrogen::CodeRef::execute_void( $$ref, @_ ) };
  0            
120             }
121              
122             1;
123              
124             =head1 EXPORT
125              
126             No functions are exported by this module by default. To import them all (this is usually a bad idea), use:
127              
128             use Hydrogen::Curry::CodeRef -all;
129              
130             To import a particular function, use:
131              
132             use Hydrogen::Curry::CodeRef 'curry_execute_scalar';
133              
134             To rename functions:
135              
136             use Hydrogen::Curry::CodeRef 'curry_execute_scalar' => { -as => 'myfunc' };
137              
138             On Perl 5.37.2+, you can import lexically:
139              
140             use Hydrogen::Curry::CodeRef -lexical, 'curry_execute_scalar';
141              
142             See L for more hints on importing.
143              
144             =head1 BUGS
145              
146             Please report any bugs to
147             L.
148              
149             =head1 SEE ALSO
150              
151             L,
152             L,
153             L,
154             L,
155             L,
156             L.
157              
158             =head1 AUTHOR
159              
160             Toby Inkster Etobyink@cpan.orgE.
161              
162             =head1 COPYRIGHT AND LICENCE
163              
164             This software is copyright (c) 2022 by Toby Inkster.
165              
166             This is free software; you can redistribute it and/or modify it under
167             the same terms as the Perl 5 programming language system itself.
168              
169             =head1 DISCLAIMER OF WARRANTIES
170              
171             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
172             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
173             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
174