Digital.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 84.3% 43 / 51 CC 5 SCAR 9.0
CC
5
Cov
85%
import
4.9
register_input
2.0
BEGIN
1.0
CRAP 2.5
« Digital/Role.pm ↑ Summary
1 package Digital;
2 3 our $AUTHORITY = 'cpan:GETTY';
3 # ABSTRACT: Handling conversion of digital values towards physical units
4 3 $Digital::VERSION = '0.003';
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Package::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Module::Runtime qw( use_module );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 our %inputs;
11  
12 3 ▶sub register_input {
Subroutine register_input: called CC=2 SCAR=7.0
Pod undocumented
13 3 my ( undef, $input, $input_class ) = @_;
14 3 ▶ unless (defined $input_class) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $input_class) 3 0 3
15 3 $input_class = $input;
16 3 $input = lc($input_class);
17 3 $input =~ s!::!_!g;
18 3 $input =~ s!^digitalx_!!g;
19 }
20 3 $inputs{$input} = $input_class;
21 }
22  
23 2 ▶sub input {
Subroutine input: called CC=1 SCAR=0.0
Pod undocumented
24 2 my ( $class, $input, @args ) = @_;
25 2 my $input_class = $inputs{$input};
26 2 return $input_class->input(@args);
27 }
28  
29 3 ▶sub import {
Subroutine import: called CC=4 SCAR=15.9
30 3 my ( $class, @args ) = @_;
31 3 my ( $caller ) = caller;
32 3 my $stash = Package::Stash->new($caller);
33 3 my @classes;
34 0 ▶ for (@args) { unless (/^-/) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/^-/) 0 0 0
35 0 push @classes, 'DigitalX::'.$_;
36 } }
37 3 for (@classes) {
38 0 use_module($_);
39 }
40 3 ▶ $stash->add_symbol('&input', sub { return $class->input(@_) });
Subroutine __ANON__: called CC=1 SCAR=0.0
41 }
42  
43 3 1;
44  
45 __END__
« Digital/Role.pm ↑ Summary