Class::DBI::ViewLoader::Auto - Load views for existing Class::DBI classes
package MyMovieClass; use strict; use warnings; use Class::DBI; use Class::DBI::ViewLoader::Auto; our @ISA = qw( Class::DBI ); __PACKAGE__->connection('dbi:Pg:dbname=mymoviedb', 'me', 'mypasswd'); # load views from database mymoviedb to MyMovieClass::* @loaded = __PACKAGE__->load_views(); # load only views starting with film_ @loaded = __PACKAGE__->load_views(qr/^film_/); # or pass more options: @loaded = __PACKAGE__->load_views( namespace => 'MyMovieClass::View', exclude => qr(^test_), );
This module provides a simpler interface to Class::DBI::ViewLoader.
This module exports the load_views method into the calling package
$loader = $cdbi_class->load_views( %opts or $include )
Loads views from the database connection in $cdbi_class.
The default namespace is the same as the calling class.
%opts is passed to the Class::DBI::Loader constructor. If a scalar argument is given instead of a hash or hashref, it is interpreted as being the include pattern.
The options dsn, username, password and options are silently ignored.
$cdbi_class should always be the leftmost base class of the generated classes. base_classes and left_base_classes options are supported, but it might make more sense to add those bases to the calling class manually.
Returns the same as Class::DBI::ViewLoader->load_views, i.e. a list of loaded classes.
The given class had no connection set up to read views from.
To install Class::DBI::ViewLoader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::DBI::ViewLoader
CPAN shell
perl -MCPAN -e shell install Class::DBI::ViewLoader
For more information on module installation, please visit the detailed CPAN module installation guide.