Class::MakeMethods::Template::ReadMe - About this Module
package MyObject; use Class::MakeMethods::Template::Hash ( 'new' => 'new', 'string' => 'foo', 'number' => 'bar', ); package main; my $obj = MyObject->new( foo => "Foozle", bar => 23 ); print $obj->foo(); $obj->bar(42);
This module extends the Class::MakeMethods framework by providing an abstract superclass for extensible code-templating method generators.
Common types of methods are generalized into template definitions. For example, Template::Generic's new provides a template for methods that create object instances, while Template::Generic's scalar is a template for methods that allow you to get and set individual scalar values.
Template::Generic
new
scalar
Thse definitions are then re-used and modified by various template subclasses. For example, the Template::Hash subclass supports blessed-hash objects, while the Template::Static subclass supports shared data; each of them includes an appropriate version of the scalar accessor template for those object types.
Template::Hash
Template::Static
Each template defines one or more behaviors, individual methods which can be installed in a calling package, and interfaces, which select from those behaviours and indicate the names to install the methods under.
Each individual meta-method defined by a calling package requires a method name, and may optionally include other key-value parameters, which can control the operation of some meta-methods.
Requires Class::MakeMethods 1.003.
This release has been tested succesfully on the following platforms:
5.6.1 on darwin
You may also review the current test results from CPAN-Testers:
http://testers.cpan.org/search?request=dist&dist=Class-MakeMethods
This is version 1.004 of Class::MakeMethods::Template.
You should be able to install this module using the CPAN shell interface:
perl -MCPAN -e 'install Class::MakeMethods::Template'
If this module has not yet been posted to your local CPAN mirror, you may also retrieve the current distribution from the below address and follow the normal "gunzip", "tar xf", "cd", "perl Makefile.PL && make test && sudo make install" procedure or your local equivalent:
http://www.evoscript.org/Class-MakeMethods/
See Class::MakeMethods for an overview of the framework this fits into, and the general calling conventions for use and make.
use
make
See Class::MakeMethods::Template for discussion of the code generation features.
If you have used Class::MethodMaker, you will note numerous similarities. Backward compatibility and conversion documentation is provded in Class::MakeMethods::Emulator::MethodMaker, available in a separate distribution on CPAN.
M. Simon Cavalletto, simonm@cavalletto.org Evolution Softworks, www.evoscript.org
Inspiration, cool tricks, and blocks of useful code for this module were extracted from the following CPAN modules:
Class::MethodMaker, by Peter Seibel.
Thanks to:
Martyn J. Pearce Scott R. Godin Ron Savage Jay Lawrence Adam Spiers Terrence Brannon
Copyright 2002 Matthew Simon Cavalletto.
Portions copyright 1998, 1999, 2000, 2001 Evolution Online Systems, Inc.
Portions copyright 1996 Organic Online.
Portions copyright 2000 Martyn J. Pearce.
You may use, modify, and distribute this software under the same terms as Perl.
To install Class::MakeMethods::Template, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::MakeMethods::Template
CPAN shell
perl -MCPAN -e shell install Class::MakeMethods::Template
For more information on module installation, please visit the detailed CPAN module installation guide.