initial checkin
[catagits/Catalyst-Model-DBIC-Schema.git] / lib / Catalyst / Helper / Model / DBIC / Schema.pm
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
49 __DATA__
50
51 __compclass__
52 package [% class %];
53
54 use strict;
55 use base 'Catalyst::Model::DBIC::Schema';
56
57 __PACKAGE__->config(
58     schema_class => '[% schemaclass %]
59     connect_info => [ '[% dsn %]',
60                       '[% user %]',
61                       '[% pass %]',
62                       {
63                           RaiseError         => 1,
64                           PrintError         => 0,
65                           ShowErrorStatement => 1,
66                           TraceLevel         => 0,
67                           AutoCommit         => 1,
68                       }
69                     ],
70 );
71
72 =head1 NAME
73
74 [% class %] - Catalyst DBIC Plain Model
75
76 =head1 SYNOPSIS
77
78 See L<[% app %]>
79
80 =head1 DESCRIPTION
81
82 Catalyst::Model::DBIC::Schema Model
83
84 =head1 AUTHOR
85
86 [% author %]
87
88 =head1 LICENSE
89
90 This library is free software, you can redistribute it and/or modify
91 it under the same terms as Perl itself.
92
93 =cut
94
95 1;