| 1 | package Myriad::Role; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '1.001'; # VERSION | |||||||||||||||||||||||||||
| 7 | 2 | our $AUTHORITY = 'cpan:DERIV'; # AUTHORITY | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | =encoding utf8 | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 NAME | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Myriad::Role - common pragmata for L<Myriad> rĂ´les | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | package Example::Role; | ||||||||||||||||||||||||||||
| 20 | use Myriad::Role; | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | requires startup; | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 1; | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =cut | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 2 | require Myriad::Class; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=5 SCAR=19.0
| |||||||||||||||||||||||||||||
| 31 | 1 | my $called_on = shift; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Unused, but we'll support it for now. | ||||||||||||||||||||||||||||
| 34 | 1 | my $version = 1; | |||||||||||||||||||||||||||
| 35 | 1 | ▶ | if(@_ and $_[0] =~ /^:v([0-9]+)/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@_ and $_[0] =~ /^:v([0-9]+)/
MC/DC0%0/2
@_ and $_[0] =~ /^:v([0-9]+)/
@_
$_[0] =~ /^:v([0-9]+)/
Truth table33%1/3
A and B
A= @_B= $_[0] =~ /^:v([0-9]+)/
| |||||||||||||||||||||||||||||
| 36 | 0 | $version = $1; | |||||||||||||||||||||||||||
| 37 | 0 | shift; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 1 | my %args = ( | |||||||||||||||||||||||||||
| 40 | version => $version, | ||||||||||||||||||||||||||||
| 41 | @_ | ||||||||||||||||||||||||||||
| 42 | ); | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | my $class = __PACKAGE__; | |||||||||||||||||||||||||||
| 45 | 1 | ▶ | my $pkg = delete($args{target}) // caller(0); | ||||||||||||||||||||||||||
|
Condition33%1/3
delete $args{"target"} // caller 0
MC/DC0%0/2
delete $args{"target"} // caller 0
delete $args{"target"}
caller 0
Truth table33%1/3
A // B
A= delete $args{"target"}B= caller 0
| |||||||||||||||||||||||||||||
| 46 | 1 | $args{type} = 'role'; | |||||||||||||||||||||||||||
| 47 | 1 | ▶ | $args{target} //= $pkg; | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{"target"} //= $pkg
MC/DC0%0/2
$args{"target"} //= $pkg
$args{"target"}
$pkg
Truth table33%1/3
A //= B
A= $args{"target"}B= $pkg
| |||||||||||||||||||||||||||||
| 48 | 1 | return Myriad::Class->import(%args); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | 1; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||