1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
package Catalyst::Helper::Model::DBI;
use strict;
use File::Spec;
our $VERSION = '0.32';
=head1 NAME
Catalyst::Helper::Model::DBI - Helper for DBI Models
=head1 SYNOPSIS
script/create.pl model DBI DBI dsn user password
=head1 DESCRIPTION
Helper for DBI Model.
=head2 METHODS
=over 4
=item mk_compclass
Reads the database and makes a main model class
=item mk_comptest
Makes tests for the DBI Model.
=back
=cut
sub mk_compclass {
my ( $self, $helper, $dsn, $user, $pass ) = @_;
$helper->{dsn} = $dsn || '';
$helper->{user} = $user || '';
$helper->{pass} = $pass || '';
my $file = $helper->{file};
$helper->render_file( 'dbiclass', $file );
return 1;
}
=head1 SEE ALSO
L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>,
L<Catalyst::Response>, L<Catalyst::Helper>
=head1 AUTHOR
Alex Pavlovic, C<alex.pavlovic@taskforce-1.com>
=head1 LICENSE
This library is free software . You can redistribute it and/or modify
it under the same terms as perl itself.
=cut
1;
__DATA__
__dbiclass__
package [% class %];
use strict;
use warnings;
use parent 'Catalyst::Model::DBI';
__PACKAGE__->config(
dsn => '[% dsn %]',
user => '[% user %]',
password => '[% pass %]',
options => {},
);
=head1 NAME
[% class %] - DBI Model Class
=head1 SYNOPSIS
See L<[% app %]>
=head1 DESCRIPTION
DBI Model Class.
=head1 AUTHOR
[% author %]
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;
|