Everyone:
I am learning catalyst from the book <Catalyst 5.8 the perl MVC
framework>. I have finished the two former chapters.
When I study the third chapter <Building a Real Application>, I can't run
the web application. What I have finished as follows:
1. $ catalyst.pl AddressBook
2. $ cpan Catalyst::Controller::FormBuilder Catalyst::Controller::BindLex
3. $ perl script/addressbook_create.pl view HTML TTSite
4. create a sqlite3 database; the database have two tables : people and
addresses. The database's directory is ~/addressbook/tmp/
5. $ perl script/addressbook_create.pl model AddressDB DBIC::Schema
AddressBook::Schema::AddressDB create=static dbi:SQLite:database
6. The book mentions <At this stage, you can do a quick sanity check and
see if the contents of the file lib/AddressBook/Schema/
AddressDB.pm have the following:>
---------------------------------------------
__PACKAGE__->config(
schema_class =>
'AddressBook::Schema::AddressDB',
connect_info =>
['dbi:SQLite:database',],
);
---------------------------------------------
I think, maybe I misunderstand the above sentences. The file
AddressDB.pm have no such code. Add or no, the error still.
7. others steps as books ......
I run the command : script/addressbook_server.pl -r -d; I get the follows:
------------------------------------------------------
Couldn't instantiate component "AddressBook::Model::AddressDB",
"DBIx::Class::Schema::throw_exception(): DBIx::Class::Row::throw_exception():
Can't locate AddressBook/Schema/AddressDB/Result/People.pm in @INC (@INC
contains: /home/hengaini/Catalyst_201209/AddressBook/script/../lib
/home/hengaini/perl5/lib/perl5/i686-linux-gnu-thread-multi-64int
/home/hengaini/perl5/lib/perl5 /etc/perl /usr/local/lib/perl/5.14.2
/usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5
/usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at
/home/hengaini/perl5/lib/perl5/Class/C3/Componentised.pm line 150. at
/home/hengaini/perl5/lib/perl5/Class/C3/Componentised.pm line 155
Compilation failed in require at
/home/hengaini/perl5/lib/perl5/Class/C3/Componentised.pm line 150. at
/home/hengaini/perl5/lib/perl5/Class/C3/Componentised.pm line 155
Compilation failed in require at
/home/hengaini/perl5/lib/perl5/Module/Runtime.pm line 317.
at /usr/lib/perl5/Moose/Meta/TypeCoercion.pm line 68
at /usr/share/perl5/MooseX/Types/TypeDecorator.pm line 157
MooseX::Types::TypeDecorator::AUTOLOAD('MooseX::Types::TypeDecorator=HASH(0xa2dbed8)',
'AddressBook::Schema::AddressDB') called at
/usr/lib/perl5/Moose/Meta/Attribute.pm line 1259
Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0xa3c5e6c)',
'AddressBook::Schema::AddressDB',
'AddressBook::Model::AddressDB=HASH(0xa4741ac)') called at
/usr/lib/perl5/Moose/Meta/Attribute.pm line 531
Moose::Meta::Attribute::initialize_instance_slot('Moose::Meta::Attribute=HASH(0xa3c5e6c)',
'Moose::Meta::Instance=HASH(0xa474260)',
'AddressBook::Model::AddressDB=HASH(0xa4741ac)', 'HASH(0xa473ea0)') called at
/usr/lib/perl5/Class/MOP/Class.pm line 525
Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0xa2e592c)',
'HASH(0xa473ea0)') called at /usr/lib/perl5/Class/MOP/Class.pm line 498
Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0xa2e592c)',
'HASH(0xa473ea0)') called at /usr/lib/perl5/Moose/Meta/Class.pm line 274
Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0xa2e592c)',
'HASH(0xa473ea0)') called at /usr/lib/perl5/Moose/Object.pm line 28
Moose::Object::new('AddressBook::Model::AddressDB', 'AddressBook',
'HASH(0xa3b7ba4)') called at constructor Catalyst::Model::DBIC::Schema::new
(defined at /home/hengaini/perl5/lib/perl5/Catalyst/Model/DBIC/Schema.pm line
586) line 4
Catalyst::Model::DBIC::Schema::new('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa3b7ba4)') called at
/home/hengaini/perl5/lib/perl5/MooseX/Traits/Pluggable.pm line 139
MooseX::Traits::Pluggable::_build_instance_with_traits('AddressBook::Model::AddressDB',
'AddressBook::Model::AddressDB', 'AddressBook') called at
/home/hengaini/perl5/lib/perl5/MooseX/Traits/Pluggable.pm line 97
MooseX::Traits::Pluggable::new_with_traits('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473c34)') called at
/home/hengaini/perl5/lib/perl5/CatalystX/Component/Traits.pm line 145
CatalystX::Component::Traits::COMPONENT('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473d9c)') called at
/usr/lib/perl5/Class/MOP/Method/Wrapped.pm line 50
Class::MOP::Method::Wrapped::__ANON__('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473d9c)') called at
/usr/lib/perl5/Class/MOP/Method/Wrapped.pm line 91
Catalyst::Model::DBIC::Schema::COMPONENT('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473d9c)') called at
/home/hengaini/perl5/lib/perl5/Catalyst.pm line 2588
eval {...} called at /home/hengaini/perl5/lib/perl5/Catalyst.pm line 2588
Catalyst::setup_component('AddressBook', 'AddressBook::Model::AddressDB')
called at /home/hengaini/perl5/lib/perl5/Catalyst.pm line 2515
Catalyst::setup_components('AddressBook') called at
/home/hengaini/perl5/lib/perl5/Catalyst.pm line 1166
Catalyst::setup('AddressBook') called at
/home/hengaini/Catalyst_201209/AddressBook/script/../lib/AddressBook.pm line 46
require AddressBook.pm called at
/home/hengaini/perl5/lib/perl5/Module/Runtime.pm line 317
Module::Runtime::require_module('AddressBook') called at
/usr/share/perl5/Class/Load.pm line 208
Class::Load::__ANON__() called at /usr/share/perl5/Try/Tiny.pm line 71
eval {...} called at /usr/share/perl5/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0x9e03ff8)', 'Try::Tiny::Catch=REF(0x9ecf644)')
called at /usr/share/perl5/Class/Load.pm line 214
Class::Load::try_load_class('AddressBook', undef) called at
/usr/share/perl5/Class/Load.pm line 73
Class::Load::load_class('AddressBook') called at
/home/hengaini/perl5/lib/perl5/Catalyst/ScriptRole.pm line 83
Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x944abb0)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/Script/Server.pm line 177
Catalyst::Script::Server::__ANON__() called at
/home/hengaini/perl5/lib/perl5/Catalyst/Restarter/Forking.pm line 20
Catalyst::Restarter::Forking::_fork_and_start('Catalyst::Restarter::Forking=HASH(0x9ec865c)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/Restarter.pm line 89
Catalyst::Restarter::run_and_watch('Catalyst::Restarter::Forking=HASH(0x9ec865c)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/Script/Server.pm line 226
Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x944abb0)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/ScriptRunner.pm line 50
Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'AddressBook',
'Server') called at script/addressbook_server.pl line 8"Compilation failed in
require at /home/hengaini/perl5/lib/perl5/Module/Runtime.pm line 317.
at /home/hengaini/perl5/lib/perl5/Catalyst/Script/Server.pm line 177
------------------------------------------------------
My questions:
1. I compare the second chapter code and the third chapter code, they are
as same:
--------------------------------------------------------
$ perl script/myapp_create.pl model TestDatabase DBIC::Schema MyApp::
Schema::TestDatabase create=dynamic dbi:SQLite:tmp/database
$ perl script/addressbook_create.pl model AddressDB DBIC::Schema
AddressBook::Schema::AddressDB create=static dbi:SQLite:database
---------------------------------------------------------
what's my mistake. How to solve this problem.
2. I got a computer bachelor degree in China. In fact, I am a newbie of
Perl and Catalyst. How to study Perl and Catalyst.
Respect your replay.
Thanks!
Thai Heng from China
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/