The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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.