File Coverage

blib/lib/immutable/tied.pm
Criterion Covered Total %
statement 16 18 88.8
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 22 26 84.6


line stmt bran cond sub pod time code
1 2     2   15 use strict; use warnings;
  2     2   4  
  2         57  
  2         10  
  2         3  
  2         72  
2             package immutable::tied;
3              
4 2     2   9 use Exporter 'import';
  2         4  
  2         52  
5 2     2   27 use Carp 'croak';
  2         6  
  2         495  
6              
7             our @EXPORT = qw(
8             err
9             );
10              
11             sub err {
12 5     5 0 63 (my $package = (caller(1))[3]) =~ s/(.*)::tied::.*/$1/;
13 5 50       20 if (@_) {
14 5         12 my ($action, $try) = @_;
15 5         790 croak <<"...";
16             Not valid to $action an $package object.
17             Try '$try' which returns a new $package.
18             ...
19              
20             } else {
21 0           (my $name = (caller(1))[3]) =~ s/.*:://;
22 0           croak <<"...";
23             Invalid usage of $package object caused a call to '$name'.
24             Try using the appropriate method call instead.
25             ...
26             }
27             }
28              
29             1;