line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# This file was autogenerated. |
2
|
2
|
|
|
2
|
|
229164
|
use 5.008001; |
|
2
|
|
|
|
|
15
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
39
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
53
|
|
5
|
2
|
|
|
2
|
|
10
|
no warnings qw( void once ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
73
|
|
6
|
2
|
|
|
2
|
|
402
|
use Hydrogen (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
35
|
|
7
|
2
|
|
|
2
|
|
412
|
use Hydrogen::Counter (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
128
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Hydrogen::Curry::Counter; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
12
|
|
|
|
|
|
|
our $VERSION = '0.020000'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 NAME |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Hydrogen::Curry::Counter - easily curry functions from Hydrogen::Counter |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This documentation is for Hydrogen::Curry::Counter 0.020000, |
21
|
|
|
|
|
|
|
which is based on Sub::HandlesVia::HandlerLibrary::Counter 0.046. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 FUNCTIONS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Each function expects an integer as its only argument and returns a coderef. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
9
|
use Exporter::Shiny qw( |
32
|
|
|
|
|
|
|
curry_dec |
33
|
|
|
|
|
|
|
curry_inc |
34
|
|
|
|
|
|
|
curry_reset |
35
|
|
|
|
|
|
|
curry_set |
36
|
2
|
|
|
2
|
|
14
|
); |
|
2
|
|
|
|
|
5
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 C<< curry_dec( $counter ) >> |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::Counter::dec >>. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub curry_dec { |
45
|
1
|
50
|
|
1
|
1
|
7162
|
@_ == 1 |
46
|
|
|
|
|
|
|
or Hydrogen::croak( |
47
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_dec: got %d, %s", |
48
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
49
|
|
|
|
|
|
|
); |
50
|
1
|
50
|
33
|
|
|
2
|
(do { my $tmp = $_[0]; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
|
1
|
50
|
|
|
|
4
|
|
|
1
|
|
|
|
|
18
|
|
51
|
|
|
|
|
|
|
or Hydrogen::croak( |
52
|
|
|
|
|
|
|
"Type check failed in signature for curry_dec: %s should be %s", |
53
|
|
|
|
|
|
|
"\\$_[0]", "Int" |
54
|
|
|
|
|
|
|
); |
55
|
1
|
|
|
|
|
4
|
my $ref = \$_[0]; |
56
|
1
|
|
|
0
|
|
7
|
return sub { Hydrogen::Counter::dec( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 C<< curry_inc( $counter ) >> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::Counter::inc >>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub curry_inc { |
66
|
1
|
50
|
|
1
|
1
|
3512
|
@_ == 1 |
67
|
|
|
|
|
|
|
or Hydrogen::croak( |
68
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_inc: got %d, %s", |
69
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
70
|
|
|
|
|
|
|
); |
71
|
1
|
50
|
33
|
|
|
4
|
(do { my $tmp = $_[0]; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
|
1
|
50
|
|
|
|
3
|
|
|
1
|
|
|
|
|
15
|
|
72
|
|
|
|
|
|
|
or Hydrogen::croak( |
73
|
|
|
|
|
|
|
"Type check failed in signature for curry_inc: %s should be %s", |
74
|
|
|
|
|
|
|
"\\$_[0]", "Int" |
75
|
|
|
|
|
|
|
); |
76
|
1
|
|
|
|
|
4
|
my $ref = \$_[0]; |
77
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::Counter::inc( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 C<< curry_reset( $counter ) >> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::Counter::reset >>. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub curry_reset { |
87
|
1
|
50
|
|
1
|
1
|
2870
|
@_ == 1 |
88
|
|
|
|
|
|
|
or Hydrogen::croak( |
89
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_reset: got %d, %s", |
90
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
91
|
|
|
|
|
|
|
); |
92
|
1
|
50
|
33
|
|
|
5
|
(do { my $tmp = $_[0]; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
|
1
|
50
|
|
|
|
9
|
|
|
1
|
|
|
|
|
14
|
|
93
|
|
|
|
|
|
|
or Hydrogen::croak( |
94
|
|
|
|
|
|
|
"Type check failed in signature for curry_reset: %s should be %s", |
95
|
|
|
|
|
|
|
"\\$_[0]", "Int" |
96
|
|
|
|
|
|
|
); |
97
|
1
|
|
|
|
|
3
|
my $ref = \$_[0]; |
98
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::Counter::reset( $$ref, @_ ) }; |
|
0
|
|
|
|
|
0
|
|
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 C<< curry_set( $counter ) >> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Curry the first argument of C<< Hydrogen::Counter::set >>. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub curry_set { |
108
|
1
|
50
|
|
1
|
1
|
3172
|
@_ == 1 |
109
|
|
|
|
|
|
|
or Hydrogen::croak( |
110
|
|
|
|
|
|
|
"Wrong number of parameters in signature for curry_set: got %d, %s", |
111
|
|
|
|
|
|
|
scalar(@_), "expected exactly 1 parameter" |
112
|
|
|
|
|
|
|
); |
113
|
1
|
50
|
33
|
|
|
3
|
(do { my $tmp = $_[0]; defined($tmp) and !ref($tmp) and $tmp =~ /\A-?[0-9]+\z/ }) |
|
1
|
50
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
114
|
|
|
|
|
|
|
or Hydrogen::croak( |
115
|
|
|
|
|
|
|
"Type check failed in signature for curry_set: %s should be %s", |
116
|
|
|
|
|
|
|
"\\$_[0]", "Int" |
117
|
|
|
|
|
|
|
); |
118
|
1
|
|
|
|
|
7
|
my $ref = \$_[0]; |
119
|
1
|
|
|
0
|
|
5
|
return sub { Hydrogen::Counter::set( $$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::Counter -all; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
To import a particular function, use: |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
use Hydrogen::Curry::Counter 'curry_reset'; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
To rename functions: |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
use Hydrogen::Curry::Counter 'curry_reset' => { -as => 'myfunc' }; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
On Perl 5.37.2+ (or if L is installed) you can import lexically: |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
use Hydrogen::Curry::Counter -lexical, 'curry_reset'; |
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
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHOR |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Toby Inkster Etobyink@cpan.orgE. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This software is copyright (c) 2022-2023 by Toby Inkster. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
165
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
170
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
171
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
172
|
|
|
|
|
|
|
|