helper renamed
[catagits/Catalyst-Model-DBIC-Schema.git] / lib / Catalyst / Helper / Model / DBIC / SchemaLoader.pm
CommitLineData
7b39f3f0 1package Catalyst::Helper::Model::DBIC::SchemaInlineLoader;
2
3use strict;
4use warnings;
5use Carp;
6
7=head1 NAME
8
9Catalyst::Helper::Model::DBIC::SchemaInlineLoader - Helper for AutoLoaded DBIC Schema Models
10
11=head1 SYNOPSIS
12
13 script/create.pl model Foo DBIC::SchemaInlineLoader dsn user password
14
15 Where:
16 Foo is the short name for the Model class being generated
17 dsn, user, and password are the connection info
18
19=head1 DESCRIPTION
20
21This helper generates a Catalyst::Model::DBIC::Schema class based upon a
22generated inline DBIx::Class::Schema::Loader definition. Nothing external
23to the generated class is required.
24
25Models generated by this Helper require the seperate package
26L<DBIx::Class::Schema::Loader> to be installed. It is on the recommended
27list for this package, but is not required for installation.
28
29=head2 METHODS
30
31=head3 mk_compclass
32
33=cut
34
35sub mk_compclass {
36 my ( $self, $helper, $dsn, $user, $pass ) = @_;
37
38 $helper->{dsn} = $dsn || '';
39 $helper->{user} = $user || '';
40 $helper->{pass} = $pass || '';
41
42 my $file = $helper->{file};
43 $helper->render_file( 'compclass', $file );
44}
45
46=head1 SEE ALSO
47
48General Catalyst Stuff:
49
50L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>,
51L<Catalyst::Response>, L<Catalyst::Helper>, L<Catalyst>,
52
53Stuff related to DBIC and this Model style:
54
55L<DBIx::Class>, L<DBIx::Class::Schema>,
56L<DBIx::Class::Schema::Loader>, L<Catalyst::Helper::Model::DBIC::Schema>,
57L<Catalyst::Helper::Model::DBIC::SchemaInlineLoader>
58
59=head1 AUTHOR
60
61Brandon L Black, C<blblack@gmail.com>
62
63=head1 LICENSE
64
65This library is free software, you can redistribute it and/or modify
66it under the same terms as Perl itself.
67
68=cut
69
701;
71
72__DATA__
73
74__compclass__
75package [% %]_[% class %]::Schema;
76
77use strict;
78use base qw/DBIx::Class::Schema::Loader/;
79
80__PACKAGE__->load_from_connection(
81 dsn => '[% dsn %]',
82 user => '[% user %]',
83 pass => '[% pass %]',
84 options => {
85 RaiseError => 1,
86 PrintError => 0,
87 ShowErrorStatement => 1,
88 TraceLevel => 0,
89 AutoCommit => 1,
90 },
91 relationships => 1,
92 # debug => 1,
93);
94
95package [% class %];
96
97use strict;
98use base 'Catalyst::Model::DBIC::Schema';
99
100__PACKAGE__->config(
101 schema_class => '_[% class %]::Schema',
102);
103
104=head1 NAME
105
106[% class %] - Catalyst DBIC Plain Model
107
108=head1 SYNOPSIS
109
110See L<[% app %]>
111
112=head1 DESCRIPTION
113
114Catalyst::Model::DBIC::Schema Model
115
116=head1 AUTHOR
117
118[% author %]
119
120=head1 LICENSE
121
122This library is free software, you can redistribute it and/or modify
123it under the same terms as Perl itself.
124
125=cut
126
1271;