Rose::DBx::Garden - bootstrap Rose::DB::Object and Rose::HTML::Form classes
use Rose::DBx::Garden; my $garden = Rose::DBx::Garden->new( garden_prefix => 'MyRoseGarden', # instead of class_prefix perltidy_opts => '-pbp -nst -nse', # Perl Best Practices db => My::DB->new, # Rose::DB object find_schemas => 0, # set true if your db has schemas force_install => 0, # do not overwrite existing files debug => 0, # print actions on stderr skip_map_class_forms => 1, # no Form classes for many2many map classes include_autoinc_form_fields => 1, # other Rose::DB::Object::Loader params here ); # $garden ISA Rose::DB::Object::Loader $garden->plant('path/to/where/i/want/files');
** DEVELOPMENT RELEASE -- API SUBJECT TO CHANGE **
Rose::DBx::Garden bootstraps Rose::DB::Object and Rose::HTML::Form based projects. The idea is that you can point the module at a database and end up with work-able RDBO and Form classes with a single method call.
Rose::DBx::Garden inherits from Rose::DB::Object::Loader, so all the magic there is also available here.
NOTE: All the init_* methods are intended for when you subclass the Garden class. You can pass in values to the new() constructor for normal use. See Rose::Object::MakeMethods::Generic.
The default behaviour is to include db columns flagged as auto_increment from the generated Form class and to map them to the 'serial' field type. Set this value to a false value to exclude auto_increment columns as form fields.
Sets the default RDBO column type to RHTMLO field type mapping. Should be a hash ref of 'rdbo' => 'rhtmlo' format.
Returns a CODE ref for filtering a column name to its corresponding form field label. The CODE ref should expect two arguments: the Garden object and the column name.
The default is just to return the column name. If you wanted to return, for example, a prettier version aligned with the naming conventions used in Rose::DB::Object::ConventionManager, you might do something like:
my $garden = Rose::DBx::Garden->new( column_to_label => sub { my ($garden_obj, $col_name) = @_; return join(' ', map { ucfirst($_) } split(m/_/, $col_name) ); } );
The default base class name is MyRoseGarden. This value overrides class_prefix and base_class in the base Loader class.
MyRoseGarden
class_prefix
base_class
If set, Perl::Tidy will be called to format all generated code. The value of perltidy_opts should be the same as the command-line options to perltidy.
The default is 0 (no run through Perl::Tidy).
Tie the size and maxlength of text input fields to the allowed length of text columns. Should be set to an integer corresponding to the max size of a text field. The default is 64.
The return value is inserted into the base RDBO class created.
The return value is inserted into the base RHTMLO class created;
The default return value is an empty arrayref, which is interpreted as "all schemas" if the find_schemas flag is true.
Otherwise, you may explicitly name an array of schema names to limit the code generated to only those schemas you want. Must be used with find_schemas set to true.
Define an explicit database name to use when generating class names. The default is taken from the Rose::DB connection information. NOTE:This does not affect the db connection, only the string used in constructing class names.
NOTE:This option is ignored if find_schemas() is true.
path will override module_dir() if set in new().
Returns a hash ref of all the class names created, in the format:
RDBO::Class => RHTMLO::Class
If no RHTMLO class was created the hash value will be '1'.
An alias for plant().
Returns the garden_prefix() value with which this class was created.
Returns the Perl code text for creating a generic Form field.
Returns the Perl code text for creating a numeric Form field.
Returns the Perl code text for creating a boolean Form field.
Returns the Perl code text for creating a text Form field.
Returns Perl code for textarea field.
Returns the Perl code text for creating a hidden Form field.
Returns the Perl code text for creating a serial Form field.
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
Please report any bugs or feature requests to bug-rose-dbx-garden at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-DBx-Garden. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-rose-dbx-garden at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Rose::DBx::Garden
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Rose-DBx-Garden
CPAN Ratings
http://cpanratings.perl.org/d/Rose-DBx-Garden
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Rose-DBx-Garden
Search CPAN
http://search.cpan.org/dist/Rose-DBx-Garden
Thanks to Adam Prime, adam.prime at utoronto.ca for patches and feedback on the design.
adam.prime at utoronto.ca
The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.
http://www.msi.umn.edu/
Copyright 2007 by the Regents of the University of Minnesota.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Rose::DBx::Garden, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Rose::DBx::Garden
CPAN shell
perl -MCPAN -e shell install Rose::DBx::Garden
For more information on module installation, please visit the detailed CPAN module installation guide.