line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2484
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
2
|
|
|
|
|
|
|
package Class::Accessor::Chained::Fast; |
3
|
2
|
|
|
2
|
|
10
|
use base 'Class::Accessor::Fast'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1908
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub make_accessor { |
6
|
3
|
|
|
3
|
1
|
112
|
my($class, $field) = @_; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
return sub { |
9
|
5
|
|
|
5
|
|
454
|
my $self = shift; |
10
|
5
|
100
|
|
|
|
13
|
if(@_) { |
11
|
4
|
50
|
|
|
|
19
|
$self->{$field} = (@_ == 1 ? $_[0] : [@_]); |
12
|
4
|
|
|
|
|
12
|
return $self; |
13
|
|
|
|
|
|
|
} |
14
|
1
|
|
|
|
|
6
|
return $self->{$field}; |
15
|
3
|
|
|
|
|
15
|
}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub make_wo_accessor { |
19
|
0
|
|
|
0
|
1
|
|
my($class, $field) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return sub { |
22
|
0
|
|
|
0
|
|
|
my($self) = shift; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
unless (@_) { |
25
|
0
|
|
|
|
|
|
my $caller = caller; |
26
|
0
|
|
|
|
|
|
require Carp; |
27
|
0
|
|
|
|
|
|
Carp::croak("'$caller' cannot access the value of '$field' on ". |
28
|
|
|
|
|
|
|
"objects of class '$class'"); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
0
|
0
|
|
|
|
|
$self->{$field} = (@_ == 1 ? $_[0] : [@_]); |
32
|
0
|
|
|
|
|
|
return $self; |
33
|
|
|
|
|
|
|
} |
34
|
0
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Class::Accessor::Chained::Fast - Faster, but less expandable, chained accessors |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
package Foo; |
46
|
|
|
|
|
|
|
use base qw(Class::Accessor::Chained::Fast); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# The rest as Class::Accessor::Chained except no set() or get(). |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 DESCRIPTION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
By analogue to Class::Accessor and Class::Accessor::Fast this module |
53
|
|
|
|
|
|
|
provides a faster less-flexible chained accessor maker. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Richard Clamp |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 COPYRIGHT |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Copyright (C) 2003 Richard Clamp. All Rights Reserved. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or modify it |
64
|
|
|
|
|
|
|
under the same terms as Perl itself. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L, L |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |