| 1 | package Util::Medley::Module::Overview; | ||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $Util::Medley::Module::Overview::VERSION = '0.049'; | |||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Modern::Perl; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Kavorka 'method'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Printer alias => 'pdump'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Module::Overview; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use constant; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Module::Load; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||
| 12 | 1 | with | |||||||||||||||||||||||||||||||||||||
| 13 | 'Util::Medley::Roles::Attributes::List', | ||||||||||||||||||||||||||||||||||||||
| 14 | 'Util::Medley::Roles::Attributes::String'; | ||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||
| 16 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||
| 18 | Util::Medley::Module::Overview | ||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||
| 20 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||
| 22 | version 0.049 | ||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||
| 24 | =cut | ||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||
| 26 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||
| 28 | my $mo = Util::Medley::Module::Overview->new( | ||||||||||||||||||||||||||||||||||||||
| 29 | moduleName => 'My::Module', | ||||||||||||||||||||||||||||||||||||||
| 30 | hideModules => [ 'Moose::Object' ], | ||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||
| 33 | foreach my $pm ($mo->getPublicMethods) { | ||||||||||||||||||||||||||||||||||||||
| 34 | say $pm; | ||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||
| 37 | =cut | ||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||
| 39 | ######################################################## | ||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||
| 41 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||
| 43 | This is simply a wrapper for Module::Overview with enhancements. | ||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||
| 45 | =cut | ||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||
| 47 | ######################################################## | ||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||
| 49 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||
| 51 | =head2 moduleName (required) | ||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||
| 53 | The module you want an overview for. | ||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||
| 55 | =over | ||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||
| 57 | =item type: Str | ||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||
| 59 | =back | ||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||
| 61 | =cut | ||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||
| 63 | 1 | has moduleName => ( | |||||||||||||||||||||||||||||||||||||
| 64 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||
| 65 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||
| 66 | required => 1, | ||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||
| 69 | =head2 hideModules (optional) | ||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||
| 71 | List of modules you want to exclude. | ||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||
| 73 | =over | ||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||
| 75 | =item type: ArrayRef[Str] | ||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||
| 77 | =back | ||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||
| 79 | =cut | ||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||
| 81 | 1 | has hideModules => ( | |||||||||||||||||||||||||||||||||||||
| 82 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 83 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||
| 86 | ######################################################## | ||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||
| 88 | 1 | has _myAttributes => ( | |||||||||||||||||||||||||||||||||||||
| 89 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 90 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 91 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 92 | builder => '_buildMyAttributes', | ||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||
| 95 | 1 | has _myMethods => ( | |||||||||||||||||||||||||||||||||||||
| 96 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 97 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 98 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 99 | builder => '_buildMyMethods', | ||||||||||||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||
| 102 | 1 | has _myMethodsAndAttributes => ( | |||||||||||||||||||||||||||||||||||||
| 103 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 104 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 105 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 106 | builder => '_buildMyMethodsAndAttributes', | ||||||||||||||||||||||||||||||||||||||
| 107 | ); | ||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||
| 109 | 1 | has _myConstants => ( | |||||||||||||||||||||||||||||||||||||
| 110 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 111 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 112 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 113 | builder => '_buildMyConstants', | ||||||||||||||||||||||||||||||||||||||
| 114 | ); | ||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||
| 116 | ### | ||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||
| 118 | 1 | has _inheritedAttributes => ( | |||||||||||||||||||||||||||||||||||||
| 119 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 120 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 121 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 122 | builder => '_buildInheritedAttributes', | ||||||||||||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||
| 125 | 1 | has _inheritedMethods => ( | |||||||||||||||||||||||||||||||||||||
| 126 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 127 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 128 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 129 | builder => '_buildInheritedMethods', | ||||||||||||||||||||||||||||||||||||||
| 130 | ); | ||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||
| 132 | 1 | has _inheritedMethodsAndAttributes => ( | |||||||||||||||||||||||||||||||||||||
| 133 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 134 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||||||||||||
| 135 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||
| 136 | builder => '_buildInheritedMethodsAndAttributes', | ||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||
| 139 | ### | ||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||
| 141 | 1 | has _moduleOverview => ( | |||||||||||||||||||||||||||||||||||||
| 142 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||
| 143 | isa => 'HashRef', | ||||||||||||||||||||||||||||||||||||||
| 144 | builder => '_buildModuleOverview', | ||||||||||||||||||||||||||||||||||||||
| 145 | ); | ||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||
| 147 | has _mooseMetaCache => ( | ||||||||||||||||||||||||||||||||||||||
| 148 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 149 | isa => 'HashRef', | ||||||||||||||||||||||||||||||||||||||
| 150 | 1 | ▶ | default => sub { {} } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 151 | 1 | ); | |||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||
| 153 | has _classTypeCache => ( | ||||||||||||||||||||||||||||||||||||||
| 154 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||
| 155 | isa => 'HashRef', | ||||||||||||||||||||||||||||||||||||||
| 156 | 1 | ▶ | default => sub { {} } | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 157 | 1 | ); | |||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||
| 159 | ######################################################## | ||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||
| 161 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||
| 163 | =head2 getImportedModules | ||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||
| 165 | Returns a list of modules used by the module. | ||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||
| 167 | =cut | ||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||
| 169 | 1 | ▶ | method getImportedModules { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
getImportedModules: called CC=3 SCAR=11.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||
| 171 | 1 | my $mo = $self->_moduleOverview; | |||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||
| 173 | 1 | my @imported; | |||||||||||||||||||||||||||||||||||||
| 174 | 1 | ▶ | if ( $mo->{uses} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 175 | 1 | @imported = @{ $mo->{uses} }; | |||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||
| 178 | 1 | return $self->List->nsort(@imported); | |||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||
| 181 | =head2 getParents | ||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||
| 183 | Returns a list of parent modules. | ||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||
| 185 | =cut | ||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||
| 187 | 1 | ▶ | method getParents { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getParents: not called CC=4 SCAR=25.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $mo = $self->_moduleOverview; | |||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||
| 191 | 0 | my @parents; | |||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ( $mo->{parents} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 193 | 0 | push @parents, @{ $mo->{parents} }; | |||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | if ( $mo->{classes} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 197 | 0 | push @parents, @{ $mo->{classes} }; | |||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return @parents; | |||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||
| 203 | =head2 getConstants | ||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||
| 205 | Returns a list of constants. | ||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||
| 207 | =cut | ||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||
| 209 | 1 | ▶ | method getConstants { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getConstants: not called CC=2 SCAR=10.5
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return @{ $self->_getMyConstants }; | |||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||
| 214 | =head2 getAllPublicAttributes | ||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||
| 216 | Combines and sorts the results from getPublicAttributes() and | ||||||||||||||||||||||||||||||||||||||
| 217 | getInheritedPublicAttributes(). | ||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||
| 219 | =cut | ||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | method getAllPublicAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getAllPublicAttributes: not called CC=4 SCAR=24.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my @all = $self->getPublicAttributes; | |||||||||||||||||||||||||||||||||||||
| 224 | 0 | push @all, $self->getInheritedPublicAttributes; | |||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||
| 226 | # | ||||||||||||||||||||||||||||||||||||||
| 227 | # build a map | ||||||||||||||||||||||||||||||||||||||
| 228 | # | ||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my %map; | |||||||||||||||||||||||||||||||||||||
| 230 | 0 | foreach my $aref (@all) { | |||||||||||||||||||||||||||||||||||||
| 231 | 0 | $map{ $aref->[0] } = [@$aref]; | |||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||
| 234 | # | ||||||||||||||||||||||||||||||||||||||
| 235 | # get a sorted list of map keys | ||||||||||||||||||||||||||||||||||||||
| 236 | # | ||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my @keys = $self->List->nsort( keys %map ); | |||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||
| 239 | # | ||||||||||||||||||||||||||||||||||||||
| 240 | # prepare sorted list of arrayrefs | ||||||||||||||||||||||||||||||||||||||
| 241 | # | ||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my @sorted; | |||||||||||||||||||||||||||||||||||||
| 243 | 0 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||
| 244 | 0 | push @sorted, $map{$key}; | |||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||
| 247 | 0 | return @sorted; # Array[ArrayRef] | |||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||
| 250 | =head2 getPublicAttributes | ||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||
| 252 | Returns a list of public attributes. Each item in the list is an ArrayRef | ||||||||||||||||||||||||||||||||||||||
| 253 | of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||
| 255 | =cut | ||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||
| 257 | 1 | ▶ | method getPublicAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getPublicAttributes: not called CC=5 SCAR=29.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my $modname = $self->moduleName; | |||||||||||||||||||||||||||||||||||||
| 260 | 0 | my $meta = $modname->meta(); | |||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my @public; | |||||||||||||||||||||||||||||||||||||
| 263 | 0 | foreach my $name ( @{ $self->_getMyAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | next if $name =~ /^_/; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $from = 'this'; | |||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $attr = $meta->get_attribute($name); | |||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if ( $attr->has_role_attribute ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $from = $attr->{definition_context}->{package}; | |||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||
| 273 | 0 | my $aref = [ $name, $from ]; # convert to aref and add empty source | |||||||||||||||||||||||||||||||||||||
| 274 | 0 | push @public, $aref; | |||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||
| 277 | 0 | return @public; | |||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||
| 280 | =head2 getInheritedPublicAttributes | ||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||
| 282 | Returns a list of inherited public attributes. Each item in the list is an | ||||||||||||||||||||||||||||||||||||||
| 283 | ArrayRef of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||
| 285 | =cut | ||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||
| 287 | 1 | ▶ | method getInheritedPublicAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getInheritedPublicAttributes: not called CC=4 SCAR=24.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my @public; | |||||||||||||||||||||||||||||||||||||
| 290 | 0 | foreach my $attr ( @{ $self->_getInheritedAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||
| 292 | 0 | my ( $name, $from ) = @$attr; | |||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if ( $name !~ /^_/ ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 294 | 0 | push @public, $attr; | |||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||
| 298 | 0 | return @public; | |||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||
| 301 | =head2 getPrivateAttributes | ||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||
| 303 | Returns a list of private attributes. Each item in the list is an ArrayRef | ||||||||||||||||||||||||||||||||||||||
| 304 | of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||
| 306 | =cut | ||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||
| 308 | 1 | ▶ | method getPrivateAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getPrivateAttributes: not called CC=4 SCAR=23.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my @private; | |||||||||||||||||||||||||||||||||||||
| 311 | 0 | foreach my $attr ( @{ $self->_getMyAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | if ( $attr =~ /^_/ ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 314 | 0 | push @private, $attr; | |||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||
| 318 | 0 | return @private; | |||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||
| 321 | =head2 getInheritedPrivateAttributes | ||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||
| 323 | Returns a list of inherited private attributes. Each item in the list | ||||||||||||||||||||||||||||||||||||||
| 324 | is an ArrayRef of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||
| 326 | =cut | ||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||
| 328 | 1 | ▶ | method getInheritedPrivateAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getInheritedPrivateAttributes: not called CC=4 SCAR=24.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||
| 330 | 0 | my @private; | |||||||||||||||||||||||||||||||||||||
| 331 | 0 | foreach my $aref ( @{ $self->_getInheritedAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my ( $name, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | if ( $name =~ /^_/ ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 335 | 0 | push @private, [@$aref]; | |||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||
| 339 | 0 | return @private; | |||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||
| 342 | =head2 getAllPublicMethods | ||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||
| 344 | Combines and sorts the results from getPublicMethods() and | ||||||||||||||||||||||||||||||||||||||
| 345 | getInheritedPublicMethods(). | ||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||
| 347 | =cut | ||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||
| 349 | 1 | ▶ | method getAllPublicMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getAllPublicMethods: not called CC=4 SCAR=24.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||
| 351 | 0 | my @all = $self->getPublicMethods; | |||||||||||||||||||||||||||||||||||||
| 352 | 0 | push @all, $self->getInheritedPublicMethods; | |||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||
| 354 | # | ||||||||||||||||||||||||||||||||||||||
| 355 | # build a map | ||||||||||||||||||||||||||||||||||||||
| 356 | # | ||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my %map; | |||||||||||||||||||||||||||||||||||||
| 358 | 0 | foreach my $aref (@all) { | |||||||||||||||||||||||||||||||||||||
| 359 | 0 | $map{ $aref->[0] } = $aref; | |||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||
| 362 | # | ||||||||||||||||||||||||||||||||||||||
| 363 | # get a sorted list of map keys | ||||||||||||||||||||||||||||||||||||||
| 364 | # | ||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my @keys = $self->List->nsort( keys %map ); | |||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||
| 367 | # | ||||||||||||||||||||||||||||||||||||||
| 368 | # prepare sorted list of arrayrefs | ||||||||||||||||||||||||||||||||||||||
| 369 | # | ||||||||||||||||||||||||||||||||||||||
| 370 | 0 | my @sorted; | |||||||||||||||||||||||||||||||||||||
| 371 | 0 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||
| 372 | 0 | push @sorted, $map{$key}; | |||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||
| 375 | 0 | return @sorted; # Array[ArrayRef] | |||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||
| 378 | =head2 getPublicMethods | ||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||
| 380 | Returns a list of public methods. Each item in the list is an ArrayRef | ||||||||||||||||||||||||||||||||||||||
| 381 | of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||
| 383 | =cut | ||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||
| 385 | 1 | ▶ | method getPublicMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getPublicMethods: not called CC=8 SCAR=39.4
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my $meta; | |||||||||||||||||||||||||||||||||||||
| 388 | my @public; | ||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||
| 390 | 0 | foreach my $name ( @{ $self->_getMyMethods } ) { | |||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||
| 392 | # moose objects seems to end up with a public method called meta() | ||||||||||||||||||||||||||||||||||||||
| 393 | # here we skip it if we encounter it. | ||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my $scrubbed = $self->_scrubParens($name); | |||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | if ( $scrubbed ne 'meta' ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | next if $scrubbed =~ /^_/; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $from = 'this'; | |||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | if ( $self->isMooseModule ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | $meta = $self->moduleName->meta if !$meta; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my $method = $meta->get_method($scrubbed); | |||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my $srcPkg = $method->original_package_name; | |||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | if ( $srcPkg ne $self->moduleName ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $from = $method->original_package_name; | |||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||
| 412 | 0 | push @public, [ $scrubbed, $from ]; | |||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||
| 416 | 0 | return @public; | |||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||
| 419 | =head2 getInheritedPublicMethods | ||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||
| 421 | Returns a list of inherited public methods. Each item in the list is an | ||||||||||||||||||||||||||||||||||||||
| 422 | ArrayRef of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||
| 424 | =cut | ||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||
| 426 | 1 | ▶ | method getInheritedPublicMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getInheritedPublicMethods: not called CC=5 SCAR=28.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my @public; | |||||||||||||||||||||||||||||||||||||
| 429 | 0 | foreach my $aref ( @{ $self->_getInheritedMethods } ) { | |||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my ( $method, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | next if $from eq 'Moose::Object'; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | next if $method =~ /^_/; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||
| 435 | 0 | push @public, [@$aref]; | |||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||
| 438 | 0 | return @public; | |||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||
| 441 | =head2 getPrivateMethods | ||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||
| 443 | Returns a list of private methods. Each item in the list is an ArrayRef | ||||||||||||||||||||||||||||||||||||||
| 444 | of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||
| 446 | =cut | ||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||
| 448 | 1 | ▶ | method getPrivateMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getPrivateMethods: not called CC=4 SCAR=23.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||
| 450 | 0 | my @private; | |||||||||||||||||||||||||||||||||||||
| 451 | 0 | foreach my $method ( @{ $self->_getMyMethods } ) { | |||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | if ( $method =~ /^_/ ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 453 | 0 | push @private, $method; | |||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||
| 457 | 0 | return @private; | |||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||
| 460 | =head2 getInheritedPrivateMethods | ||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||
| 462 | Returns a list of inherited private methods. Each item in the list is an | ||||||||||||||||||||||||||||||||||||||
| 463 | ArrayRef of [ name, src ]. | ||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||
| 465 | =cut | ||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||
| 467 | 1 | ▶ | method getInheritedPrivateMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
getInheritedPrivateMethods: not called CC=4 SCAR=24.1
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my @private; | |||||||||||||||||||||||||||||||||||||
| 470 | 0 | foreach my $aref ( @{ $self->_getInheritedMethods } ) { | |||||||||||||||||||||||||||||||||||||
| 471 | 0 | my ( $method, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if ( $method =~ /^_/ ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 473 | 0 | push @private, [@$aref]; | |||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||
| 477 | 0 | return @private; | |||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||
| 480 | 1 | ▶ | method isMooseModule (Str $module?) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
isMooseModule: not called CC=10 SCAR=42.3
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | $module = $self->moduleName if !$module; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 483 | 0 | load($module); | |||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $c = $self->_classTypeCache; | |||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | if ( !defined $c->{$module} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if ( $module->isa('Moose::Object') ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $c->{$module} = 'moose'; | |||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||
| 491 | else { | ||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $c->{$module} = 'notmoose'; | |||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | if ( $c->{$module} eq 'moose' ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 497 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||
| 500 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||
| 503 | ############################################################## | ||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||
| 505 | 1 | ▶ | method _parseMethods (ArrayRef $aref) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
_parseMethods: not called CC=8 SCAR=37.1
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||
| 507 | 0 | my @parsed; | |||||||||||||||||||||||||||||||||||||
| 508 | 0 | foreach my $method (@$aref) { | |||||||||||||||||||||||||||||||||||||
| 509 | 0 | my ( $name, $from ) = split( /\s+/, $method ); | |||||||||||||||||||||||||||||||||||||
| 510 | 0 | ▶ | if ($from) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $from =~ s/\[//; | |||||||||||||||||||||||||||||||||||||
| 512 | 0 | $from =~ s/\]//; | |||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||
| 515 | 0 | push @parsed, [ $name, $from ]; | |||||||||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||
| 518 | 0 | return @parsed; | |||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||
| 521 | 1 | ▶ | method _buildModuleOverview { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
_buildModuleOverview: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||
| 523 | 1 | my $mo = Module::Overview->new( { module_name => $self->moduleName } ); | |||||||||||||||||||||||||||||||||||||
| 524 | 1 | my $href = $mo->get( $self->moduleName ); | |||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||
| 526 | 1 | return $href; | |||||||||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||
| 529 | method _isConstant (Str $pkg!, | ||||||||||||||||||||||||||||||||||||||
| 530 | 1 | ▶ | Str $method!) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.4
Subroutine
BEGIN: called CC=1 SCAR=3.4
Subroutine
BEGIN: called CC=1 SCAR=3.4
Subroutine
_isConstant: not called CC=11 SCAR=42.8
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||
| 532 | 0 | $method =~ s/\(\)//; # remove parens; | |||||||||||||||||||||||||||||||||||||
| 533 | 0 | my $fullName = sprintf '%s::%s', $pkg, $method; | |||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | if ( $constant::declared{$fullName} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 536 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||
| 538 | elsif ( $self->String->isUpper($method) ) { | ||||||||||||||||||||||||||||||||||||||
| 539 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||
| 542 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||
| 545 | 1 | ▶ | method _scrubParens (Str $value) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
_scrubParens: not called CC=6 SCAR=30.3
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||
| 547 | 0 | $value =~ s/\(\)//; | |||||||||||||||||||||||||||||||||||||
| 548 | 0 | return $value; | |||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||
| 551 | 1 | ▶ | method _getInheritedMethods (--> ArrayRef) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.3
Subroutine
_getInheritedMethods: not called CC=3 SCAR=17.3
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||||||||||||
| 553 | 0 | return $self->_inheritedMethods; | |||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||
| 556 | 1 | ▶ | method _getInheritedAttributes (--> ArrayRef) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.3
Subroutine
_getInheritedAttributes: not called CC=3 SCAR=17.3
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||
| 558 | 0 | return $self->_inheritedAttributes; | |||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||
| 561 | 1 | ▶ | method _getMyMethods (--> ArrayRef) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.3
Subroutine
_getMyMethods: not called CC=3 SCAR=17.3
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||
| 563 | 0 | return $self->_myMethods; | |||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||
| 566 | 1 | ▶ | method _getMyConstants { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_getMyConstants: not called CC=2 SCAR=9.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||
| 568 | 0 | return $self->_myConstants; | |||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||
| 571 | 1 | ▶ | method _buildMyConstants { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildMyConstants: not called CC=4 SCAR=23.7
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||
| 573 | 0 | my @constants; | |||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||
| 575 | 0 | foreach my $name ( @{ $self->_getMyMethodsAndAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | if ( $self->_isConstant( $self->moduleName, $name ) ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 578 | 0 | push @constants, $self->_scrubParens($name); | |||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||
| 582 | 0 | return \@constants; | |||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||
| 585 | 1 | ▶ | method _buildInheritedMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildInheritedMethods: not called CC=5 SCAR=28.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||
| 587 | 0 | my @methods; | |||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||
| 589 | 0 | foreach my $aref ( @{ $self->_getInheritedMethodsAndAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||
| 591 | 0 | my ( $name, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | next if $self->_isConstant( $from, $name ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | next if $self->_isMooseAttribute( $from, $name ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||
| 595 | 0 | push @methods, $aref; | |||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||
| 598 | 0 | return \@methods; | |||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||
| 601 | 1 | ▶ | method _buildInheritedAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildInheritedAttributes: not called CC=5 SCAR=29.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||
| 603 | 0 | my @attr; | |||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||
| 605 | 0 | foreach my $aref ( @{ $self->_getInheritedMethodsAndAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||
| 607 | 0 | my ( $name, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 608 | 0 | $name = $self->_scrubParens($name); | |||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | next if $self->_isConstant( $from, $name ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | next if !$self->_isMooseAttribute( $from, $name ); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||
| 613 | 0 | push @attr, [ $name, $from ]; | |||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||
| 616 | 0 | return \@attr; | |||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||
| 619 | 1 | ▶ | method _buildMyMethods { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildMyMethods: not called CC=6 SCAR=32.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||
| 621 | 0 | my @methods; | |||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||
| 623 | 0 | foreach my $name ( @{ $self->_getMyMethodsAndAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | if ( !$self->_isConstant( $self->moduleName, $name ) ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | if ( $self->isMooseModule ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||
| 628 | 0 | my $bool = $self->_isMooseAttribute( $self->moduleName, $name ); | |||||||||||||||||||||||||||||||||||||
| 629 | 0 | ▶ | if ( !$bool ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 630 | 0 | push @methods, $name; | |||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||
| 632 | } | ||||||||||||||||||||||||||||||||||||||
| 633 | else { | ||||||||||||||||||||||||||||||||||||||
| 634 | 0 | push @methods, $name; | |||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||
| 637 | } | ||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||
| 639 | 0 | return \@methods; | |||||||||||||||||||||||||||||||||||||
| 640 | } | ||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||
| 642 | 1 | ▶ | method _getMooseMeta (Str $module) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
_getMooseMeta: not called CC=8 SCAR=36.9
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | if ( $self->isMooseModule($module) ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||
| 646 | 0 | my $c = $self->_mooseMetaCache; | |||||||||||||||||||||||||||||||||||||
| 647 | 0 | ▶ | if ( !$c->{$module} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 648 | 0 | $c->{$module} = $module->meta; | |||||||||||||||||||||||||||||||||||||
| 649 | } | ||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||
| 651 | 0 | return $c->{$module}; | |||||||||||||||||||||||||||||||||||||
| 652 | } | ||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||
| 655 | method _isMooseAttribute (Str $module!, | ||||||||||||||||||||||||||||||||||||||
| 656 | Str $name! | ||||||||||||||||||||||||||||||||||||||
| 657 | 1 | ▶ | --> Bool) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.4
Subroutine
BEGIN: called CC=1 SCAR=3.4
Subroutine
BEGIN: called CC=1 SCAR=3.4
Subroutine
_isMooseAttribute: not called CC=12 SCAR=44.5
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||
| 659 | 0 | $name = $self->_scrubParens($name); | |||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||
| 661 | 0 | my $meta = $self->_getMooseMeta($module); | |||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | if ($meta) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||
| 664 | 0 | foreach my $attr ( $meta->get_all_attributes ) { | |||||||||||||||||||||||||||||||||||||
| 665 | 0 | ▶ | if ( $attr->name eq $name ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 666 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||
| 670 | |||||||||||||||||||||||||||||||||||||||
| 671 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||
| 674 | 1 | ▶ | method _getMyAttributes (--> ArrayRef) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.3
Subroutine
_getMyAttributes: not called CC=3 SCAR=17.3
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||
| 676 | 0 | return $self->_myAttributes; | |||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||
| 679 | 1 | ▶ | method _buildMyAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildMyAttributes: not called CC=5 SCAR=28.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||
| 681 | 0 | my @attr; | |||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||
| 683 | 0 | ▶ | if ( $self->isMooseModule ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||
| 685 | 0 | foreach my $name ( @{ $self->_getMyMethodsAndAttributes } ) { | |||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||
| 687 | 0 | my $bool = $self->_isMooseAttribute( $self->moduleName, $name ); | |||||||||||||||||||||||||||||||||||||
| 688 | 0 | ▶ | if ($bool) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 689 | 0 | push @attr, $self->_scrubParens($name); | |||||||||||||||||||||||||||||||||||||
| 690 | } | ||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||
| 694 | 0 | return \@attr; | |||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||
| 697 | 1 | ▶ | method _getInheritedMethodsAndAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_getInheritedMethodsAndAttributes: not called CC=2 SCAR=9.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||
| 699 | 0 | return $self->_inheritedMethodsAndAttributes; | |||||||||||||||||||||||||||||||||||||
| 700 | } | ||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||
| 702 | 1 | ▶ | method _getMyMethodsAndAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_getMyMethodsAndAttributes: not called CC=2 SCAR=9.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||
| 704 | 0 | return $self->_myMethodsAndAttributes; | |||||||||||||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||
| 707 | =pod | ||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||
| 709 | method _buildMyMethodsAndAttributes { | ||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||
| 711 | my $mo = $self->_moduleOverview; | ||||||||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||||||||
| 713 | my @methods; | ||||||||||||||||||||||||||||||||||||||
| 714 | push @methods, @{ $mo->{methods} } if $mo->{methods}; | ||||||||||||||||||||||||||||||||||||||
| 715 | push @methods, @{ $mo->{methods_imported} } if $mo->{methods_imported}; | ||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||
| 717 | my @sorted = $self->List->nsort(@methods); | ||||||||||||||||||||||||||||||||||||||
| 718 | my @parsed = $self->_parseMethods( \@sorted ); | ||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||
| 720 | my @mine; | ||||||||||||||||||||||||||||||||||||||
| 721 | foreach my $aref (@parsed) { | ||||||||||||||||||||||||||||||||||||||
| 722 | my ( $name, $from ) = @$aref; | ||||||||||||||||||||||||||||||||||||||
| 723 | if ( !$from ) { | ||||||||||||||||||||||||||||||||||||||
| 724 | push @mine, $name; | ||||||||||||||||||||||||||||||||||||||
| 725 | } | ||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||
| 728 | return \@mine; | ||||||||||||||||||||||||||||||||||||||
| 729 | } | ||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||
| 731 | =cut | ||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||
| 733 | 1 | ▶ | method _buildMyMethodsAndAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildMyMethodsAndAttributes: not called CC=7 SCAR=36.8
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my $mo = $self->_moduleOverview; | |||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my @methods; | |||||||||||||||||||||||||||||||||||||
| 738 | 0 | ▶ | push @methods, @{ $mo->{methods} } if $mo->{methods}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | push @methods, @{ $mo->{methods_imported} } if $mo->{methods_imported}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my @sorted = $self->List->nsort(@methods); | |||||||||||||||||||||||||||||||||||||
| 742 | 0 | my @parsed = $self->_parseMethods( \@sorted ); | |||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||
| 744 | 0 | my @mine; | |||||||||||||||||||||||||||||||||||||
| 745 | 0 | foreach my $aref (@parsed) { | |||||||||||||||||||||||||||||||||||||
| 746 | 0 | my ( $name, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | if ( !$from ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 749 | 0 | my $module = $self->_isImportedSub($name); | |||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | if ( !$module ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 751 | 0 | push @mine, $name; | |||||||||||||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||
| 756 | 0 | return \@mine; | |||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||
| 759 | 1 | ▶ | method _getModuleExports (Str $moduleName) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
_getModuleExports: not called CC=7 SCAR=32.8
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||
| 761 | 0 | my @exports; | |||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||
| 763 | 0 | ▶ | if ( $moduleName->isa('Exporter') ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||
| 765 | # TODO: this could be improved by testing for exactly | ||||||||||||||||||||||||||||||||||||||
| 766 | # what is imported. For now, just assumes subs in | ||||||||||||||||||||||||||||||||||||||
| 767 | # EXPORT_OK were imported. | ||||||||||||||||||||||||||||||||||||||
| 768 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 769 | 0 | push @exports, @{ sprintf '%s::EXPORT', $moduleName }; | |||||||||||||||||||||||||||||||||||||
| 770 | 0 | push @exports, @{ sprintf '%s::EXPORT_OK', $moduleName }; | |||||||||||||||||||||||||||||||||||||
| 771 | 0 | @exports = $self->List->uniq(@exports); | |||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||
| 774 | 0 | return @exports; | |||||||||||||||||||||||||||||||||||||
| 775 | } | ||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||
| 777 | 1 | ▶ | method _isImportedSub (Str $subName) { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
BEGIN: called CC=1 SCAR=3.2
Subroutine
_isImportedSub: not called CC=8 SCAR=36.9
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||
| 779 | 0 | $subName = $self->_scrubParens($subName); | |||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||
| 781 | 0 | foreach my $use ( $self->getImportedModules ) { | |||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||
| 783 | 0 | my @exports = $self->_getModuleExports($use); | |||||||||||||||||||||||||||||||||||||
| 784 | 0 | my %map = $self->List->listToMap(@exports); | |||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||
| 786 | 0 | ▶ | if ( $map{$subName} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 787 | 0 | return $use; | |||||||||||||||||||||||||||||||||||||
| 788 | } | ||||||||||||||||||||||||||||||||||||||
| 789 | } | ||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||
| 791 | 0 | return; | |||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||
| 794 | 1 | ▶ | method _buildInheritedMethodsAndAttributes { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
_buildInheritedMethodsAndAttributes: not called CC=10 SCAR=44.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||
| 796 | 0 | my $mo = $self->_moduleOverview; | |||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||
| 798 | 0 | my @methods; | |||||||||||||||||||||||||||||||||||||
| 799 | 0 | ▶ | push @methods, @{ $mo->{methods} } if $mo->{methods}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | push @methods, @{ $mo->{methods_imported} } if $mo->{methods_imported}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||
| 802 | 0 | my @sorted = $self->List->nsort(@methods); | |||||||||||||||||||||||||||||||||||||
| 803 | 0 | my @parsed = $self->_parseMethods( \@sorted ); | |||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my @inherited; | |||||||||||||||||||||||||||||||||||||
| 806 | 0 | foreach my $aref (@parsed) { | |||||||||||||||||||||||||||||||||||||
| 807 | 0 | my ( $name, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 808 | 0 | ▶ | if ($from) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 809 | 0 | push @inherited, [@$aref]; | |||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||
| 811 | else { | ||||||||||||||||||||||||||||||||||||||
| 812 | 0 | my $module = $self->_isImportedSub($name); | |||||||||||||||||||||||||||||||||||||
| 813 | 0 | ▶ | if ($module) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 814 | 0 | push @inherited, [ $name, $module ]; | |||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||||||||||||
| 817 | } | ||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||
| 819 | 0 | ▶ | if ( $self->hideModules ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||
| 821 | 0 | my %map = $self->List->listToMap( @{ $self->hideModules } ); | |||||||||||||||||||||||||||||||||||||
| 822 | |||||||||||||||||||||||||||||||||||||||
| 823 | 0 | my @pruned; | |||||||||||||||||||||||||||||||||||||
| 824 | 0 | foreach my $aref (@inherited) { | |||||||||||||||||||||||||||||||||||||
| 825 | 0 | my ( $name, $from ) = @$aref; | |||||||||||||||||||||||||||||||||||||
| 826 | 0 | ▶ | if ( !$map{$from} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 827 | 0 | push @pruned, [@$aref]; | |||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||
| 829 | } | ||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||
| 831 | 0 | @inherited = @pruned; | |||||||||||||||||||||||||||||||||||||
| 832 | } | ||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||
| 834 | 0 | return \@inherited; | |||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||
| 837 | 1 | 1; | |||||||||||||||||||||||||||||||||||||