Brian Duggan > Class-Accessor-Contextual > Class::Accessor::Contextual

Download:
Class-Accessor-Contextual-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

Class::Accessor::Contextual - Context-aware accessors

SYNOPSIS ^

 package Farm;
 use base qw/Class::Accessor::Contextual/;

 Farm->mk_accessors(qw/animals names/);

 my $farm = Farm->new();

 $farm->animals([qw/horse pig owl/]);

 print join ' ', $farm->animals;

 # horse pig owl

 $farm->names({
    horse => "Mr. Ed",
    pig   => "Miss Piggy",
    owl   => "Dr. Who"});

 my %name_hash = $farm->names;

DESCRIPTION ^

This class overrides Class::Accessor's get() method so that references to arrays or hashes will automatically be dereferenced when called in list context.

AUTHOR ^

Brian Duggan, <bduggan at matatu.org>

SEE ALSO ^

Class::Accessor

COPYRIGHT & LICENSE ^

Copyright 2009 Brian Duggan.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

syntax highlighting: