Catalyst::Helper::Model::HTML::FormFu - Helper to deploy HTML::FormFu template files.


Catalyst-Model-HTML-FormFu documentation Contained in the Catalyst-Model-HTML-FormFu distribution.

Index


Code Index:

NAME

Top

Catalyst::Helper::Model::HTML::FormFu - Helper to deploy HTML::FormFu template files.

SYNOPSIS

Top

    script/myapp_create.pl model YouModelName HTML::FormFu [dirname]

DESCRIPTION

Top

Uses HTML::FormFu::Deploy to copy HTML::FormFu template files into a Catalyst application's root/formfu directory.

To change the destination directory, pass it as an extra directory. It will be created with the root directory

The following example would deploy the template files into directory root/forms.

    script/myapp_create.pl model YourModelName HTML::FormFu forms

METHODS

Top

mk_compclass

SEE ALSO

Top

HTML::FormFu, Catalyst::Helper

AUTHOR

Top

Daisuke Maki daisuke@endeworks.jp

LICENSE

Top

This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.


Catalyst-Model-HTML-FormFu documentation Contained in the Catalyst-Model-HTML-FormFu distribution.

package Catalyst::Helper::Model::HTML::FormFu;
use strict;
use warnings;

use File::Spec;
use HTML::FormFu::Deploy;
use Carp qw/ croak /;

sub mk_compclass {
    my ( $self, $helper, $dir ) = @_;
    
    my @files = HTML::FormFu::Deploy::file_list();
    
    my $form_dir = File::Spec->catdir(
        $helper->{base}, 'root', ( defined $dir ? $dir : 'formfu' )
    );
    
    $helper->mk_dir( $form_dir ) unless -d $form_dir;
    
    for my $filename (@files) {
        my $path = File::Spec->catfile( $form_dir, $filename );
        my $data = HTML::FormFu::Deploy::file_source($filename);
        
        $helper->mk_file( $path, $data );
    }

    $helper->render_file('model', $helper->{file});

    return;
}

1;

__DATA__

__model__
package [% class %];
use strict;
use warnings;
use base qw(Catalyst::Model::HTML::FormFu);

1;

__END__