Class::Data::Inheritable::Translucent - Inheritable, overridable, translucent class data / object attributes


Class-Data-Inheritable-Translucent documentation  | view source Contained in the Class-Data-Inheritable-Translucent distribution.

Index


NAME

Top

Class::Data::Inheritable::Translucent - Inheritable, overridable, translucent class data / object attributes

SYNOPSIS

Top

  package Foo;
  use base 'Class::Data::Inheritable::Translucent';

  Foo->mk_translucent("bar");
  Foo->bar("baz");

  $obj = Foo->new;

  print $obj->bar; # prints "baz"

  $obj->bar("whatever");

  print $obj->bar; # prints "whatever"
  print Foo->bar;  # prints "baz"

  $obj->bar(undef);

  print $obj->bar; # prints "baz"

DESCRIPTION

Top

This module is based on Class::Data::Inheritable, and is largely the same, except the class data accessors double as translucent object attributes.

Object data, by default, is stored in $obj->{$attribute}. See the attrs() method, explained below, on how to change that.

METHODS

Top

mk_translucent

Creates inheritable class data / translucent instance attributes

attrs

This method is called by the generated accessors and, by default, simply returns the object that called it, which should be a hash reference for storing object attributes. If your objects are not hashrefs, or you wish to store your object attributes in a different location, eg. $obj->{attrs}, you should override this method. Class::Data::Inheritable::Translucent stores object attributes in $obj->attrs()->{$attribute}.

AUTHOR

Top

Steve Hay <shay@cpan.org> is now maintaining Class::Data::Inheritable::Translucent as of version 1.00

Originally by Ryan McGuigan

Based on Class::Data::Inheritable, originally by Damian Conway

ACKNOWLEDGEMENTS

Top

Thanks to Damian Conway for Class::Data::Inheritable

COPYRIGHT & LICENSE

Top

BUGS

Top

Please report any bugs or feature requests on the CPAN Request Tracker at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-Data-Inheritable-Translucent.

SEE ALSO

Top


Class-Data-Inheritable-Translucent documentation  | view source Contained in the Class-Data-Inheritable-Translucent distribution.