1accessors::rw(3pm)    User Contributed Perl Documentation   accessors::rw(3pm)
2
3
4

NAME

6       accessors::rw - create 'classic' read/write accessor methods in
7       caller's package.
8

SYNOPSIS

10         package Foo;
11         use accessors::rw qw( foo bar baz );
12
13         my $obj = bless {}, 'Foo';
14
15         # always return the current value, even on set:
16         $obj->foo( 'hello ' ) if $obj->bar( 'world' ) eq 'world';
17
18         print $obj->foo, $obj->bar, $obj->baz( "!\n" );
19

DESCRIPTION

21       The accessors::rw pragma lets you create simple classic read/write
22       accessors at compile-time.  It is an alias for accessors::classic.
23

AUTHOR

25       Steve Purkis <spurkis@cpan.org>.
26

SEE ALSO

28       accessors, accessors::ro, accessors::classic, accessors::chained, base
29
30
31
32perl v5.38.0                      2023-07-21                accessors::rw(3pm)
Impressum