-
-
11 Sep 2008 16:38:19 UTC
- Distribution: Rose-DBx-Garden
- Module version: 0.15
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (171 / 0 / 3)
- Kwalitee
Bus factor: 0- License: unknown
- Activity
24 month- Tools
- Download (10.35KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Data::Dump
- File::Basename
- File::Slurp
- Path::Class
- Rose::DB::Object
- Rose::DBx::TestDB
- Rose::HTML::Objects
- Rose::HTMLx::Form::Field::Autocomplete
- Rose::HTMLx::Form::Field::Boolean
- Rose::HTMLx::Form::Field::Serial
- Test::More
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DESCRIPTION
- METHODS
- include_autoinc_form_fields
- init_column_field_map
- init_column_to_label
- init_garden_prefix
- init_perltidy_opts
- init_text_field_size
- init_base_code
- init_base_form_class_code
- init_limit_to_schemas
- use_db_name( name )
- plant( path )
- make_garden
- garden_prefix
- garden_default_field( column, label, tabindex )
- garden_numeric_field( column, label, tabindex )
- garden_boolean_field( column, label, tabindex )
- garden_text_field( column, label, tabindex )
- garden_textarea_field( column, label, tabindex )
- garden_hidden_field( column, label, tabindex )
- garden_serial_field( column, label, tabindex )
- AUTHORS
- BUGS
- SUPPORT
- ACKNOWLEDGEMENTS
- COPYRIGHT & LICENSE
NAME
Rose::DBx::Garden - bootstrap Rose::DB::Object and Rose::HTML::Form classes
SYNOPSIS
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');
DESCRIPTION
** 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.
METHODS
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.
include_autoinc_form_fields
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.
init_column_field_map
Sets the default RDBO column type to RHTMLO field type mapping. Should be a hash ref of 'rdbo' => 'rhtmlo' format.
init_column_to_label
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) ); } );
init_garden_prefix
The default base class name is
MyRoseGarden
. This value overridesclass_prefix
andbase_class
in the base Loader class.init_perltidy_opts
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).
init_text_field_size
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.
init_base_code
The return value is inserted into the base RDBO class created.
init_base_form_class_code
The return value is inserted into the base RHTMLO class created;
init_limit_to_schemas
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.
use_db_name( name )
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.
plant( path )
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'.
make_garden
An alias for plant().
garden_prefix
Returns the garden_prefix() value with which this class was created.
garden_default_field( column, label, tabindex )
Returns the Perl code text for creating a generic Form field.
garden_numeric_field( column, label, tabindex )
Returns the Perl code text for creating a numeric Form field.
garden_boolean_field( column, label, tabindex )
Returns the Perl code text for creating a boolean Form field.
garden_text_field( column, label, tabindex )
Returns the Perl code text for creating a text Form field.
garden_textarea_field( column, label, tabindex )
Returns Perl code for textarea field.
garden_hidden_field( column, label, tabindex )
Returns the Perl code text for creating a hidden Form field.
garden_serial_field( column, label, tabindex )
Returns the Perl code text for creating a serial Form field.
AUTHORS
Peter Karman,
<karman at cpan.org>
BUGS
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.SUPPORT
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
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
ACKNOWLEDGEMENTS
Thanks to Adam Prime,
adam.prime at utoronto.ca
for patches and feedback on the design.The Minnesota Supercomputing Institute
http://www.msi.umn.edu/
sponsored the development of this software.COPYRIGHT & LICENSE
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.
Module Install Instructions
To install Rose::DBx::Garden, copy and paste the appropriate command in to your terminal.
cpanm Rose::DBx::Garden
perl -MCPAN -e shell install Rose::DBx::Garden
For more information on module installation, please visit the detailed CPAN module installation guide.