| 1 | package Petal::Utils::Like; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use warnings::register; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 4 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 4 | ▶ | use base qw( Petal::Utils::Base ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 4 | ▶ | use constant name => 'like'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | 4 | ▶ | use constant aliases => qw(); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | |||||||||||||
| 13 | 4 | our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1]; | |||||||||||
| 14 | 4 | our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2]; | |||||||||||
| 15 | |||||||||||||
| 16 | 1 | ▶ | sub process { | ||||||||||
|
Subroutine
process: called CC=5 SCAR=16.8
Pod
undocumented
| |||||||||||||
| 17 | 1 | my $class = shift; | |||||||||||
| 18 | 1 | my $hash = shift; | |||||||||||
| 19 | 1 | ▶ | my $args = shift || confess( "'like' expects a variable and a regex (got nothing)!" ); | ||||||||||
|
Condition50%1/2
shift() || confess(q['like' expects a variable and a regex (got nothing)!])
MC/DC0%0/1
shift() || confess(q['like' expects a variable and a regex (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 20 | |||||||||||||
| 21 | 1 | my @args = $class->split_first_arg( $args ); | |||||||||||
| 22 | 1 | ▶ | $args = $args[0] || confess( "1st arg to 'like' should be a variable (got nothing)!" ); | ||||||||||
|
Condition50%1/2
$args[0] || confess(q[1st arg to 'like' should be a variable (got nothing)!])
MC/DC0%0/1
$args[0] || confess(q[1st arg to 'like' should be a variable (got nothing)!])
$args[0]
Truth table50%1/2
A
A= $args[0]
| |||||||||||||
| 23 | 1 | ▶ | my $re = $args[1] || confess( "2nd arg to 'like' should be a regex (got nothing)!" ); | ||||||||||
|
Condition50%1/2
$args[1] || confess(q[2nd arg to 'like' should be a regex (got nothing)!])
MC/DC0%0/1
$args[1] || confess(q[2nd arg to 'like' should be a regex (got nothing)!])
$args[1]
Truth table50%1/2
A
A= $args[1]
| |||||||||||||
| 24 | |||||||||||||
| 25 | 1 | my $result = $hash->fetch( $args ); | |||||||||||
| 26 | |||||||||||||
| 27 | 1 | ▶ | return $result =~ /$re/ ? 1 : 0; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | } | ||||||||||||
| 29 | |||||||||||||
| 30 | 4 | 1; | |||||||||||