File Coverage

blib/lib/Hydrogen/Curry/Scalar.pm
Criterion Covered Total %
statement 28 30 93.3
branch 2 4 50.0
condition n/a
subroutine 9 11 81.8
pod 2 2 100.0
total 41 47 87.2


line stmt bran cond sub pod time code
1             # This file was autogenerated.
2 2     2   227980 use 5.008001;
  2         12  
3 2     2   11 use strict;
  2         4  
  2         42  
4 2     2   9 use warnings;
  2         5  
  2         52  
5 2     2   9 no warnings qw( void once );
  2         4  
  2         59  
6 2     2   386 use Hydrogen ();
  2         5  
  2         34  
7 2     2   371 use Hydrogen::Scalar ();
  2         13  
  2         108  
8              
9             package Hydrogen::Curry::Scalar;
10              
11             our $AUTHORITY = 'cpan:TOBYINK';
12             our $VERSION = '0.017';
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.017,
21             which is based on Sub::HandlesVia::HandlerLibrary::Scalar 0.038.
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 2         10 use Exporter::Shiny qw(
32             curry_make_getter
33             curry_make_setter
34 2     2   16 );
  2         4  
35              
36             =head2 C<< curry_make_getter( $scalar ) >>
37              
38             Curry the first argument of C<< Hydrogen::Scalar::make_getter >>.
39              
40             =cut
41              
42             sub curry_make_getter {
43 1 50   1 1 7213 @_ == 1
44             or Hydrogen::croak(
45             "Wrong number of parameters in signature for curry_make_getter: got %d, %s",
46             scalar(@_), "expected exactly 1 parameter"
47             );
48 1         2 (!!1)
49             or Hydrogen::croak(
50             "Type check failed in signature for curry_make_getter: %s should be %s",
51             "\\$_[0]", "Any"
52             );
53 1         3 my $ref = \$_[0];
54 1     0   4 return sub { Hydrogen::Scalar::make_getter( $$ref, @_ ) };
  0         0  
55             }
56              
57             =head2 C<< curry_make_setter( $scalar ) >>
58              
59             Curry the first argument of C<< Hydrogen::Scalar::make_setter >>.
60              
61             =cut
62              
63             sub curry_make_setter {
64 1 50   1 1 3432 @_ == 1
65             or Hydrogen::croak(
66             "Wrong number of parameters in signature for curry_make_setter: got %d, %s",
67             scalar(@_), "expected exactly 1 parameter"
68             );
69 1         2 (!!1)
70             or Hydrogen::croak(
71             "Type check failed in signature for curry_make_setter: %s should be %s",
72             "\\$_[0]", "Any"
73             );
74 1         3 my $ref = \$_[0];
75 1     0   4 return sub { Hydrogen::Scalar::make_setter( $$ref, @_ ) };
  0            
76             }
77              
78             1;
79              
80             =head1 EXPORT
81              
82             No functions are exported by this module by default. To import them all (this is usually a bad idea), use:
83              
84             use Hydrogen::Curry::Scalar -all;
85              
86             To import a particular function, use:
87              
88             use Hydrogen::Curry::Scalar 'curry_make_getter';
89              
90             To rename functions:
91              
92             use Hydrogen::Curry::Scalar 'curry_make_getter' => { -as => 'myfunc' };
93              
94             On Perl 5.37.2+, you can import lexically:
95              
96             use Hydrogen::Curry::Scalar -lexical, 'curry_make_getter';
97              
98             See L for more hints on importing.
99              
100             =head1 BUGS
101              
102             Please report any bugs to
103             L.
104              
105             =head1 SEE ALSO
106              
107             L,
108             L,
109             L,
110             L.
111              
112             =head1 AUTHOR
113              
114             Toby Inkster Etobyink@cpan.orgE.
115              
116             =head1 COPYRIGHT AND LICENCE
117              
118             This software is copyright (c) 2022 by Toby Inkster.
119              
120             This is free software; you can redistribute it and/or modify it under
121             the same terms as the Perl 5 programming language system itself.
122              
123             =head1 DISCLAIMER OF WARRANTIES
124              
125             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
126             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
127             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
128