FindApp/Utils/Syntax.pm

filter: Statementstmt 70.4% 43 / 61 Branchbran 25.0% 3 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 68.7% 11 / 16 Podpod 100% 6 / 6 totaltotal 66.3% 63 / 95 CC 9 SCAR 14.0
CC
9
Cov
63%
function
8.1
function
8.1
case_fallthrough
2.0
CRAP 4.1
« FindApp/Utils/Paths.pm ↑ Summary FindApp/Object/Behavior/Overloading.pm »
1 package FindApp::Utils::Syntax;
2  
3 6 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use Sub::Name qw(subname);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use FindApp::Utils::Assert qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use FindApp::Utils::Foreign qw(reftype);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 #################################################################
13  
14 sub case ( & ) ;
15 sub case_fallthrough ( & ) ;
16 sub function ( $$ ) ;
17  
18 #################################################################
19  
20 6 ▶use Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 6 our $VERSION = v1.0;
22 6 our @EXPORT_OK = qw(
23 case
24 case_fallthrough
25 function
26 );
27 6 our %EXPORT_TAGS = (
28 all => \@EXPORT_OK,
29 );
30  
31 #################################################################
32  
33 654 ▶sub function($$) {
Subroutine function: called CC=5 SCAR=20.9
Pod documented
34 0 ▶ my($name, $code) = @_;
Subroutine function: not called CC=5 SCAR=20.9
Pod documented
35 0 good_args(@_ == 2);
36 0 ▶ reftype($code) eq "CODE" || panic "wrong code type $code";
Branch: 2 branches
BranchTrueFalseTotal
&reftype($code) eq "CODE" or panic("wrong code type $code") 654 0 654
&reftype($code) eq "CODE" or panic("wrong code type $code") 0 0 0
37  
38 0 for ($name) {
39 0 ▶ /^\w+(::\w+)*$/ || panic "bad function name $name";
Branch: 2 branches
BranchTrueFalseTotal
/^\w+(::\w+)*$/ or panic("bad function name $name") 654 0 654
/^\w+(::\w+)*$/ or panic("bad function name $name") 0 0 0
40 0 ▶ s/^/caller() . "::"/e
Branch: 2 branches
BranchTrueFalseTotal
unless /::/ 654 0 654
unless /::/ 0 0 0
41 unless /::/;
42 }
43  
44 ##print "$name\n";
45  
46 6 ▶ no strict "refs";
Subroutine BEGIN: called CC=1 SCAR=0.0
47 6 ▶ no warnings "redefine";
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 0 subname( $name => $code);
50 0 *$name = $code;
51 0 return \&$name;
52 }
53  
54 0 ▶sub case(&) {
Subroutine case: not called CC=1 SCAR=1.7
Pod documented
55 0 ▶ &case_fallthrough;
Subroutine case: not called CC=1 SCAR=1.7
Pod documented
56 6 ▶ no warnings "exiting";
Subroutine BEGIN: called CC=1 SCAR=0.0
57 0 next SWITCH;
58 }
59  
60 0 ▶sub case_fallthrough(&) {
Subroutine case_fallthrough: not called CC=1 SCAR=6.9
Pod documented
61 0 ▶ my($case) = @_;
Subroutine case_fallthrough: not called CC=1 SCAR=6.9
Pod documented
62 0 &$case;
63 }
64  
65 6 1;
66  
67 =encoding utf8
68  
69 =head1 NAME
70  
71 FindApp::Utils::Syntax - FIXME
72  
73 =head1 SYNOPSIS
74  
75 use FindApp::Utils::Syntax;
76  
77 =head1 DESCRIPTION
78  
79 =head2 Public Methods
80  
81 =over
82  
83 =item FIXME
84  
85 =back
86  
87 =head2 Exports
88  
89 =over
90  
91 =item case
92  
93 =item case_fallthrough
94  
95 =item function
96  
97 =item FIXME
98  
99 =back
100  
101 =head1 EXAMPLES
102  
103 =head1 ENVIRONMENT
104  
105 =head1 SEE ALSO
106  
107 =over
108  
109 =item L<FindApp>
110  
111 =back
112  
113 =head1 CAVEATS AND PROVISOS
114  
115 =head1 BUGS AND LIMITATIONS
116  
117 =head1 HISTORY
118  
119 =head1 AUTHOR
120  
121 Tom Christiansen << <tchrist@perl.com> >>
122  
123 =head1 LICENCE AND COPYRIGHT
124  
125 Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>.
126 All Rights Reserved.
127  
128 This module is free software; you can redistribute it and/or
129 modify it under the same terms as Perl itself. See L<perlartistic>.
130  
131 =cut
132  
« FindApp/Utils/Paths.pm ↑ Summary FindApp/Object/Behavior/Overloading.pm »