Alzabo::MethodMaker is a Perl module used to auto-generate useful methods based on an existing schema.
use Alzabo::MethodMaker ( schema => 'schema_name', all => 1 );
This module can take an existing schema and generate a number of useful methods for this schema and its tables and rows. The method making is controlled by the parameters given along with the use statement, as seen in the SYNOPSIS section.
These parameters are all passed to the module when it is imported via use.
schema => $schema_name
This parameter is required.
class_root => $class_name
If given, this will be used as the root of the class names generated by this module. This root should not end in '::'. If none is given, then the calling module's name is used as the root. See New Class Names for more information.
all => $bool
This tells this module to make all of the methods it possibly can. See METHOD CREATION OPTIONS for more details.
If individual method creation options are set as false, then that setting will be respected, so you could use
use Alzabo::MethodMaker( schema => 'foo', all => 1, tables => 0 );
to turn on all of the regular options except for "tables".
name_maker => &naming_sub
If provided, then this callback will be called any time a method name needs to be generated. This allows you to have full control over the resulting names. Otherwise names are generated as described in the documentation.
The callback is expected to return a name for the method to be used. This name should not be fully qualified or contain any class designation as this will be handled by MethodMaker.
It is important that none of the names returned conflict with existing methods for the object the method is being added to.
For example, when adding methods that return column objects to a table, if you have a column called 'name' and try to use that as the method name, it won't work. Alzabo::Table objects already have such a method, which returns the name of the table. See the relevant documentation of the schema, table, and row objects for a list of methods they contain.
The NAMING SUB PARAMETERS section contains the details of what parameters are passed to this callback.
Please note that if you have a large complex schema you will almost certainly need to provide a custom naming subroutine to avoid name conflicts.