我想用以下命令为 Catalyst 项目创建模型 DBIC:myapp_create.pl model SomeDB DBIC dbi:SQLite:/tmp/my.db
此命令不起作用,因为我没有“Catalyst::Helper::Model::DBIC”模块。为了安装它,我必须安装 DBIx::Class::Loader
# Failed test 'use Catalyst::Helper::Model::DBIC;'
# at t/01use.t line 5.
# Tried to use 'Catalyst::Helper::Model::DBIC'.
# Error: Can't locate DBIx/Class/Loader.pm in @INC
因此,当我尝试安装 DBIx::Class::Loader 时,我收到此错误报告:
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01use.t ............ 1/3 IMPORTANT: DBIx::Class::DB is DEPRECATED AND *WILL* BE REMOVED. DO NOT USE.
t/01use.t ............ ok
t/02pod.t ............ skipped: set TEST_POD to enable this test
t/03podcoverage.t .... skipped: Test::Pod::Coverage 1.04 required
t/10sqlite_common.t .. IMPORTANT: DBIx::Class::DB is DEPRECATED AND *WILL* BE REMOVED. DO NOT USE.
loader_test9 has no primary key at /home/michael/.cpan/build/DBIx-Class-Loader-0.21-VH7K9u/blib/lib/DBIx/Class/Loader.pm line 110.
t/10sqlite_common.t .. 1/26 DBIx::Class::ResultSetProxy::find(): find() expects either a column/value hashref, or a list of values corresponding to the columns of the specified unique constraint 'primary' at t/dbixcl_common_tests.pm line 73
# Looks like you planned 26 tests but ran 5.
# Looks like your test exited with 2 just after 5.
t/10sqlite_common.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 21/26 subtests
t/11mysql_common.t ... skipped: You need to set the MYSQL_NAME, MYSQL_USER and MYSQL_PASS environment variables
t/12pg_common.t ...... skipped: You need to set the PG_NAME, PG_USER and PG_PASS environment variables
t/13db2_common.t ..... skipped: You need to set the DB2_NAME, DB2_USER and DB2_PASS environment variables
Test Summary Report
-------------------
t/10sqlite_common.t (Wstat: 512 Tests: 5 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 26 tests but ran 5.
Files=7, Tests=8, 5 wallclock secs ( 0.05 usr 0.01 sys + 0.73 cusr 0.10 csys = 0.89 CPU)
Result: FAIL
Failed 1/7 test programs. 0/8 subtests failed.
make: *** [test_dynamic] Error 255
BLBLACK/DBIx-Class-Loader-0.21.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports BLBLACK/DBIx-Class-Loader-0.21.tar.gz
Running make install
make test had returned bad status, won't install without force
有人能帮助我吗?
答案1
无需使用旧方法(使用script/myapp_create.pl model DBIC DBIC dbi:SQLite:db.db
)来创建 Catalyst Model DBIC。正确的方法是使用此命令:script/myapp_create.pl model DBIC DBIC:Schema dbi:SQLite:db.db