logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Author

       Steve Purkis <spurkis@cpan.org>.

Description

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

Name

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

See Also

       accessors, accessors::ro, accessors::classic, accessors::chained, base

perl v5.36.0                                       2022-10-13                                 accessors::rw(3pm)

Synopsis

         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" );

See Also