File Coverage

lib/XML/XMetaL/Utilities/Abstract.pm
Criterion Covered Total %
statement 16 17 94.1
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 21 24 87.5


line stmt bran cond sub pod time code
1             #! perl
2            
3             package XML::XMetaL::Utilities::Abstract;
4            
5 3     3   58348 use strict;
  3         5  
  3         100  
6 3     3   15 use warnings;
  3         6  
  3         70  
7 3     3   14 use Carp;
  3         12  
  3         910  
8            
9             require Exporter;
10            
11             our @ISA = qw(Exporter);
12             our @EXPORT = qw(Abstract);
13            
14             our @parameters = qw(package symbol referent attr data phase);
15            
16             sub abstract {
17 1     1 0 971 my ($self) = @_;
18 1         2 my $strCallerClass = ref($self);
19 1         5 my $strAbstractClass = (caller 0)[0];
20 1         5 my $strMethod = (caller 1)[3];
21 1         8 $strMethod =~ s/.*::(.*)/$1/;
22            
23 1 50       7 if ($strCallerClass eq $strAbstractClass) {
24 1         243 croak "$strAbstractClass is an abstract base class.".
25             " Attempt to call non-existent method $strMethod";
26             } else {
27 0           die "Class $strCallerClass inherited the abstract base class $strAbstractClass ".
28             "but did not redefine the $strMethod method. ".
29             "Attempt to call non-existent method $strAbstractClass::$strMethod";
30             }
31             }
32            
33             1;