File Coverage

blib/lib/EO/NotAttributes.pm
Criterion Covered Total %
statement 18 28 64.2
branch 0 2 0.0
condition n/a
subroutine 6 9 66.6
pod n/a
total 24 39 61.5


line stmt bran cond sub pod time code
1             package EO::NotAttributes;
2              
3             # this isn't an EO object, but it needs the EO::Error::* stuff
4             # declared in there.
5 18     18   118 use EO;
  18         39  
  18         483  
6              
7 18     18   92 use strict;
  18         30  
  18         608  
8 18     18   85 use warnings;
  18         56  
  18         607  
9              
10 18     18   96 use Scalar::Util qw(blessed);
  18         31  
  18         3250  
11              
12             our $VERSION = 0.96;
13              
14             =begin notused
15              
16             At some point we should implement Private. We haven't yet.
17              
18             sub UNIVERSAL::Private : ATTR(CODE) {
19             my ($package, $symbol, $referent, $attr, $data) = @_;
20             no strict 'refs';
21             no warnings 'redefine';
22             my $thing = *{$symbol};
23             my $meth = substr($thing, rindex($thing,':')+1);
24             *{$symbol} = sub {
25             my $self = shift;
26             my $class = ref($self);
27             my ($callpkg, $callfile, $callline) = caller();
28             if ($package ne $callpkg) {
29             my $text = "Can't private method \"$meth\" from package $package";
30             throw EO::Error::Method::Private
31             text => $text,
32             file => $callfile;
33             }
34             $referent->( $self, @_ );
35             };
36             }
37              
38             =end notused
39              
40             =cut
41              
42             sub sub::Abstract($) {
43 0     0     my $meth = shift;
44 0           my ($package, $filename, $line) = caller;
45 18     18   122 no strict 'refs';
  18         40  
  18         720  
46 18     18   89 no warnings 'redefine';
  18         42  
  18         3884  
47 0           *{"${package}::${meth}"} = sub {
48 0     0     my $self = shift;
49 0 0         my $class = blessed($self) ? ref($self) : $self;
50 0           my ($package, $filename, $line) = caller();
51 0           my $text = "Can't call abstract method \"$meth\" on object of type \"$class\"";
52 0           throw EO::Error::Method::Abstract
53             text => $text,
54             file => $filename;
55 0           };
56             }
57              
58 0     0     sub sub::abstract($) { sub::Abstract(@_) }
59              
60             1;
61              
62             __END__