accessors::rw - create 'classic' read/write accessor methods in caller's package.
package Foo; use accessors::rw qw( foo bar baz ); my $obj = bless {}, 'Foo'; # always return the current value, even on set: $obj->foo( 'hello ' ) if $obj->bar( 'world' ) eq 'world'; print $obj->foo, $obj->bar, $obj->baz( "!\n" );
The accessors::rw pragma lets you create simple classic read/write accessors at compile-time. It is an alias for accessors::classic.
Steve Purkis <spurkis@cpan.org>.
accessors, accessors::ro, accessors::classic, accessors::chained, base
To install accessors, copy and paste the appropriate command in to your terminal.
cpanm
cpanm accessors
CPAN shell
perl -MCPAN -e shell install accessors
For more information on module installation, please visit the detailed CPAN module installation guide.