Util/Syntax.pm

filter: Statementstmt 97.7% 44 / 45 Branchbran 75.0% 3 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 12 / 12 Podpod 100% 1 / 1 totaltotal 96.9% 63 / 65 CC 5 SCAR 6.3
CC
5
Cov
96%
import
4.0
importables
2.1
BEGIN
1.0
CRAP 1.9
« Util.pm ↑ Summary Util/Const.pm »
1 package Dev::Util::Syntax;
2  
3 8 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 8 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶use version;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 8 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 8 ▶use open qw(:std :utf8);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 8 ▶use Import::Into;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 8 ▶use Module::Runtime;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 8 our $VERSION = version->declare("v2.19.42");
17  
18 24 ▶sub importables {
Subroutine importables: called CC=2 SCAR=7.2
Pod documented
19 24 my ($class) = @_;
20 24 my @modules = (
21 [ 'feature', ':5.18' ], 'utf8',
22 'strict', 'warnings',
23 'autodie', [ 'open', ':std', ':utf8' ],
24 'version', 'Readonly',
25 'Carp', [ 'English', '-no_match_vars' ]
26 );
27  
28 24 ▶ if ( $] >= 5.036 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] >= 5.036) { } 24 0 24
29 24 push @modules => [ 'builtin', 'true', 'false' ];
30 }
31 else {
32 0 push @modules => [ 'boolean', 'true', 'false' ];
33 }
34 24 return @modules;
35 }
36  
37 24 ▶sub import {
Subroutine import: called CC=4 SCAR=13.9
38 24 my (@args) = @_;
39 24 my $class = shift @args;
40 24 my $caller = caller;
41  
42 24 foreach my $import_proto ( $class->importables ) {
43 264 my $module;
44 264 ▶ ( $module, @args )
Branch: 1 branch
BranchTrueFalseTotal
(ref $import_proto || '') eq 'ARRAY' ? : 96 168 264
Condition100%2/2
ref $import_proto || ''
l!l
96168
MC/DC100%1/1
ref $import_proto || ''
ref $import_proto
Truth table100%2/2
A
A= ref $import_proto
Aresult
11
00
45 = ( ref($import_proto) || '' ) eq 'ARRAY'
46 ? @$import_proto
47 : ( $import_proto, () );
48  
49 264 Module::Runtime::use_module($module)->import::into( $caller, @args );
50 }
51 24 return;
52 }
53  
54 8 1; # End of Dev::Util::Syntax
55  
56 =pod
57  
58 =encoding utf-8
59  
60 =head1 NAME
61  
62 Dev::Util::Syntax - Provide consistent feature setup.
63  
64 =head1 VERSION
65  
66 Version v2.19.42
67  
68 =head1 SYNOPSIS
69  
70 Provide consistent feature setup. Put all of the "use" setup cmds in one place.
71 Then import them into other modules.
72  
73 Use this in other modules:
74  
75 package Dev::Util::Example;
76  
77 use Dev::Util::Syntax;
78  
79 # Rest of Code...
80  
81 This is equivalent to:
82  
83 package Dev::Util::Example;
84  
85 use feature :5.18;
86 use utf8;
87 use strict;
88 use warnings;
89 use autodie;
90 use open qw(:std :utf8);
91 use version;
92 use Readonly;
93 use Carp;
94 use English qw( -no_match_vars );
95 use if $] >= 5.036, builtin => qw(true false);
96 use if $] < 5.036, boolean => qw(true false);
97  
98 # Rest of Code...
99  
100 =head1 SUBROUTINES/METHODS
101  
102 =head2 importables
103  
104 Define the items to be imported.
105  
106 =head2 import
107  
108 Do the import.
109  
110 =head1 AUTHOR
111  
112 Matt Martini, C<< <matt at imaginarywave.com> >>
113  
114 =head1 BUGS
115  
116 Please report any bugs or feature requests to C<bug-dev-util at rt.cpan.org>, or through
117 the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dev-Util>. I will
118 be notified, and then you'll automatically be notified of progress on your bug as I make changes.
119  
120 =head1 SUPPORT
121  
122 You can find documentation for this module with the perldoc command.
123  
124 perldoc Dev::Util::Syntax
125  
126 You can also look for information at:
127  
128 =over 4
129  
130 =item * RT: CPAN's request tracker (report bugs here)
131  
132 L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Dev-Util>
133  
134 =item * Search CPAN
135  
136 L<https://metacpan.org/release/Dev-Util>
137  
138 =back
139  
140 =head1 ACKNOWLEDGMENTS
141  
142 =head1 LICENSE AND COPYRIGHT
143  
144 This software is Copyright © 2024-2026 by Matt Martini.
145  
146 This is free software, licensed under:
147  
148 The GNU General Public License, Version 3, June 2007
149  
150 =cut
151  
152 __END__
« Util.pm ↑ Summary Util/Const.pm »