File: rw.pm

package info (click to toggle)
libaccessors-perl 1.01-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 164 kB
  • ctags: 36
  • sloc: perl: 330; makefile: 2
file content (51 lines) | stat: -rwxr-xr-x 906 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
=head1 NAME

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

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

=cut

package accessors::rw;

use strict;
use warnings::register;
use base qw( accessors::classic );

our $VERSION  = '1.01';
our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2];

use constant style => 'rw';

1;

__END__

=head1 DESCRIPTION

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

=head1 AUTHOR

Steve Purkis <spurkis@cpan.org>.

=head1 SEE ALSO

L<accessors>,
L<accessors::ro>,
L<accessors::classic>,
L<accessors::chained>,
L<base>

=cut