| 1 | package Perl::PrereqScanner::Scanner::Catalyst; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Plugin for Perl::PrereqScanner looking for Catalyst plugin/action modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | our $VERSION = '0.003'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | with 'Perl::PrereqScanner::Scanner'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use String::RewritePrefix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # see Catalyst::Util::resolve_namespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | sub _full_plugin_name { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_full_plugin_name: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | my ( $self, $catalyst_app_class, @plugin_classes ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 7 | ▶ | my $appnamespace = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | $catalyst_app_class ? "${catalyst_app_class}::Plugin" : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 7 | my $namespace = 'Catalyst::Plugin'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | ▶ | return String::RewritePrefix->rewrite( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | q[] => qq[${namespace}::], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | q[+] => q[], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | defined $appnamespace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ? ( q[~] => qq[${appnamespace}::] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | : () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | @plugin_classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | ▶ | sub scan_for_prereqs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scan_for_prereqs: called CC=29 SCAR=34.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | my ( $self, $ppi_doc, $req ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # we store the Catalyst app namespace only if it's file scoped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | my $catalyst_app_class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | ▶ | my $packages = $ppi_doc->find('PPI::Statement::Package') || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ppi_doc->find('PPI::Statement::Package') || []
MC/DC0%0/1
$ppi_doc->find('PPI::Statement::Package') || []
$ppi_doc->find('PPI::Statement::Package')
Truth table50%1/2
A
A= $ppi_doc->find('PPI::Statement::Package')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | ▶ | if ( @$packages == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | $catalyst_app_class = $packages->[0]->namespace; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # use Catalyst ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 2 | ▶ | my $includes = $ppi_doc->find('Statement::Include') || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ppi_doc->find('Statement::Include') || []
MC/DC0%0/1
$ppi_doc->find('Statement::Include') || []
$ppi_doc->find('Statement::Include')
Truth table50%1/2
A
A= $ppi_doc->find('Statement::Include')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 2 | for my $node (@$includes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # inheritance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 6 | ▶ | if ( $node->module eq 'Catalyst' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my @meat = grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | $_->isa('PPI::Token::QuoteLike::Words') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$_->isa('PPI::Token::QuoteLike::Words') || $_->isa('PPI::Token::Quote')
MC/DC0%0/2
$_->isa('PPI::Token::QuoteLike::Words') || $_->isa('PPI::Token::Quote')
$_->isa('PPI::Token::QuoteLike::Words')
$_->isa('PPI::Token::Quote')
Truth table33%1/3
A || B
A= $_->isa('PPI::Token::QuoteLike::Words')B= $_->isa('PPI::Token::Quote')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | || $_->isa('PPI::Token::Quote') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } $node->arguments; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | my @args = map { $self->_q_contents($_) } @meat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | my $arg = shift @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | ▶ | if ( $arg !~ /^\-/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | my $module = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | $self->_full_plugin_name( $catalyst_app_class, $arg ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 3 | $req->add_minimum( $module => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # It's also possible to specify plugins via Catalyat::setup(_plugins)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # To cover this case, we would firstly make sure the package extends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # Catalyst, and we look for calls like __PACKAGE__->setup(_plugins)? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # for "extends 'Catalyst';" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | my $inherits_catalyst = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # from Perl::PrereqScanner::Moose | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 2 | my @chunks = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # PPI::Statement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # PPI::Token::Word | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # PPI::Structure::List | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # PPI::Statement::Expression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | # PPI::Token::Quote::Single | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | # PPI::Token::Structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | map { [ $_->schildren ] } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 24 | grep { $_->child(0)->literal =~ m{\Aextends\z} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 36 | grep { $_->child(0)->isa('PPI::Token::Word') } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | ▶ | @{ $ppi_doc->find('PPI::Statement') || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ppi_doc->find('PPI::Statement') || []
MC/DC0%0/1
$ppi_doc->find('PPI::Statement') || []
$ppi_doc->find('PPI::Statement')
Truth table50%1/2
A
A= $ppi_doc->find('PPI::Statement')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | foreach my $hunk (@chunks) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | my @classes = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 2 | grep { Params::Util::_CLASS($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2 | map { $self->_q_contents($_) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 2 | ▶ | $_->isa('PPI::Token::Quote') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_->isa('PPI::Token::Quote') || $_->isa('PPI::Token::QuoteLike::Words')
MC/DC50%1/2
$_->isa('PPI::Token::Quote') || $_->isa('PPI::Token::QuoteLike::Words')
$_->isa('PPI::Token::Quote')
$_->isa('PPI::Token::QuoteLike::Words')
Truth table66%2/3
A || B
A= $_->isa('PPI::Token::Quote')B= $_->isa('PPI::Token::QuoteLike::Words')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | || $_->isa('PPI::Token::QuoteLike::Words') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } @$hunk; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2 | ▶ | if ( grep { $_ eq 'Catalyst' } @classes ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | $inherits_catalyst = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # for __PACKAGE__->setup or __PACKAGE__->setup_plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | ▶ | if ($inherits_catalyst) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | my @meat = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 6 | ▶ | $_->isa('PPI::Token::Quote') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_->isa('PPI::Token::Quote') || $_->isa('PPI::Token::QuoteLike::Words')
MC/DC100%2/2
$_->isa('PPI::Token::Quote') || $_->isa('PPI::Token::QuoteLike::Words')
$_->isa('PPI::Token::Quote')
$_->isa('PPI::Token::QuoteLike::Words')
Truth table100%3/3
A || B
A= $_->isa('PPI::Token::Quote')B= $_->isa('PPI::Token::QuoteLike::Words')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | || $_->isa('PPI::Token::QuoteLike::Words') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | map { $_->schildren } # $_ isa PPI::Statement::Expression | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | grep { $_->isa('PPI::Statement::Expression') } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | map { $_->schild(3)->schildren } # $_ isa PPI::Structure::List | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # make sure it's calling Catalyst::setup or setup_plugins | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 3 | ▶ | $_->schild(0)->literal eq '__PACKAGE__' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
($_->schild(0)->literal eq '__PACKAGE__' || $_->schild(0)->literal eq "$catalyst_app_class") && $_->schild(2)->literal =~ /^(?:setup|setup_plugins)$/
$_->schild(0)->literal eq "__PACKAGE__" or $_->schild(0)->literal eq "$catalyst_app_class"
MC/DC33%1/3
($_->schild(0)->literal eq '__PACKAGE__' || $_->schild(0)->literal eq "$catalyst_app_class") && $_->schild(2)->literal =~ /^(?:setup|setup_plugins)$/
$_->schild(0)->literal eq "__PACKAGE__"
$_->schild(0)->literal eq "$catalyst_app_class"
$_->schild(2)->literal =~ /^(?:setup|setup_plugins)$/
Truth table40%2/5
A or B && C
A= $_->schild(0)->literal eq "__PACKAGE__"B= $_->schild(0)->literal eq "$catalyst_app_class"C= $_->schild(2)->literal =~ /^(?:setup|setup_plugins)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | or $_->schild(0)->literal eq "$catalyst_app_class" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | and $_->schild(2)->literal =~ /^(?:setup|setup_plugins)$/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | grep { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # make sure it's a method call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 7 | ▶ | $_->schild(0)->isa('PPI::Token::Word') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition75%9/12
$_->schild(0)->isa('PPI::Token::Word') && $_->schild(1)->isa('PPI::Token::Operator') && $_->schild(1)->content eq '->' && $_->schild(2)->isa('PPI::Token::Word') && $_->schild(3)->isa('PPI::Structure::List')
$_->schild(0)->isa("PPI::Token::Word") and $_->schild(1)->isa("PPI::Token::Operator") and $_->schild(1)->content eq "->" and $_->schild(2)->isa("PPI::Token::Word")
$_->schild(0)->isa("PPI::Token::Word") and $_->schild(1)->isa("PPI::Token::Operator") and $_->schild(1)->content eq "->"
$_->schild(0)->isa("PPI::Token::Word") and $_->schild(1)->isa("PPI::Token::Operator")
MC/DC40%2/5
$_->schild(0)->isa('PPI::Token::Word') && $_->schild(1)->isa('PPI::Token::Operator') && $_->schild(1)->content eq '->' && $_->schild(2)->isa('PPI::Token::Word') && $_->schild(3)->isa('PPI::Structure::List')
$_->schild(0)->isa("PPI::Token::Word")
$_->schild(1)->isa("PPI::Token::Operator")
$_->schild(1)->content eq "->"
$_->schild(2)->isa("PPI::Token::Word")
$_->schild(3)->isa('PPI::Structure::List')
Truth table50%3/6
A and B and C and D && E
A= $_->schild(0)->isa("PPI::Token::Word")B= $_->schild(1)->isa("PPI::Token::Operator")C= $_->schild(1)->content eq "->"D= $_->schild(2)->isa("PPI::Token::Word")E= $_->schild(3)->isa('PPI::Structure::List')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | and $_->schild(1)->isa('PPI::Token::Operator') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | and $_->schild(1)->content eq '->' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | and $_->schild(2)->isa('PPI::Token::Word') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | and $_->schild(3)->isa('PPI::Structure::List') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 14 | grep { $_->schildren > 3 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 1 | ▶ | @{ $ppi_doc->find('PPI::Statement') || [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ppi_doc->find('PPI::Statement') || []
MC/DC0%0/1
$ppi_doc->find('PPI::Statement') || []
$ppi_doc->find('PPI::Statement')
Truth table50%1/2
A
A= $ppi_doc->find('PPI::Statement')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 1 | my @args = map { $self->_q_contents($_) } @meat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | ▶ | while (@args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 4 | my $arg = shift @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 4 | ▶ | if ( $arg !~ /^\-/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 4 | my $module = | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | $self->_full_plugin_name( $catalyst_app_class, $arg ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 4 | $req->add_minimum( $module => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | # for ActionClass attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | ▶ | my $subs = $ppi_doc->find('PPI::Statement::Sub') || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$ppi_doc->find('PPI::Statement::Sub') || []
MC/DC100%1/1
$ppi_doc->find('PPI::Statement::Sub') || []
$ppi_doc->find('PPI::Statement::Sub')
Truth table100%2/2
A
A= $ppi_doc->find('PPI::Statement::Sub')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | for my $sub_node (@$subs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | my @attributes = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | grep { $_->isa('PPI::Token::Attribute') } $sub_node->schildren(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 4 | for my $attr_node (@attributes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 4 | my $attr_content = $attr_node->content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 4 | $attr_content =~ s/\s+//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 4 | ▶ | if ( $attr_content =~ /ActionClass\(([^\)]+)\)/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | my $ppi_action_class = PPI::Document->new( \$1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | my $quotes = $ppi_action_class->find( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | my ( $doc, $node ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2 | ▶ | $node->isa('PPI::Token::QuoteLike::Words') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | || $node->isa('PPI::Token::Quote'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | my @action_class_names = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | map { $self->_q_contents($_) } @$quotes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 1 | for (@action_class_names) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 1 | my $module = "Catalyst::Action::$_"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1 | $req->add_minimum( $module => 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||