File Coverage

blib/lib/Context/Handle/RV/Bool.pm
Criterion Covered Total %
statement 9 13 69.2
branch 0 2 0.0
condition n/a
subroutine 3 5 60.0
pod 0 1 0.0
total 12 21 57.1


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package Context::Handle::RV::Bool;
4 2     2   9 use base qw/Context::Handle::RV::Scalar/;
  2         4  
  2         157  
5              
6 2     2   10 use strict;
  2         3  
  2         49  
7 2     2   9 use warnings;
  2         3  
  2         244  
8              
9             sub new {
10 0     0 0   my $pkg = shift;
11 0           my $code = shift;
12              
13             # although this does enforce boolean context,
14             # it doesn't return the actual value.
15             # this probably doesn't matter, since you can't
16             # get anything back from a boolean context'd expr.
17 0 0   0     $pkg->SUPER::new( sub { $code->() ? 1 : "" } )
18 0           }
19              
20             __PACKAGE__;
21              
22             __END__