join '', map ucfirst, split /[\W_]+/, lc $class
Friday, December 12, 2008
CamelCase
CamelCase script from DBIx::Class::Schema::Loader::Base document.
Tuesday, December 9, 2008
Catalyst Model Adaptor
when using Catalyst::Model::Adaptor and DBIC Schema module,
./script/myapp_create.pl model DB Adaptor MyApp::Schema connection
on myapp.yml
./script/myapp_create.pl model DB Adaptor MyApp::Schema connection
package MyApp::Web::Model::DB;
use strict;
use warnings;
use base 'Catalyst::Model::Adaptor';
__PACKAGE__->config(
class => 'MyApp::Schema',
constructor => 'connection',
);
sub prepare_arguments {
my ( $self, $app ) = @_;
my $args = $app->config->{"Model::DB"}->{args};
return $args;
}
sub mangle_arguments {
my ( $self, $args ) = @_;
return @$args;
}
on myapp.yml
Model::DB:
args:
- dbi:Pg:dbname=myapp_db
- myapp_user
- myapp_pass
-
AutoCommit: 0
DBIC SchemaLoader
when making schema class from db, use schemaloader,
perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:lib \
-e 'make_schema_at "MyApp::Schema",
{relationships=>1, debug=>1},
["dbi:Pg:dbname=dbname","username","password"]'
Subscribe to:
Posts (Atom)