EO/NotAttributes.pm

filter: Statementstmt 80.0% 24 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod n/a totaltotal 75.6% 31 / 41 CC 2 SCAR 6.1
CC
2
Cov
75%
__ANON__
4.7
abstract
2.0
Abstract
1.1
CRAP 1.8
« EO/delegate.pm ↑ Summary EO/System.pm »
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 ▶use EO;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 18 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 18 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 1 ▶sub sub::Abstract($) {
Subroutine Abstract: called CC=1 SCAR=0.7
43 1 my $meth = shift;
44 1 my ($package, $filename, $line) = caller;
45 18 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
46 18 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
47 1 ▶ *{"${package}::${meth}"} = sub {
Subroutine __ANON__: not called CC=2 SCAR=15.4
48 0 my $self = shift;
49 0 ▶ my $class = blessed($self) ? ref($self) : $self;
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($self) ? : 0 0 0
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 1 };
56 }
57  
58 0 ▶sub sub::abstract($) { sub::Abstract(@_) }
Subroutine abstract: not called CC=1 SCAR=6.9
59  
60 18 1;
61  
62 __END__
« EO/delegate.pm ↑ Summary EO/System.pm »