File Coverage

blib/lib/Hydrogen/Topic/Scalar.pm
Criterion Covered Total %
statement 28 28 100.0
branch 2 4 50.0
condition n/a
subroutine 10 10 100.0
pod 2 2 100.0
total 42 44 95.4


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