| 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 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 1 | ▶ | use warnings::register; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 1 | ▶ | use base qw( accessors ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | 1 | our $VERSION = '1.01'; | |
| 28 | 1 | our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2]; | |
| 29 | |||
| 30 | # inherit everything for now. | ||
| 31 | |||
| 32 | 1 | 1; | |
| 33 | |||
| 34 | __END__ | ||