不是这个问题,我DSN已经连上,如果connect以后,可以Dumper出dbix::class类。而且我修改了,还是一样的错误。
my $dbi_dsn =
'dbi:SQlite:dbname=/Users/xu/projects/opm/DBdesign/opm_new.db';

执行后,出错还是那样
------------------------
xumatoiMac:dbdesign xu$ cat t.pl
#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;
use MyApp::Schema;


my $dbi_dsn =
'dbi:SQlite:dbname=/Users/xu/projects/opm/DBdesign/opm_new.db';
my $schema = MyApp::Schema->connect($dbi_dsn,'','',);

my $users_rs =$schema->resultset('Event');

#print Dumper $users_rs;

my $user = $users_rs->find(1);
print Dumper $user;
#$user->set_column('title' => 'helloworld');
#$user->update;

exit;


输出结果:
---------------------------------------------
umatoiMac:dbdesign xu$ t.pl
Can't locate object method "_rebless" via package
"DBIx::Class::Storage::DBI::SQlite" at
/Library/Perl/5.12/DBIx/Class/Storage/DBI.pm line 1153.
xumatoiMac:dbdesign xu$





2012/4/17 Fayland Lam <[email protected]>

> it should be dbi:SQLite
>
> not Sqlite
>
> Thanks
>
> 2012/4/17 rochelle hsu <[email protected]>:
> > 写了一段dbix::class的代码,但运行后报错,代码如下:
> > t.pl
> >
> -------------------------------------------------------------------------------
> > #!/usr/bin/perl
> >
> > use strict;
> > use warnings;
> > use Data::Dumper;
> > use lib 'lib';
> > use MyApp::Schem;
> >
> >
> > my $dbi_dsn =
> > 'dbi:Sqlite:dbname=/Users/xu/projects/opm/DBdesign/opm_new.db';
> > my $schema = MyApp::Schem->connect($dbi_dsn,'','',);
> >
> > my $users_rs =$schema->resultset('Event');
> >
> > #print Dumper $users_rs;
> >
> > my $user = $users_rs->find(1);
> > print Dumper $user;
> > #$user->set_column('title' => 'helloworld');
> > #$user->update;
> >
> > exit;
> >
> >
> > --------------------------------
> > 运行以后输出:
> > xumatoiMac:dbdesign xu$ t.pl
> > Can't locate object method "_rebless" via package
> > "DBIx::Class::Storage::DBI::Sqlite" at
> > /Library/Perl/5.12/DBIx/Class/Storage/DBI.pm line 1153.
> >
> > 请大家帮忙看看有啥问题。
> >
> > 2012/4/17 langq 235 <[email protected]>
> >>
> >> 特像写简历。。。
> >>
> >> --
> >> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> >> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> >> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> >> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
> >
> >
> > --
> > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> > 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>
>
> --
> Fayland Lam // http://www.fayland.org/
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
> 要向此网上论坛发帖,请发送电子邮件至 [email protected]。
> 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
> 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
>
>

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。
要向此网上论坛发帖,请发送电子邮件至 [email protected]。
要取消订阅此网上论坛,请发送电子邮件至 [email protected]。
若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。

回复