File Coverage

blib/lib/Test/CallFlow/ArgCheck/Regexp.pm
Criterion Covered Total %
statement 8 8 100.0
branch 1 2 50.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 13 14 92.8


line stmt bran cond sub pod time code
1             package Test::CallFlow::ArgCheck::Regexp;
2 2     2   12 use strict;
  2         4  
  2         107  
3 2     2   12 use base 'Test::CallFlow::ArgCheck';
  2         4  
  2         333  
4              
5             =head1 Test::CallFlow::ArgCheck::Regexp
6              
7             die "Unfit" unless defined
8             my $fit =
9             Test::CallFlow::ArgCheck::Regexp->new( qr/^..$/ )->check( 0, [ 'foo' ] );
10              
11             Checks arguments against a regular expression. See base class C.
12              
13             =head1 FUNCTIONS
14              
15             =head2 check
16              
17             $checker->check( 1, [ 'foo', 'bar' ] ) ? 'ok' : die;
18              
19             Checks the argument at given position in referred array against a regular expression.
20              
21             =cut
22              
23             sub check {
24 7     7 1 11 my ( $self, $at, $args ) = @_;
25 7 50       63 defined $args->[$at]
26             and $args->[$at] =~ $self->{test};
27             }
28              
29             1;
30