<div><div id="contentDiv" style="position:relative;font-size:14px;height:auto;padding:15px 15px 10px 15px;z-index:1;zoom:1;line-height:1.7;" class="body"><div id="mailContentContainer" style="height: auto; min-height: 100px; font-size: 14px; padding: 0px; font-family: 'lucida Grande',Verdana; margin-right: 170px;"><div>Everyone:<br>
I am learning catalyst from the book <Catalyst 5.8 the perl MVC framework>. I have finished the two former chapters.<br>
When I study the third chapter <Building a Real Application>, I
can't run the web application. What I have finished as follows:<br>
1. $ catalyst.pl AddressBook<br>
2. $ cpan Catalyst::Controller::FormBuilder Catalyst::Controller::BindLex<br>
3. $ perl script/addressbook_create.pl view HTML TTSite<br>
4. create a sqlite3 database; the database have two tables : people
and addresses. The database's directory is ~/addressbook/tmp/<br>
5. $ perl script/addressbook_create.pl model AddressDB DBIC::Schema
AddressBook::Schema::AddressDB create=static dbi:SQLite:database<br>
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/<br>
AddressDB.pm have the following:><br>
---------------------------------------------<br>
__PACKAGE__->config(<br>
schema_class => 'AddressBook::Schema::AddressDB',<br>
connect_info => ['dbi:SQLite:database',],<br>
);<br>
<br>
---------------------------------------------<br>
I think, maybe I misunderstand the above sentences. The file
AddressDB.pm have no such code. Add or no, the error still.<br>
7. others steps as books ......<br>
<br>
<br>
I run the command : script/addressbook_server.pl -r -d; I get the follows:<br>
------------------------------------------------------<br>
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<br>
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<br>
Compilation failed in require at /home/hengaini/perl5/lib/perl5/Module/Runtime.pm line 317.<br>
at /usr/lib/perl5/Moose/Meta/TypeCoercion.pm line 68<br>
at /usr/share/perl5/MooseX/Types/TypeDecorator.pm line 157<br>
MooseX::Types::TypeDecorator::AUTOLOAD('MooseX::Types::TypeDecorator=HASH(0xa2dbed8)',
'AddressBook::Schema::AddressDB') called at
/usr/lib/perl5/Moose/Meta/Attribute.pm line 1259<br>
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<br>
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<br>
Class::MOP::Class::_construct_instance('Moose::Meta::Class=HASH(0xa2e592c)',
'HASH(0xa473ea0)') called at /usr/lib/perl5/Class/MOP/Class.pm line 498<br>
Class::MOP::Class::new_object('Moose::Meta::Class=HASH(0xa2e592c)',
'HASH(0xa473ea0)') called at /usr/lib/perl5/Moose/Meta/Class.pm line 274<br>
Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0xa2e592c)',
'HASH(0xa473ea0)') called at /usr/lib/perl5/Moose/Object.pm line 28<br>
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<br>
Catalyst::Model::DBIC::Schema::new('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa3b7ba4)') called at
/home/hengaini/perl5/lib/perl5/MooseX/Traits/Pluggable.pm line 139<br>
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<br>
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<br>
CatalystX::Component::Traits::COMPONENT('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473d9c)') called at
/usr/lib/perl5/Class/MOP/Method/Wrapped.pm line 50<br>
Class::MOP::Method::Wrapped::__ANON__('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473d9c)') called at
/usr/lib/perl5/Class/MOP/Method/Wrapped.pm line 91<br>
Catalyst::Model::DBIC::Schema::COMPONENT('AddressBook::Model::AddressDB',
'AddressBook', 'HASH(0xa473d9c)') called at
/home/hengaini/perl5/lib/perl5/Catalyst.pm line 2588<br>
eval {...} called at /home/hengaini/perl5/lib/perl5/Catalyst.pm line 2588<br>
Catalyst::setup_component('AddressBook',
'AddressBook::Model::AddressDB') called at
/home/hengaini/perl5/lib/perl5/Catalyst.pm line 2515<br>
Catalyst::setup_components('AddressBook') called at /home/hengaini/perl5/lib/perl5/Catalyst.pm line 1166<br>
Catalyst::setup('AddressBook') called at /home/hengaini/Catalyst_201209/AddressBook/script/../lib/AddressBook.pm line 46<br>
require AddressBook.pm called at /home/hengaini/perl5/lib/perl5/Module/Runtime.pm line 317<br>
Module::Runtime::require_module('AddressBook') called at /usr/share/perl5/Class/Load.pm line 208<br>
Class::Load::__ANON__() called at /usr/share/perl5/Try/Tiny.pm line 71<br>
eval {...} called at /usr/share/perl5/Try/Tiny.pm line 67<br>
Try::Tiny::try('CODE(0x9e03ff8)', 'Try::Tiny::Catch=REF(0x9ecf644)') called at /usr/share/perl5/Class/Load.pm line 214<br>
Class::Load::try_load_class('AddressBook', undef) called at /usr/share/perl5/Class/Load.pm line 73<br>
Class::Load::load_class('AddressBook') called at /home/hengaini/perl5/lib/perl5/Catalyst/ScriptRole.pm line 83<br>
Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x944abb0)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/Script/Server.pm line
177<br>
Catalyst::Script::Server::__ANON__() called at /home/hengaini/perl5/lib/perl5/Catalyst/Restarter/Forking.pm line 20<br>
Catalyst::Restarter::Forking::_fork_and_start('Catalyst::Restarter::Forking=HASH(0x9ec865c)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/Restarter.pm line 89<br>
Catalyst::Restarter::run_and_watch('Catalyst::Restarter::Forking=HASH(0x9ec865c)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/Script/Server.pm line
226<br>
Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x944abb0)')
called at /home/hengaini/perl5/lib/perl5/Catalyst/ScriptRunner.pm line
50<br>
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.<br>
at /home/hengaini/perl5/lib/perl5/Catalyst/Script/Server.pm line 177<br>
<br>
------------------------------------------------------<br>
<br>
My questions:<br>
1. I compare the second chapter code and the third chapter code, they are as same:<br>
--------------------------------------------------------<br>
$ perl script/myapp_create.pl model TestDatabase DBIC::Schema MyApp::<br>
Schema::TestDatabase create=dynamic dbi:SQLite:tmp/database<br>
$ perl script/addressbook_create.pl model AddressDB DBIC::Schema<br>
AddressBook::Schema::AddressDB create=static dbi:SQLite:database<br>
---------------------------------------------------------<br>
what's my mistake. How to solve this problem.<br>
<br>
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. <br>
<br>
Respect your replay.<br>
Thanks!<br>
Thai Heng from China<br>
<br>
<br>
<br>
<br>
</div> </div></div></div>