| 1 | package LEOCHARRE::PMInspect; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | # use Smart::Comments '###'; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | my($class,$self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | $self||={}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self ||= {}
MC/DC0%0/1
$self ||= {}
$self
Truth table50%1/2
A
A= $self
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | bless $self,$class; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | ▶ | sub pm_class { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pm_class: called CC=9 SCAR=27.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 8 | my($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 8 | ▶ | if(defined $val){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $self->{pm_class} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | ▶ | if ((!defined $self->{pm_class} and !defined $self->{pm_instance}) and defined $self->{pm_path}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not defined $self->{"pm_class"} || defined $self->{"pm_instance"} and defined $self->{"pm_path"}
defined $self->{'pm_class'} || defined $self->{'pm_instance'}
MC/DC0%0/3
not defined $self->{"pm_class"} || defined $self->{"pm_instance"} and defined $self->{"pm_path"}
defined $self->{'pm_class'}
defined $self->{'pm_instance'}
defined $self->{"pm_path"}
Truth table50%2/4
not(A || B) and C
A= defined $self->{'pm_class'}B= defined $self->{'pm_instance'}C= defined $self->{"pm_path"}
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my @pkg = $self->minfo->packages_inside; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | my $class = shift @pkg if @pkg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $self->{pm_class} = $class; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 8 | ▶ | if( ! defined $self->{pm_class}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | if ( my $ref = $self->pm_instance ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | my $class = ref $ref or die("not ref"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | $self->{pm_class} = $class; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | return $self->{pm_class}; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | sub pm_instance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pm_instance: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | my($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | ▶ | if(defined $val){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $self->{pm_instance} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | ▶ | if( !defined $self->{pm_instance} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 1 | ▶ | my $class = $self->pm_class or die("pm_instance not passed and pm_class not set"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 1 | ▶ | eval "use $class;" ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | my $instance = $class->new() or die; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | $self->{pm_instance} = $instance; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | 4 | return $self->{pm_instance}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 2 | ▶ | sub pm_path { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pm_path: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | my($self,$val) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | ▶ | $self->{pm_path} = $val if defined $val; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | ▶ | unless( defined $self->{pm_path} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | $self->minfo; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | $self->{pm_path} = $self->minfo->file ; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 2 | return $self->{pm_path}; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | # INSPECTOR OBJECTS | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | sub _symdump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_symdump: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | ▶ | unless( $self->{devel_symdump} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | require Devel::Symdump; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 1 | my $obj = Devel::Symdump->new( $self->pm_class ); | |||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | $self->{devel_symdump} = $obj; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | return $self->{devel_symdump}; | |||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | # OUTPUT METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | ▶ | sub dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | require Data::Dumper; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | my $string = Data::Dumper::Dumper($self->pm_instance); | |||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | return $string; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | ▶ | sub symdump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
symdump: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | return $self->_symdump->as_string; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | # ALL OUTPUTS | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | ▶ | sub output { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
output: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | my $output = sprintf "class: %s, ref: %s\n", $self->pm_class, $self->pm_instance; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | $output .= sprintf "symdump:\n%s\n", $self->symdump; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | $output .= sprintf "dump:\n%s\n", $self->dump(); | |||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 1 | return $output; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 5 | ▶ | sub minfo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
minfo: called CC=4 SCAR=15.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 5 | ▶ | unless( defined $self->{module_info} ){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | require Module::Info; | |||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | ▶ | if ( $self->{pm_path} ){ # if we call via method, will go into endless loop | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | print STDERR " fromfile \n"; | |||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $self->{module_info} = Module::Info->new_from_file( $self->pm_path ); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | elsif ( $self->pm_class ){ | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 2 | print STDERR " romclass \n"; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 2 | $self->{module_info} = Module::Info->new_from_module( $self->pm_class ); | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | die("no pm_path or pm_class can be set"); | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 5 | return $self->{module_info}; | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | __END__ | ||||||||||||||||||||||||||||||||||||||||||