Mnet/Opts/Set.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 50.0% 1 / 2 totaltotal 91.8% 34 / 37 CC 4 SCAR 6.4
CC
4
Cov
96%
pragmas
3.0
enable
2.0
BEGIN
1.0
CRAP 1.9
« Mnet/Log/Conditional.pm ↑ Summary Mnet/Dump.pm »
1 package Mnet::Opts::Set;
2  
3 =head1 NAME
4  
5 Mnet::Opts::Set - Check for loaded Mnet::Opts::Set pragma sub-modules
6  
7 =head1 SYNOPSIS
8  
9 use Mnet::Opts::Set;
10 $opts = Mnet::Opts::Set::pragmas();
11  
12 =head1 DESCRIPTION
13  
14 This module can be used to check what Mnet::Opts::Set pragma sub-modules are
15 currently loaded.
16  
17 Scripts should not need to use or call this module. Normally scripts would use
18 the L<Mnet::Opts> and L<Mnet::Opts::Cli> modules, which handle checking the
19 status of Mnet::Opts::Set pragma sub-modules.
20  
21 =head1 FUNCTIONS
22  
23 Mnet::Opts::Set implements the functions listed below.
24  
25 =cut
26  
27 # required modules
28 181 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 181 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 181 ▶use Mnet;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 181 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33  
34  
35 42 ▶sub enable {
Subroutine enable: called CC=2 SCAR=7.0
Pod undocumented
36  
37 # Mnet::Opts::Set::enable($pragma)
38 # purpose: use this function to dynamically load the specified pragma option
39 # $pragma: progma option to enable, such as silent, quiet, etc.
40  
41 42 ▶ my $pragma = shift // croak("missing pragma arg");
Condition50%1/2
shift() // croak("missing pragma arg")
l!l
420
MC/DC0%0/1
shift() // croak("missing pragma arg")
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
42 42 my $path = $INC{"Mnet/Opts/Set.pm"};
43 42 $path =~ s/(Mnet\/Opts\/Set)\.pm$/$1\//;
44 42 $path .= ucfirst($pragma) . ".pm";
45 42 $INC{"Mnet/Opts/Set/".ucfirst($pragma).".pm"} = $path;
46 42 return;
47 }
48  
49  
50  
51 3976 ▶sub pragmas {
Subroutine pragmas: called CC=3 SCAR=11.0
Pod documented
52  
53 =head2 Mnet::Opts::Set::pragmas
54  
55 $opts = Mnet::Opts::Set::pragmas()
56  
57 This function returns a hash containing true values for any Mnet::Opts::Set
58 pragma sub-modules that have been loaded with the perl 'use' command.
59  
60 Refer to the SEE ALSO section of this document for a list of these sub-modules.
61  
62 =cut
63  
64 # return opts hash with values set for used Mnet::Opts::Set sub-modules
65 3976 my $opts = {};
66 3976 foreach my $module (keys %INC) {
67 468500 ▶ next if $module !~ /^Mnet\/Opts\/Set\/(\S+)\.pm$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $module =~ m[^Mnet/Opts/Set/(\S+)\.pm$] 467172 1328 468500
68 1328 $opts->{lc($1)} = 1;
69 }
70 3976 return $opts;
71 }
72  
73  
74  
75 =head1 SEE ALSO
76  
77 L<Mnet>
78  
79 L<Mnet::Opts>
80  
81 L<Mnet::Opts::Cli>
82  
83 L<Mnet::Opts::Set::Debug>
84  
85 L<Mnet::Opts::Set::Quiet>
86  
87 L<Mnet::Opts::Set::Silent>
88  
89 =cut
90  
91 # normal package return
92 181 1;
93  
« Mnet/Log/Conditional.pm ↑ Summary Mnet/Dump.pm »