File Coverage

blib/lib/Hydrogen/Scalar.pm
Criterion Covered Total %
statement 31 31 100.0
branch 2 4 50.0
condition n/a
subroutine 10 10 100.0
pod 2 2 100.0
total 45 47 95.7


line stmt bran cond sub pod time code
1             # This file was autogenerated.
2 3     3   225333 use 5.008001;
  3         39  
3 3     3   15 use strict;
  3         5  
  3         63  
4 3     3   19 use warnings;
  3         6  
  3         78  
5 3     3   13 no warnings qw( void once );
  3         7  
  3         103  
6 3     3   381 use Hydrogen ();
  3         8  
  3         205  
7              
8             package Hydrogen::Scalar;
9              
10             our $AUTHORITY = 'cpan:TOBYINK';
11             our $VERSION = '0.018';
12              
13             =head1 NAME
14              
15             Hydrogen::Scalar - a standard library for scalars
16              
17             =head1 VERSION
18              
19             This documentation is for Hydrogen::Scalar 0.018,
20             which is based on Sub::HandlesVia::HandlerLibrary::Scalar 0.046.
21              
22             =cut
23              
24             =head1 FUNCTIONS
25              
26             Each function expects a scalar as its first argument.
27              
28             =cut
29              
30 3         17 use Exporter::Shiny qw(
31             make_getter
32             make_setter
33 3     3   22 );
  3         6  
34              
35             =head2 C<< make_getter( $scalar ) >>
36              
37             Returns a getter coderef.
38              
39             =cut
40              
41             sub make_getter {
42 1     1 1 8002 my $__REF__ = \$_[0];
43              
44             package Hydrogen::Scalar::__SANDBOX__;
45 1 50       5 @_ == 1
46             or Hydrogen::croak( "Wrong number of parameters for make_getter; usage: "
47             . "Hydrogen::Scalar::make_getter( \$scalar )" );
48 1         2 my $s = $__REF__;
49 1     1   6 sub { unshift @_, $s; $$__REF__ }
  1         6  
50 1         5 }
51              
52             =head2 C<< make_setter( $scalar ) >>
53              
54             Returns a setter coderef.
55              
56             =cut
57              
58             sub make_setter {
59 1     1 1 4266 my $__REF__ = \$_[0];
60              
61             package Hydrogen::Scalar::__SANDBOX__;
62 1 50       5 @_ == 1
63             or Hydrogen::croak( "Wrong number of parameters for make_setter; usage: "
64             . "Hydrogen::Scalar::make_setter( \$scalar )" );
65 1         1 my $s = $__REF__;
66 1     1   4 sub { my $val = shift; unshift @_, $s; ( ${$__REF__} = $val ) }
  1         2  
  1         2  
  1         2  
67 1         6 }
68              
69             1;
70              
71             =head1 EXPORT
72              
73             No functions are exported by this module by default. To import them all (this is usually a bad idea), use:
74              
75             use Hydrogen::Scalar -all;
76              
77             To import a particular function, use:
78              
79             use Hydrogen::Scalar 'make_getter';
80              
81             To rename functions:
82              
83             use Hydrogen::Scalar 'make_getter' => { -as => 'myfunc' };
84              
85             On Perl 5.37.2+, you can import lexically:
86              
87             use Hydrogen::Scalar -lexical, 'make_getter';
88              
89             See L for more hints on importing.
90              
91             =head1 BUGS
92              
93             Please report any bugs to
94             L.
95              
96             =head1 SEE ALSO
97              
98             L,
99             L,
100             L,
101             L.
102              
103             =head1 AUTHOR
104              
105             Toby Inkster Etobyink@cpan.orgE.
106              
107             =head1 COPYRIGHT AND LICENCE
108              
109             This software is copyright (c) 2022 by Toby Inkster.
110              
111             This is free software; you can redistribute it and/or modify it under
112             the same terms as the Perl 5 programming language system itself.
113              
114             =head1 DISCLAIMER OF WARRANTIES
115              
116             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
117             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
118             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
119