File Coverage

blib/lib/Hydrogen/Curry/Scalar.pm
Criterion Covered Total %
statement 40 45 88.8
branch 5 10 50.0
condition n/a
subroutine 12 17 70.5
pod 5 5 100.0
total 62 77 80.5


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