Peter Karman > Rose-DBx-Garden-Catalyst > Rose::DBx::Garden::Catalyst

Download:
Rose-DBx-Garden-Catalyst-0.17.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.17   Source  

NAME ^

Rose::DBx::Garden::Catalyst - plant Roses in your Catalyst garden

SYNOPSIS ^

    # create a Catalyst app
    > catalyst.pl MyApp
        
    # create a Rose::DBx::Garden::Catalyst script
    > cat mk_cat_garden.pl
    use Rose::DBx::Garden::Catalyst;
    use MyDB;  # isa Rose::DB
    
    my $garden = Rose::DBx::Garden::Catalyst->new(
        catalyst_prefix   => 'MyApp',
        controller_prefix => 'RDGC',
        garden_prefix     => 'MyRDBO',
        db                => MyDB->new,
        tt                => 1,  # make Template Toolkit files
    );
                    
    $garden->plant('MyApp/lib');
    
    # run your script
    > perl mk_cat_garden.pl
    
    # edit your MyApp.pm file:
    > vi MyApp/lib/MyApp.pm
     
     # serve static assets
     use Catalyst qw/
         Static::Simple::ByClass
     /;
     
     __PACKAGE__->config(
        'Plugin::Static::Simple::ByClass' => {
            classes => [qw( CatalystX::CRUD::YUI::TT )],
        }
        'default_view' => 'RDGC',
     );
    
     # after __PACKAGE__->setup();
     # add these lines:
     
     use MRO::Compat;
     use mro 'c3';
     Class::C3::initialize();
        
    # start your Catalyst dev server
    > cd MyApp
    > perl script/myapp_server.pl
    
    # enjoy the fruits at http://localhost:3000/rdgc

DESCRIPTION ^

Rose::DBx::Garden::Catalyst extends Rose::DBx::Garden to create Catalyst component scaffolding. These created components use the RDBO and RHTMLO classes that the Garden class produces. The base Controller, Model and View classes are simple subclasses of CatalystX::CRUD::YUI.

This module works on the assumption that 1 table == 1 form == 1 controller class == 1 model class.

By default this class creates stub Template Toolkit files for use with the RDBO and RHTMLO CRUD components. If you use a different templating system, just set the tt option to 0.

METHODS ^

Only new or overridden methods are documented here.

init_controller_prefix

The namespace where Catalyst Controllers are created. Will also be lowercased and serve as the URI path namespace for all RDGC actions.

Default: RDGC

init_base_code

Override the base method to create methods useful to RDBO classes used in Catalyst.

init_base_form_class_code

Custom base Form code to implement features that template will require.

init_catalyst_prefix

Defaults to 'MyApp'.

base_tt_path

Returns controller_prefix() transformed to a file path.

plant( path/to/my/catapp )

Override the base method to create Catalyst-related files in addition to the basic Garden files.

make_catalyst( class_names, path )

Does the actual file creation of Catalyst files. Called by plant().

class_names should be a hash ref of RDBO => RHTMLO class names, as returned by Rose::DBx::Garden->plant(). If you have existing RDBO and RHTMLO classes that have namespaces inconsistent with the conventions in Rose::DBx::Garden, they should still work. Just map the RDBO => RHTMLO classes in your class_names hash ref.

AUTHOR ^

Peter Karman, <karman at cpan.org>

TODO ^

client-side JS validation

Should be straightforward since the Garden nows puts column-type as xhtml class value.

RDGC tests

Need a way to reliably test the JS.

BUGS ^

Known issues:

re-running the script fails to pick up all classes

This is due to issues with @INC and how the RDBO Loader requires classes. There is no known workaround at the moment.

javascript required

The TT templates generated depend heavily on the YUI toolkit http://developer.yahoo.com/yui/. Graceful degredation is not implemented as yet.

Please report any bugs or feature requests to bug-rose-dbx-garden-catalyst at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Rose-DBx-Garden-Catalyst. 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::Catalyst

You can also look for information at:

ACKNOWLEDGEMENTS ^

The Minnesota Supercomputing Institute http://www.msi.umn.edu/ sponsored the development of this software.

COPYRIGHT & LICENSE ^

Copyright 2008 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.

syntax highlighting: