release 0.06, fixed pod_to_ignore stuff, added an optional half-decent helper test
[catagits/Catalyst-Model-DBIC-Schema.git] / lib / Catalyst / Helper / Model / DBIC / Schema.pm
CommitLineData
ad91060a 1package Catalyst::Helper::Model::DBIC::Schema;
2
3use strict;
0f2fd2c0 4use warnings;
5use Carp;
ad91060a 6
7=head1 NAME
8
9Catalyst::Helper::Model::DBIC::Schema - Helper for DBIC Schema Models
10
11=head1 SYNOPSIS
12
0f2fd2c0 13 script/create.pl model Foo DBIC::Schema Foo::SchemaClass [ dsn user password ]
14
15 Where:
16 Foo is the short name for the Model class being generated
17 Foo::SchemaClass is the fully qualified classname of your Schema,
18 which isa DBIx::Class::Schema defined elsewhere.
19 dsn, user, and password are optional if connection info is already
20 defined in your Schema class (as it would be in the case of
21 DBIx::Class::Schema::Loader).
ad91060a 22
23=head1 DESCRIPTION
24
7b39f3f0 25Helper for the DBIC Schema Models.
ad91060a 26
27=head2 METHODS
28
29=head3 mk_compclass
30
31=cut
32
33sub mk_compclass {
0f2fd2c0 34 my ( $self, $helper, $schema_class, $dsn, $user, $pass ) = @_;
35
36 $helper->{schema_class} = $schema_class || '';
37
38 if(defined($dsn)) {
39 $helper->{setup_connect_info} = 1;
40 $helper->{dsn} = $dsn || '';
41 $helper->{user} = $user || '';
42 $helper->{pass} = $pass || '';
43 }
44
ad91060a 45 my $file = $helper->{file};
46 $helper->render_file( 'compclass', $file );
47}
48
49=head1 SEE ALSO
50
7b39f3f0 51General Catalyst Stuff:
52
ad91060a 53L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>,
7b39f3f0 54L<Catalyst::Response>, L<Catalyst::Helper>, L<Catalyst>,
55
56Stuff related to DBIC and this Model style:
57
58L<DBIx::Class>, L<DBIx::Class::Schema>,
1aeb6e1e 59L<DBIx::Class::Schema::Loader>, L<Catalyst::Model::DBIC::Schema>,
60L<Catalyst::Helper::Model::DBIC::SchemaLoader>
ad91060a 61
62=head1 AUTHOR
63
64Brandon L Black, C<blblack@gmail.com>
65
66=head1 LICENSE
67
68This library is free software, you can redistribute it and/or modify
69it under the same terms as Perl itself.
70
71=cut
72
dce0dfe8 731;
74
ad91060a 75__DATA__
76
5d11d759 77=begin pod_to_ignore
78
ad91060a 79__compclass__
80package [% class %];
81
82use strict;
83use base 'Catalyst::Model::DBIC::Schema';
84
85__PACKAGE__->config(
0f2fd2c0 86 schema_class => '[% schema_class %]',
87 [% IF setup_connect_info %]
ad91060a 88 connect_info => [ '[% dsn %]',
89 '[% user %]',
90 '[% pass %]',
91 {
92 RaiseError => 1,
93 PrintError => 0,
94 ShowErrorStatement => 1,
95 TraceLevel => 0,
96 AutoCommit => 1,
97 }
98 ],
0f2fd2c0 99 [% END %]
ad91060a 100);
101
102=head1 NAME
103
1aeb6e1e 104[% class %] - Catalyst DBIC Schema Model
ad91060a 105
106=head1 SYNOPSIS
107
108See L<[% app %]>
109
110=head1 DESCRIPTION
111
1aeb6e1e 112L<Catalyst::Model::DBIC::Schema> Model using schema
113L<[% schema_class %]>
ad91060a 114
115=head1 AUTHOR
116
117[% author %]
118
119=head1 LICENSE
120
121This library is free software, you can redistribute it and/or modify
122it under the same terms as Perl itself.
123
124=cut
125
1261;