| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Pixie::FinalMethods - 'fixed' methods that Pixie uses |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use Pixie::FinalMethods; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$hash{$some_object->PIXIE::address} = ...; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Pixie has some helper methods that it makes sense to use in an object |
|
14
|
|
|
|
|
|
|
oriented fashion any object. But these same methods should I be |
|
15
|
|
|
|
|
|
|
overridden. One option is just to define these methods in UNIVERSAL |
|
16
|
|
|
|
|
|
|
and to rely on people to be polite. But we are a little more |
|
17
|
|
|
|
|
|
|
defensive. We push our final methods into the PIXIE namespace. Perl |
|
18
|
|
|
|
|
|
|
allows you to make a method call to a fully specified method name, so |
|
19
|
|
|
|
|
|
|
we do that. And it works. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
This means that any methods we shove into UNIVERSAL are there to be |
|
22
|
|
|
|
|
|
|
overridden L, though some are more overrideable |
|
23
|
|
|
|
|
|
|
than others. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package Pixie::FinalMethods; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$Pixie::FinalMethods::Loaded++; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package PIXIE; |
|
32
|
|
|
|
|
|
|
|
|
33
|
30
|
|
|
30
|
|
48898
|
use Pixie::Info; |
|
|
30
|
|
|
|
|
80
|
|
|
|
30
|
|
|
|
|
1687
|
|
|
34
|
30
|
|
|
30
|
|
17148
|
use Pixie::ObjectInfo; |
|
|
30
|
|
|
|
|
90
|
|
|
|
30
|
|
|
|
|
11122
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
our $VERSION = '2.08_02'; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
## TODO: there must be a better way to do this... |
|
39
|
|
|
|
|
|
|
## use Scalar::Util's refaddr() ? |
|
40
|
|
|
|
|
|
|
sub address { |
|
41
|
3
|
|
|
3
|
|
12
|
my $self = shift; |
|
42
|
3
|
|
|
|
|
7
|
my $orig_class = ref($self); |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
## rebless in-case orig_class uses overload |
|
45
|
3
|
|
|
|
|
12
|
bless $self, 'Class::Whitehole'; |
|
46
|
3
|
|
|
|
|
7
|
my $addr = 0 + $self; |
|
47
|
3
|
|
|
|
|
5
|
bless $self, $orig_class; |
|
48
|
|
|
|
|
|
|
|
|
49
|
3
|
|
|
|
|
24
|
return $addr; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub set_oid { |
|
53
|
4
|
|
|
4
|
|
662
|
my $self = shift; |
|
54
|
4
|
|
|
|
|
21
|
$self->PIXIE::get_info->set__oid(shift); |
|
55
|
4
|
|
|
|
|
9
|
return $self; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub oid { |
|
59
|
44
|
|
|
44
|
|
6262
|
my $self = shift; |
|
60
|
44
|
|
|
|
|
160
|
$self->PIXIE::get_info->_oid; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub managing_pixie { |
|
64
|
2
|
|
|
2
|
|
5
|
get_info($_[0])->pixie; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub get_info { |
|
69
|
99
|
|
|
99
|
|
4496
|
my $self = shift; |
|
70
|
99
|
100
|
|
|
|
699
|
die "Can't get info about a ", ref($self) if $self->isa('Pixie::ObjectInfo'); |
|
71
|
97
|
|
|
|
|
125
|
my $info; |
|
72
|
97
|
100
|
|
|
|
386
|
unless ( $info = Pixie::Info::px_get_info($self)) { |
|
73
|
39
|
|
|
|
|
233
|
$info = Pixie::ObjectInfo->make_from($self); |
|
74
|
39
|
|
|
|
|
170
|
$self->PIXIE::set_info($info); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
97
|
|
|
|
|
391
|
return $info; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub set_info { |
|
80
|
49
|
|
|
49
|
|
725
|
my $self = shift; |
|
81
|
49
|
|
|
|
|
82
|
my $info = shift; |
|
82
|
|
|
|
|
|
|
|
|
83
|
49
|
100
|
|
|
|
353
|
die "Can't set info about a ", ref($self) if $self->isa('Pixie::ObjectInfo'); |
|
84
|
48
|
100
|
|
|
|
422
|
die "Info must be a Pixie::ObjectInfo" unless defined($info) ? $info->isa('Pixie::ObjectInfo') : 1; |
|
|
|
100
|
|
|
|
|
|
|
85
|
47
|
|
|
|
|
182
|
Pixie::Info::px_set_info($self, $info); |
|
86
|
47
|
|
|
|
|
169
|
return $self; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |