« blib/lib/Perl/PrereqScanner/NotQuiteLite/Util/Prereqs.pm
↑ Summary
lib/Perl/PrereqScanner/NotQuiteLite/Util/Prereqs.pm »
| 1 | package Perl::PrereqScanner::NotQuiteLite::Parser::ClassAutouse; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 88 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 88 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 88 | ▶ | use Perl::PrereqScanner::NotQuiteLite::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | sub register { return { | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 87 | ▶ | use => { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 'Class::Autouse' => 'parse_class_autouse_args', | ||||||||||||||||||||||||||||||||||||||||||
| 10 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 11 | }} | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | sub parse_class_autouse_args { | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_class_autouse_args: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | if (is_version($tokens->[0])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $c->add($used_module => shift @$tokens); | |||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | while(my $token = shift @$tokens) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | my $module = $token; | |||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | ▶ | if (ref $module) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | $module = $module->[0]; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | if (is_module_name($module)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | $c->add_recommendation($module => 0); | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | $c->register_method_parser( | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 2 | 'autouse', | |||||||||||||||||||||||||||||||||||||||||
| 32 | [$class, 'parse_autouse_method_args', $used_module], | ||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | sub parse_autouse_method_args { | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_autouse_method_args: called CC=9 SCAR=26.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | # Check class | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | my ($klass, $arrow, $method, @args) = @$tokens; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | return unless $klass and ref $klass and $klass->[0] eq $used_module; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$klass and ref $klass and $klass->[0] eq $used_module
$klass and ref $klass
MC/DC0%0/3
$klass and ref $klass and $klass->[0] eq $used_module
$klass
ref $klass
$klass->[0] eq $used_module
Truth table25%1/4
A and B and C
A= $klassB= ref $klassC= $klass->[0] eq $used_module
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | return unless $method and ref $method and $method->[0] eq 'autouse'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$method and ref $method and $method->[0] eq "autouse"
$method and ref $method
MC/DC0%0/3
$method and ref $method and $method->[0] eq "autouse"
$method
ref $method
$method->[0] eq "autouse"
Truth table25%1/4
A and B and C
A= $methodB= ref $methodC= $method->[0] eq "autouse"
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | for my $arg (@args) { | |||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | ▶ | next if ref $arg; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | $c->add_recommendation($arg => 0); | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 88 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||||||||||||||||