FindApp/Utils.pm

filter: Statementstmt 97.3% 72 / 74 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 18 / 18 Podpod n/a totaltotal 96.0% 96 / 100 CC 1 SCAR 0.0
CC
1
Cov
95%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« FindApp/Subs.pm ↑ Summary FindApp.pm »
1 package FindApp::Utils;
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 Exporter qw(import);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 our %EXPORT_TAGS;
9  
10 6 ▶use FindApp::Utils::List qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use FindApp::Utils::Package qw(PACKAGE);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use FindApp::Utils::Paths qw(basename_noext dir_file_ext);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 6 my $submod_glob; {
15 6 my($dir, $file, $ext) = dir_file_ext $INC{PACKAGE->pmpath};
16 6 $submod_glob = "$dir$file/*$ext";
17 }
18  
19 6 for my $tail (map { basename_noext } glob $submod_glob) {
20 60 my $module = PACKAGE->add($tail);
21 6 ▶ eval qq{use $module ':all'; 1} || die;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
eval "use $module ':all'; 1" or die 60 0 60
22 60 my $his_tags = $module->add("EXPORT_TAGS")->unbless;
23 6 ▶ no strict "refs";
Subroutine BEGIN: called CC=1 SCAR=0.0
24 60 ▶ while (my($sub_tag, $aref) = each %$his_tags) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$his_tags) 96 60 156
25 96 ▶ next if $sub_tag eq "all";
Branch: 1 branch
BranchTrueFalseTotal
if $sub_tag eq "all" 60 36 96
26 36 ▶ if ($EXPORT_TAGS{$sub_tag}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($FindApp::Utils::EXPORT_TAGS{$sub_tag}) 0 36 36
27 0 warn "ignoring duplicate export tag $sub_tag from $module";
28 0 next;
29 }
30 36 $EXPORT_TAGS{$sub_tag} = $aref;
31 }
32 60 $EXPORT_TAGS{lc $tail} = $his_tags->{all};
33 }
34  
35 6 our @EXPORT_OK = uniq sort map { @$_ } values %EXPORT_TAGS;
36  
37 6 $EXPORT_TAGS{all} = \@EXPORT_OK;
38  
39 6 1;
40  
41 =encoding utf8
42  
43 =head1 NAME
44  
45 FindApp::Utils - FIXME
46  
47 =head1 SYNOPSIS
48  
49 use FindApp::Utils;
50  
51 =head1 DESCRIPTION
52  
53 =head2 Public Methods
54  
55 =over
56  
57 =item FIXME
58  
59 =back
60  
61 =head2 Exports
62  
63 =over
64  
65 =item FIXME
66  
67 =back
68  
69 =head1 EXAMPLES
70  
71 =head1 ENVIRONMENT
72  
73 =head1 SEE ALSO
74  
75 =over
76  
77 =item L<FindApp>
78  
79 =back
80  
81 =head1 CAVEATS AND PROVISOS
82  
83 =head1 BUGS AND LIMITATIONS
84  
85 =head1 HISTORY
86  
87 =head1 AUTHOR
88  
89 Tom Christiansen << <tchrist@perl.com> >>
90  
91 =head1 LICENCE AND COPYRIGHT
92  
93 Copyright (c) 2016, Tom Christiansen C<< <tchrist@perl.com> >>.
94 All Rights Reserved.
95  
96 This module is free software; you can redistribute it and/or
97 modify it under the same terms as Perl itself. See L<perlartistic>.
98  
99 =cut
100  
« FindApp/Subs.pm ↑ Summary FindApp.pm »