line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::AccessorsOnly; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '1'; |
4
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
415
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
7
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
8
|
1
|
|
|
1
|
|
7
|
use Carp (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
9
|
1
|
|
|
1
|
|
388
|
use Tie::Hash; |
|
1
|
|
|
|
|
1007
|
|
|
1
|
|
|
|
|
246
|
|
10
|
|
|
|
|
|
|
our @ISA = 'Tie::StdHash'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %magic; # Global on the off chance somebody wants to fuck with it |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub TIEHASH { |
15
|
0
|
|
|
0
|
|
|
my $self = shift; |
16
|
0
|
|
|
|
|
|
my $store = $self->SUPER::TIEHASH(); |
17
|
0
|
0
|
|
|
|
|
if (ref $_[0]) { |
18
|
0
|
|
|
|
|
|
$magic{"$store"}{cb} = $_[0]; |
19
|
|
|
|
|
|
|
} else { |
20
|
0
|
|
0
|
|
|
|
my $complainer = $_[0] || 'carp'; |
21
|
|
|
|
|
|
|
Carp::croak "Invalid complainer $complainer" |
22
|
0
|
0
|
|
|
|
|
unless grep { $complainer eq $_ } |
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
qw(carp croak confess cluck die warn); |
24
|
0
|
0
|
|
|
|
|
$complainer = 'Carp::' . $complainer if $complainer =~ /^c/; # convenient |
25
|
|
|
|
|
|
|
# Eugh: |
26
|
0
|
|
|
|
|
|
$magic{"$store"}{cb} = eval qq{ |
27
|
|
|
|
|
|
|
sub { |
28
|
|
|
|
|
|
|
my (\$who, \$how, \$what) = \@_; |
29
|
|
|
|
|
|
|
$complainer ("DIRECT ACCESS from \$who: \$how " . \$what || 'NOKEY'); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
} |
33
|
0
|
|
|
|
|
|
$store; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub DESTROY { |
37
|
0
|
|
|
0
|
|
|
delete $magic{"$_[0]"}; |
38
|
|
|
|
|
|
|
# Tie::StdHash doesn't have a DESTROY method |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
|
|
sub UNTIE { Carp::croak "Attempt to UNTIE" } |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
for my $sub (qw( |
44
|
|
|
|
|
|
|
CLEAR |
45
|
|
|
|
|
|
|
DELETE |
46
|
|
|
|
|
|
|
EXISTS |
47
|
|
|
|
|
|
|
FETCH |
48
|
|
|
|
|
|
|
FIRSTKEY |
49
|
|
|
|
|
|
|
NEXTKEY |
50
|
|
|
|
|
|
|
SCALAR |
51
|
|
|
|
|
|
|
STORE |
52
|
|
|
|
|
|
|
)) { |
53
|
|
|
|
|
|
|
my $super = 'SUPER::' . $sub; |
54
|
1
|
|
|
1
|
|
7
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
145
|
|
55
|
|
|
|
|
|
|
*$sub = sub { |
56
|
0
|
|
|
0
|
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my @caller = caller(0); |
58
|
0
|
0
|
0
|
|
|
|
$magic{"$self"}{cb}->("$caller[0]:$caller[2]", $sub, $_[0]) |
|
|
|
0
|
|
|
|
|
59
|
|
|
|
|
|
|
unless (caller(2))[0] || '' eq 'Moose::Object' |
60
|
|
|
|
|
|
|
or $caller[0] =~ /^(?:Eval::Closure|Data::Dump)/; |
61
|
0
|
|
|
|
|
|
$self->$super(@_); |
62
|
|
|
|
|
|
|
}; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |