Automated child-class/accessor generation
\s-1BEFORE\s0 (\s-1WITHOUT\s0 \s-1THIS\s0)
package MyClass::Foo; use base qw( Class:Accessor ); _\|_PACKAGE_\|_->mk_ro_accessors(qw( jacob michael joshua ethan )); package MyClass::Bar; use base qw( Class:Accessor ); _\|_PACKAGE_\|_->mk_ro_accessors(qw( emily emma madison isabella )); package MyClass::Baz; use base qw( Class:Accessor ); _\|_PACKAGE_\|_->mk_ro_accessors(qw( haruka haruto miyu yuto ));
\s-1AFTER\s0 (\s-1WITH\s0 \s-1THIS\s0)
package MyClass; use base qw( Class::Accessor::Children ); _\|_PACKAGE_\|_->mk_child_ro_accessors( Foo => [qw( jacob michael joshua ethan )], Bar => [qw( emily emma madison isabella )], Baz => [qw( haruka haruto miyu yuto )], );
This module automagically generates child classes which have accessor/mutator methods.
This module inherits \*(C`Class::Accessor\*(C' to make accessors.
This module provides the following methods in addition to all methods provided by \*(C`Class::Accessor\*(C'.
MyClass->mk_child_accessors( Foo => \@fields, ... );
This generates a child class named \*(C`MyClass::Foo\*(C' which have accessor/mutator methods each named in \*(C`\@fields\*(C'.
MyClass->mk_child_ro_accessors( Bar => \@fields, ... );
This generates a child class named \*(C`MyClass::Bar\*(C' which have read-only accessors (ie. true accessors).
MyClass->mk_child_wo_accessors( Baz => \@fields, ... );
This generates a child class named \*(C`MyClass::Baz\*(C' which have write-only accessor (ie. mutators).
Class::Accessor
Yusuke Kawasaki <http://www.kawa.net/>
Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.