| 1 | 3 | ▶ | use 5.006; # our | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package App::Isa::Splain; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.002001'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # ABSTRACT: Visualize Module Hierarchies on the command line | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Module::Load qw( load ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use Devel::Isa::Explainer qw( explain_isa ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Perl critic is broken. This is not a void context. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ## no critic (BuiltinFunctions::ProhibitVoidMap) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use constant 1.03 ( { map { ( ( sprintf '_E%x', $_ ), ( sprintf ' E<%s#%d>', __PACKAGE__, $_ ) ) } 1 .. 3 } ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=11.6
Subroutine
new: called CC=2 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my ( $class, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my (%args) = ref $args[0] ? %{ $args[0] } : @args; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | return bless \%args, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub new_from_ARGV { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=30.4
Subroutine
new_from_ARGV: called CC=8 SCAR=30.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my (@args) = defined $_[1] ? @{ $_[1] } : @ARGV; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $module; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my @load_modules; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | while ( @args ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my $argument = shift @args; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if ( not defined $module and $argument !~ /\A-/sx ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
defined $module or $argument =~ /\A-/sx
defined $module or $argument =~ /\A-/sx
MC/DC0%0/2
defined $module or $argument =~ /\A-/sx
defined $module
$argument =~ /\A-/sx
MC/DC50%1/2
defined $module or $argument =~ /\A-/sx
defined $module
$argument =~ /\A-/sx
Truth table0%0/3
A or B
A= defined $moduleB= $argument =~ /\A-/sx
Truth table66%2/3
A or B
A= defined $moduleB= $argument =~ /\A-/sx
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $module = $argument; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if( $argument =~ /\A-M(.*)\z/sx ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | push @load_modules, $1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | croak 'Unexpected argument ' . $argument . _E3; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | defined $module or croak 'Expected a module name, got none' . _E1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | return $_[0]->new( module => $module, load_modules => [ @load_modules ? @load_modules : $module ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub _load_modules { return @{ $_[0]->{load_modules} } } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_load_modules: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub _module { return $_[0]->{module} } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_module: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub _output { return ( $_[0]->{output} || *STDOUT ) } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Subroutine
_output: not called CC=2 SCAR=17.9
Condition0%0/6
$_[0]{'output'} || *STDOUT
$_[0]{'output'} || *STDOUT
MC/DC0%0/2
$_[0]{'output'} || *STDOUT
$_[0]{'output'}
*STDOUT
MC/DC0%0/2
$_[0]{'output'} || *STDOUT
$_[0]{'output'}
*STDOUT
Truth table0%0/3
A || B
A= $_[0]{'output'}B= *STDOUT
Truth table0%0/3
A || B
A= $_[0]{'output'}B= *STDOUT
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
Subroutine
run: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | load $_ for $self->_load_modules; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | croak "Could not print to output handle: $! $^E" . _E2 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | unless print { $self->_output } explain_isa( $self->_module ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||