i referred to dbi schem like below, it is working... use lib '../testdb'; use Mysqltestdb::Schema;
testdb folder is under which schema is dumped. it is same level as script folder, so ../testdb ----- Original Message ----- From: "[email protected]" <[email protected]> To: [email protected] Cc: Sent: Friday, October 7, 2011 8:28 AM Subject: [Dbix-class] Can't find source in DBIx::Class::Schema::resultset() Hi, i'm new using DBIx::Class. I had a postgresql 9.x database named OGS2 with only one table: CREATE TABLE regles ( numero integer NOT NULL, nom character(255), commentaires character varying(1024), disabled boolean NOT NULL DEFAULT false, "TypeModif" character(3) NOT NULL DEFAULT 'ADD'::bpchar, "DateModif" date NOT NULL DEFAULT date_trunc('day'::text, now()), "isSup" boolean NOT NULL DEFAULT false, "isDone" boolean NOT NULL DEFAULT false, CONSTRAINT cp_regles_pk PRIMARY KEY (numero ) ) WITH ( OIDS=FALSE, autovacuum_enabled=true, toast.autovacuum_enabled=true ); ALTER TABLE regles OWNER TO ogsadm; I ve used successfully DBIx::Class::Schema::Loader who produce 2 files: Schema.pm in .\lib\OGS2\Schema Regle.pm in .\lib\OGS2\Schema\result First question : why my table named regles (with a ending 's') gives me a pm file Regle.pm (without ending 's') ? schema.pm is: package OGS2::Schema; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE use strict; use warnings; use base 'DBIx::Class::Schema'; __PACKAGE__->load_namespaces; # Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-10-07 14:07:56 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OrkYcQoWvuWfhpX2V2qYcA # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; Regle.pm is: package OGS2::Schema::Result::Regles; # Created by DBIx::Class::Schema::Loader # DO NOT MODIFY THE FIRST PART OF THIS FILE use strict; use warnings; use base 'DBIx::Class::Core'; __PACKAGE__->table("regles"); __PACKAGE__->add_columns( "numero", { data_type => "integer", is_nullable => 0 }, "nom", { data_type => "char", is_nullable => 1, size => 255 }, "commentaires", { data_type => "varchar", is_nullable => 1, size => 1024 }, "disabled", { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "TypeModif", { accessor => "type_modif", data_type => "char", default_value => "ADD", is_nullable => 0, size => 3, }, "DateModif", { accessor => "date_modif", data_type => "date", default_value => \"date_trunc('day'::text, now())", is_nullable => 0, }, "isSup", { accessor => "is_sup", data_type => "boolean", default_value => \"false", is_nullable => 0, }, "isDone", { accessor => "is_done", data_type => "boolean", default_value => \"false", is_nullable => 0, }, ); __PACKAGE__->set_primary_key("numero"); # Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-10-07 14:38:08 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HILqAopsCr3y9Mpkpm19eA # You can replace this text with custom code or comments, and it will be preserved on regeneration 1; my program ogs-import.pl is: use Carp; use Data::Dumper; use strict; use warnings; use DBD::Pg; use lib::OGS2::Schema; use lib::OGS2::Schema::Result::Regle; print "Ouverture de la base de données\n"; my $schema=OGS2::Schema->connect('dbi:Pg:dbname=OGS2;host=localhost','ogsadm','ogsadm1!'); my $regles=$schema->resultset('Regle'); And i got the error: DBIx::Class::Schema::resultset(): Can't find source for Regle at ogs-import.pl line 15 any help? regards Laurent _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected] _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
