artemave has asked for the wisdom of the Perl Monks concerning the following question:
Then I'm getting schema from the model class:package dir_browse::model::DB::Main; use warnings; use strict; use base qw/DBIx::Class::Schema::Loader/; __PACKAGE__->loader_options(relationships => 1, debug => 1); sub get_schema { return __PACKAGE__->connection('dbi:mysql:database=dir_browse', 'r +oot', 'sa', {AutoCommit => 1}); } 1;
Running this produces the following error:package dir_browse::model::dir_browse; use strict; use warnings; ... use dir_browse::model::DB::Main; sub new { bless { schema => &dir_browse::model::DB::Main::get_schema(), ... } } ... sub get_contents { my $self = shift; ... $self->{dir} = $self->{schema}->resultset('t_dir')->search({dr_pat +h => $dir}) or $self->{schema}->create('t_dir')->({dr_path => $dir}); ... }
prepended by the following warning:DBIx::Class::Schema::resultset(): Can't find source for t_dir
whilst there are tables:No tables found in database, nothing to load at c:/Perl/site/lib/DBIx/ +Class/Sche ma/Loader/Base.pm line 443.
What am I doing wrong?mysql> use dir_browse; Database changed mysql> show tables; +----------------------+ | Tables_in_dir_browse | +----------------------+ | t_dir | | t_dir_type | | t_session | | t_user | +----------------------+
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with DBIx::Class
by stonecolddevin (Parson) on May 06, 2007 at 05:38 UTC | |
by artemave (Beadle) on May 06, 2007 at 09:06 UTC |