| 1 | package Router::Simple::SubMapper; | ||||||||||||
| 2 | 13 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 13 | ▶ | use Scalar::Util qw/weaken/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 13 | ▶ | use Router::Simple (); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 4 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||
| 8 | 4 | my ($class, %args) = @_; | |||||||||||
| 9 | 4 | my $self = bless { %args }, $class; | |||||||||||
| 10 | 4 | weaken($self->{parent}); | |||||||||||
| 11 | 4 | $self; | |||||||||||
| 12 | } | ||||||||||||
| 13 | |||||||||||||
| 14 | 8 | ▶ | sub connect { | ||||||||||
|
Subroutine
connect: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||
| 15 | 8 | my ($self, $pattern, $dest, $opt) = @_; | |||||||||||
| 16 | 8 | ▶ | $pattern = $self->{pattern}.$pattern if $self->{pattern}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 8 | ▶ | $dest ||= +{}; | ||||||||||
|
Condition50%1/2
$dest ||= {}
MC/DC0%0/1
$dest ||= {}
$dest
Truth table50%1/2
A
A= $dest
| |||||||||||||
| 18 | 8 | ▶ | $opt ||= +{}; | ||||||||||
|
Condition100%2/2
$opt ||= {}
MC/DC100%1/1
$opt ||= {}
$opt
Truth table100%2/2
A
A= $opt
| |||||||||||||
| 19 | |||||||||||||
| 20 | $self->{parent}->connect( | ||||||||||||
| 21 | $pattern, | ||||||||||||
| 22 | 8 | { %{ $self->{dest} }, %$dest }, | |||||||||||
| 23 | 8 | { %{ $self->{opt} }, %$opt } | |||||||||||
| 24 | ); | ||||||||||||
| 25 | |||||||||||||
| 26 | 8 | $self; # chained method | |||||||||||
| 27 | } | ||||||||||||
| 28 | |||||||||||||
| 29 | # Allow nested submapper calls | ||||||||||||
| 30 | 1 | ▶ | sub submapper { | ||||||||||
|
Subroutine
submapper: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 31 | 1 | my $self = shift; | |||||||||||
| 32 | |||||||||||||
| 33 | 1 | Router::Simple::submapper($self, @_); | |||||||||||
| 34 | } | ||||||||||||
| 35 | |||||||||||||
| 36 | |||||||||||||
| 37 | 13 | 1; | |||||||||||
| 38 | __END__ | ||||||||||||