File Coverage

blib/lib/Petal/Utils/And.pm
Criterion Covered Total %
statement 27 27 100.0
branch 1 2 50.0
condition 4 12 33.3
subroutine 7 7 100.0
pod 0 1 0.0
total 39 49 79.5


line stmt bran cond sub pod time code
1             package Petal::Utils::And;
2              
3 4     4   23 use strict;
  4         6  
  4         143  
4 4     4   24 use warnings::register;
  4         7  
  4         544  
5              
6 4     4   26 use Carp;
  4         6  
  4         335  
7              
8 4     4   21 use base qw( Petal::Utils::Base );
  4         9  
  4         1786  
9              
10 4     4   22 use constant name => 'and';
  4         8  
  4         247  
11 4     4   21 use constant aliases => qw();
  4         7  
  4         941  
12              
13             our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
14             our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2];
15              
16             sub process {
17 1     1 0 88 my $class = shift;
18 1         2 my $hash = shift;
19 1   33     5 my $args = shift || confess( "'and' expects 2 variables (got nothing)!" );
20              
21 1         9 my @args = $class->split_first_arg( $args );
22 1   33     4 my $arg1 = $args[0] || confess( "1st arg to 'and' should be a variable (got nothing)!" );
23 1   33     5 my $arg2 = $args[1] || confess( "2nd arg to 'and' should be a variable (got nothing)!" );
24              
25 1         6 my $h1 = $hash->fetch($arg1);
26 1         68 my $h2 = $hash->fetch($arg2);
27              
28 1 50 33     62 return ($h1 && $h2) ? 1 : 0;
29             }
30              
31             1;
32              
33             __END__