| 1 | package Parse::Method::Signatures::Param::Named; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use MooseX::Types::Moose qw/Str/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use namespace::clean -except => 'meta'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | has label => ( | |||||||||||||||||||||||||||
| 9 | is => 'ro', | ||||||||||||||||||||||||||||
| 10 | isa => Str, | ||||||||||||||||||||||||||||
| 11 | lazy_build => 1, | ||||||||||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub _label_from_variable_name { | ||||||||||||||||||||||||||||
| 15 | 72 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_label_from_variable_name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | # strip sigil | ||||||||||||||||||||||||||||
| 17 | 72 | return substr($self->variable_name, 1); | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | sub _build_label { | ||||||||||||||||||||||||||||
| 21 | 35 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_build_label: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 35 | return $self->_label_from_variable_name; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | sub _stringify_required { | ||||||||||||||||||||||||||||
| 26 | 42 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_stringify_required: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 27 | 42 | ▶ | return $self->required ? q{!} : q{}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | around _stringify_variable_name => sub { | ||||||||||||||||||||||||||||
| 31 | 42 | ▶ | my $orig = shift; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 32 | 42 | my ($self) = @_; | |||||||||||||||||||||||||||
| 33 | 42 | my $ret = q{:}; | |||||||||||||||||||||||||||
| 34 | 42 | my ($before, $after) = (q{}) x 2; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 42 | ▶ | my $implicit_label = $self->_label_from_variable_name if $self->can('variable_name'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 42 | ▶ | if (!$implicit_label || $self->label ne $implicit_label) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $implicit_label or $self->label ne $implicit_label
MC/DC100%2/2
not $implicit_label or $self->label ne $implicit_label
not $implicit_label
$self->label ne $implicit_label
Truth table100%3/3
not(A) or B
A= not $implicit_labelB= $self->label ne $implicit_label
| |||||||||||||||||||||||||||||
| 39 | 7 | $before = $self->label . q{(}; | |||||||||||||||||||||||||||
| 40 | 7 | $after = q{)}; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 42 | $ret .= $before . $orig->(@_) . $after; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 42 | return $ret; | |||||||||||||||||||||||||||
| 46 | 3 | }; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | 1; | |||||||||||||||||||||||||||