« blib/lib/PLS/Server/Method/Workspace.pm
↑ Summary
blib/lib/PLS/Server/Request/Workspace/Configuration.pm »
| 1 | package PLS::Parser::Element::Subroutine; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 15 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 15 | ▶ | use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | |||||||||||||||
| 6 | 15 | ▶ | use parent 'PLS::Parser::Element'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 15 | ▶ | use List::Util qw(any); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | =head1 NAME | ||||||||||||||
| 11 | |||||||||||||||
| 12 | PLS::Parser::Element::Subroutine | ||||||||||||||
| 13 | |||||||||||||||
| 14 | =head1 DESCRIPTION | ||||||||||||||
| 15 | |||||||||||||||
| 16 | Subclass of L<PLS::Parser::Element> representing a subroutine declaration. | ||||||||||||||
| 17 | |||||||||||||||
| 18 | =cut | ||||||||||||||
| 19 | |||||||||||||||
| 20 | sub location_info | ||||||||||||||
| 21 | 0 | ▶ | { | ||||||||||||
|
Subroutine
location_info: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||
| 22 | 0 | my ($self) = @_; | |||||||||||||
| 23 | |||||||||||||||
| 24 | 0 | my $info = $self->SUPER::location_info; | |||||||||||||
| 25 | |||||||||||||||
| 26 | 0 | my $signature = $self->signature; | |||||||||||||
| 27 | 0 | ▶ | $info->{signature} = $signature if (ref $signature eq 'HASH'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 28 | |||||||||||||||
| 29 | 0 | return $info; | |||||||||||||
| 30 | } ## end sub location_info | ||||||||||||||
| 31 | |||||||||||||||
| 32 | sub signature | ||||||||||||||
| 33 | 0 | ▶ | { | ||||||||||||
|
Subroutine
signature: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||
| 34 | 0 | my ($self) = @_; | |||||||||||||
| 35 | |||||||||||||||
| 36 | 0 | my $block = $self->element->block; | |||||||||||||
| 37 | 0 | ▶ | return unless (ref $block eq 'PPI::Structure::Block'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 38 | |||||||||||||||
| 39 | # only looking at first variable statement, for performance sake. | ||||||||||||||
| 40 | 0 | foreach my $child ($block->children) | |||||||||||||
| 41 | { | ||||||||||||||
| 42 | 0 | ▶ | next unless $child->isa('PPI::Statement::Variable'); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 43 | 0 | ▶ | return unless $child->type eq 'my'; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 44 | return | ||||||||||||||
| 45 | 0 | ▶ | unless any { $_->isa('PPI::Token::Magic') and $_->content eq '@_' } $child->children; ## no critic (RequireInterpolationOfMetachars) | ||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 2 branches
| |||||||||||||||
| 46 | 0 | ▶ | return unless (scalar $child->variables); | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 47 | 0 | return {label => $child->content, parameters => [map { {label => $_} } $child->variables]}; | |||||||||||||
| 48 | } ## end foreach my $child ($block->...) | ||||||||||||||
| 49 | |||||||||||||||
| 50 | 0 | return; | |||||||||||||
| 51 | } ## end sub signature | ||||||||||||||
| 52 | |||||||||||||||
| 53 | sub name | ||||||||||||||
| 54 | 0 | ▶ | { | ||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 55 | 0 | my ($self) = @_; | |||||||||||||
| 56 | |||||||||||||||
| 57 | 0 | return $self->element->name; | |||||||||||||
| 58 | } | ||||||||||||||
| 59 | |||||||||||||||
| 60 | sub length | ||||||||||||||
| 61 | 0 | ▶ | { | ||||||||||||
|
Subroutine
length: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||
| 62 | 0 | my ($self) = @_; | |||||||||||||
| 63 | |||||||||||||||
| 64 | 0 | return $self->SUPER::length() + (length 'sub '); | |||||||||||||
| 65 | } | ||||||||||||||
| 66 | |||||||||||||||
| 67 | 15 | 1; | |||||||||||||