| 1 | 11 | ▶ | use 5.10.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Map::Metro::Shim; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Easily load a map file | ||||||||||||||||||||||||||||
| 8 | 11 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||||||||||
| 9 | 11 | our $VERSION = '0.2405'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 11 | ▶ | use Map::Metro::Elk; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 11 | ▶ | use Types::Standard qw/ArrayRef/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 11 | ▶ | use Types::Path::Tiny qw/AbsFile/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 11 | ▶ | use Map::Metro::Graph; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 11 | has filepath => ( | |||||||||||||||||||||||||||
| 17 | is => 'rw', | ||||||||||||||||||||||||||||
| 18 | isa => AbsFile, | ||||||||||||||||||||||||||||
| 19 | required => 1, | ||||||||||||||||||||||||||||
| 20 | coerce => 1, | ||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||
| 22 | has hooks => ( | ||||||||||||||||||||||||||||
| 23 | is => 'ro', | ||||||||||||||||||||||||||||
| 24 | isa => ArrayRef, | ||||||||||||||||||||||||||||
| 25 | traits => ['Array'], | ||||||||||||||||||||||||||||
| 26 | 4 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 11 | handles => { | |||||||||||||||||||||||||||
| 28 | all_hooks => 'elements', | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 4 | ▶ | around BUILDARGS => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=19.2
| |||||||||||||||||||||||||||||
| 33 | 4 | my $orig = shift; | |||||||||||||||||||||||||||
| 34 | 4 | my $class = shift; | |||||||||||||||||||||||||||
| 35 | 4 | my @args = @_; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 4 | ▶ | return $class->$orig(@args) if scalar @args == 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | 4 | ▶ | return $class->$orig(filepath => shift @args) if scalar @args == 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | my %args; | |||||||||||||||||||||||||||
| 41 | 2 | ▶ | if(scalar @args % 2 != 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 2 | my $filepath = shift @args; | |||||||||||||||||||||||||||
| 43 | 2 | %args = @args; | |||||||||||||||||||||||||||
| 44 | 2 | $args{'filepath'} = $filepath; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | else { | ||||||||||||||||||||||||||||
| 47 | 0 | %args = @args; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 2 | ▶ | if(exists $args{'hooks'} && !ArrayRef->check($args{'hooks'})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $args{"hooks"} and not &ArrayRef()->check($args{"hooks"})
MC/DC0%0/2
exists $args{"hooks"} and not &ArrayRef()->check($args{"hooks"})
exists $args{"hooks"}
not &ArrayRef()->check($args{"hooks"})
Truth table33%1/3
A and not(B)
A= exists $args{"hooks"}B= not &ArrayRef()->check($args{"hooks"})
| |||||||||||||||||||||||||||||
| 50 | 0 | $args{'hooks'} = [$args{'hooks'}]; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 2 | return $class->$orig(%args); | |||||||||||||||||||||||||||
| 54 | 11 | }; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 4 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 58 | 4 | my %args = @_; | |||||||||||||||||||||||||||
| 59 | 4 | ▶ | my $override_line_change_weight = exists $args{'override_line_change_weight'} ? $args{'override_line_change_weight'} : 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 4 | ▶ | return Map::Metro::Graph->new(filepath => $self->filepath, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | wanted_hook_plugins => [$self->all_hooks], | ||||||||||||||||||||||||||||
| 63 | defined $override_line_change_weight ? (override_line_change_weight => $override_line_change_weight) : (), | ||||||||||||||||||||||||||||
| 64 | )->parse; | ||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 11 | 1; | |||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||||||||||