line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
accessors::chained - create method chaining accessors in caller's package. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Foo; |
8
|
|
|
|
|
|
|
use accessors::chained qw( foo bar baz ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $obj = bless {}, 'Foo'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# generates chaining accessors: |
13
|
|
|
|
|
|
|
$obj->foo( 'hello ' ) |
14
|
|
|
|
|
|
|
->bar( 'world' ) |
15
|
|
|
|
|
|
|
->baz( "!\n" ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
print $obj->foo, $obj->bar, $obj->baz; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
package accessors::chained; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
18806
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
24
|
1
|
|
|
1
|
|
6
|
use warnings::register; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
155
|
|
25
|
1
|
|
|
1
|
|
5
|
use base qw( accessors ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
486
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
28
|
|
|
|
|
|
|
our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2]; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# inherit everything for now. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |