Commit | Line | Data |
ad91060a |
1 | package Catalyst::Helper::Model::DBIC::Schema; |
2 | |
3 | use strict; |
4 | |
5 | =head1 NAME |
6 | |
7 | Catalyst::Helper::Model::DBIC::Schema - Helper for DBIC Schema Models |
8 | |
9 | =head1 SYNOPSIS |
10 | |
11 | script/create.pl model Foo DBIC::Schema Foo::SchemaClass dsn user password |
12 | |
13 | =head1 DESCRIPTION |
14 | |
15 | Helper for the DBIC Plain Models. |
16 | |
17 | =head2 METHODS |
18 | |
19 | =head3 mk_compclass |
20 | |
21 | =cut |
22 | |
23 | sub mk_compclass { |
24 | my ( $self, $helper, $schemaclass, $dsn, $user, $pass ) = @_; |
25 | $helper->{schemaclass} = $schemaclass || ''; |
26 | $helper->{dsn} = $dsn || ''; |
27 | $helper->{user} = $user || ''; |
28 | $helper->{pass} = $pass || ''; |
29 | my $file = $helper->{file}; |
30 | $helper->render_file( 'compclass', $file ); |
31 | } |
32 | |
33 | =head1 SEE ALSO |
34 | |
35 | L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>, |
36 | L<Catalyst::Response>, L<Catalyst::Helper> |
37 | |
38 | =head1 AUTHOR |
39 | |
40 | Brandon L Black, C<blblack@gmail.com> |
41 | |
42 | =head1 LICENSE |
43 | |
44 | This library is free software, you can redistribute it and/or modify |
45 | it under the same terms as Perl itself. |
46 | |
47 | =cut |
48 | |
dce0dfe8 |
49 | 1; |
50 | |
ad91060a |
51 | __DATA__ |
52 | |
53 | __compclass__ |
54 | package [% class %]; |
55 | |
56 | use strict; |
57 | use base 'Catalyst::Model::DBIC::Schema'; |
58 | |
59 | __PACKAGE__->config( |
dce0dfe8 |
60 | schema_class => '[% schemaclass %]', |
ad91060a |
61 | connect_info => [ '[% dsn %]', |
62 | '[% user %]', |
63 | '[% pass %]', |
64 | { |
65 | RaiseError => 1, |
66 | PrintError => 0, |
67 | ShowErrorStatement => 1, |
68 | TraceLevel => 0, |
69 | AutoCommit => 1, |
70 | } |
71 | ], |
72 | ); |
73 | |
74 | =head1 NAME |
75 | |
76 | [% class %] - Catalyst DBIC Plain Model |
77 | |
78 | =head1 SYNOPSIS |
79 | |
80 | See L<[% app %]> |
81 | |
82 | =head1 DESCRIPTION |
83 | |
84 | Catalyst::Model::DBIC::Schema Model |
85 | |
86 | =head1 AUTHOR |
87 | |
88 | [% author %] |
89 | |
90 | =head1 LICENSE |
91 | |
92 | This library is free software, you can redistribute it and/or modify |
93 | it under the same terms as Perl itself. |
94 | |
95 | =cut |
96 | |
97 | 1; |