accessors::ro

Create 'classic' read-only accessors methods
Download

accessors::ro Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Steve Purkis
  • Publisher web site:
  • http://search.cpan.org/~spurkis/TAP-Formatter-HTML-0.04/lib/TAP/Formatter/HTML.pm

accessors::ro Tags


accessors::ro Description

Create 'classic' read-only accessors methods accessors::ro is a Perl module that allows you to create 'classic' read-only accessors methods in caller's package.SYNOPSIS package Foo; use accessors::ro qw( foo bar baz ); my $obj = bless { foo => 'read only? ' }, 'Foo'; # values are read-only, so set is disabled: print "oh my! " if $obj->foo( "set?" ) eq 'read only? '; # if you really need to change the vars, # you must use direct-variable-access: $obj->{bar} = 'i need a drink '; $obj->{baz} = 'now'; # always returns the current value: print $obj->foo, $obj->bar, $obj->baz, "! ";The accessors::ro pragma lets you create simple classic read-only accessors at compile-time.The generated methods look like this: sub foo { my $self = shift; return $self->{foo}; }They always return the current value, just like accessors::ro. Requirements: · Perl


accessors::ro Related Software