.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Class::DBI::Loader 3pm" .TH Class::DBI::Loader 3pm "2018-06-25" "perl v5.26.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Class::DBI::Loader \- Dynamic definition of Class::DBI sub classes. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Class::DBI::Loader; \& \& my $loader = Class::DBI::Loader\->new( \& dsn => "dbi:mysql:dbname", \& user => "root", \& password => "", \& options => { RaiseError => 1, AutoCommit => 0 }, \& namespace => "Data", \& additional_classes => qw/Class::DBI::AbstractSearch/, # or arrayref \& additional_base_classes => qw/My::Stuff/, # or arrayref \& left_base_classes => qw/Class::DBI::Sweet/, # or arrayref \& constraint => \*(Aq^foo.*\*(Aq, \& relationships => 1, \& options => { AutoCommit => 1 }, \& inflect => { child => \*(Aqchildren\*(Aq }, \& require => 1 \& ); \& my $class = $loader\->find_class(\*(Aqfilm\*(Aq); # $class => Data::Film \& my $obj = $class\->retrieve(1); .Ve .PP use with mod_perl .PP in your startup.pl .PP .Vb 8 \& # load all tables \& use Class::DBI::Loader; \& my $loader = Class::DBI::Loader\->new( \& dsn => "dbi:mysql:dbname", \& user => "root", \& password => "", \& namespace => "Data", \& ); .Ve .PP in your web application. .PP .Vb 1 \& use strict; \& \& # you can use Data::Film directly \& my $film = Data::Film\->retrieve($id); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Class::DBI::Loader automate the definition of Class::DBI sub-classes. scan table schemas and setup columns, primary key. .PP class names are defined by table names and namespace option. .PP .Vb 6 \& +\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ \& | table | namespace | class | \& +\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ \& | foo | Data | Data::Foo | \& | foo_bar | | FooBar | \& +\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-+ .Ve .PP Class::DBI::Loader supports MySQL, Postgres and SQLite. .PP See Class::DBI::Loader::Generic. .SH "METHODS" .IX Header "METHODS" .ie n .SS "new %args" .el .SS "new \f(CW%args\fP" .IX Subsection "new %args" .IP "additional_base_classes" 4 .IX Item "additional_base_classes" List of additional base classes your table classes will use. .IP "left_base_classes" 4 .IX Item "left_base_classes" List of additional base classes, that need to be leftmost, for example Class::DBI::Sweet (former Catalyst::Model::CDBI::Sweet). .IP "additional_classes" 4 .IX Item "additional_classes" List of additional classes which your table classes will use. .IP "constraint" 4 .IX Item "constraint" Only load tables matching regex. .IP "exclude" 4 .IX Item "exclude" Exclude tables matching regex. .IP "debug" 4 .IX Item "debug" Enable debug messages. .IP "dsn" 4 .IX Item "dsn" \&\s-1DBI\s0 Data Source Name. .IP "namespace" 4 .IX Item "namespace" Namespace under which your table classes will be initialized. .IP "password" 4 .IX Item "password" Password. .IP "options" 4 .IX Item "options" Optional hashref to specify \s-1DBI\s0 connect options .IP "relationships" 4 .IX Item "relationships" Try to automatically detect/setup has_a and has_many relationships. .IP "inflect" 4 .IX Item "inflect" An hashref, which contains exceptions to \fILingua::EN::Inflect::PL()\fR. Useful for foreign language column names. .IP "user" 4 .IX Item "user" Username. .IP "require" 4 .IX Item "require" Attempt to require the dynamically defined module, so that extensions defined in files. By default errors from imported modules are suppressed. When you want to debug, use require_warn. .IP "require_warn" 4 .IX Item "require_warn" Warn of import errors when requiring modules. .SH "AUTHOR" .IX Header "AUTHOR" Daisuke Maki \f(CW\*(C`dmaki@cpan.org\*(C'\fR .SH "AUTHOR EMERITUS" .IX Header "AUTHOR EMERITUS" Sebastian Riedel, \f(CW\*(C`sri@oook.de\*(C'\fR \&\s-1IKEBE\s0 Tomohiro, \f(CW\*(C`ikebe@edge.co.jp\*(C'\fR .SH "THANK YOU" .IX Header "THANK YOU" Adam Anderson, Andy Grundman, Autrijus Tang, Dan Kubb, David Naughton, Randal Schwartz, Simon Flack and all the others who've helped. .SH "LICENSE" .IX Header "LICENSE" This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" Class::DBI, Class::DBI::mysql, Class::DBI::Pg, Class::DBI::SQLite, Class::DBI::Loader::Generic, Class::DBI::Loader::mysql, Class::DBI::Loader::Pg, Class::DBI::Loader::SQLite