[Catalyst] Issue with Tutorial section 3

rpnoble rpnoble at ibksoftware.com
Tue Dec 23 07:56:41 GMT 2008

I have found out the issue. I'll post what I did here to help the next

What I did wrong
I followed all steps in Tutorial 3, up to the following step:

script/myapp_create.pl model DB DBIC::Schema MyApp::Schema create=dynamic

what I did not realize was that I left open my SQLite database in SQLlitSpy
and this locked the database, keeping the create.pl script from reading the
schema. The output from the create.pl helper script was:

 exists "C:\__Catalyst\MyApp\lib\MyApp\Model"
 exists "C:\__Catalyst\MyApp\t"
created "C:\__Catalyst\MyApp\lib\MyApp\Model\DB.pm"
created "C:\__Catalyst\MyApp\t\model_DB.t"

Notice there is no schema.pm created. I saw that SQLiteSpy was opened, I
closed it down. I then ran the create.pl helper script again. I got the same
responce with DB.pm rename .new.

The solution
To fix the problem of the Schema folder/directory not being created was to
delete the MyApp folder and start over. This time without the SQLite databse
locked. The script/myapp_create.pl model DB DBIC::Schema MyApp::Schema
create=dynamic dbi:SQLite:myapp.db then created the output expected. 

create.pl output below:
 exists "C:\__Catalyst\MyApp\lib\MyApp\Model"
 exists "C:\__Catalyst\MyApp\t"
 exists "C:\__Catalyst\MyApp\lib\MyApp"
created "C:\__Catalyst\MyApp\lib\MyApp\Schema.pm"
created "C:\__Catalyst\MyApp\lib\MyApp\Model\DB.pm"
created "C:\__Catalyst\MyApp\t\model_DB.t"

Lesson learned
The create helper script can not detect that the database is locked and
therefore skips the Schema creation. Also after the database is unlocked the
helper script can't re-run with the expected results. It seams to stay in
the locked state.  This means that the create.pl helper can only be run once
in the build process.

I'll be making working copies to allow me to roll back any changes/mistakes
I make.

I hope this helps the next person. Also is there a method to roll back any
changes mage by the create.pl helper script?

rpnoble wrote:
> In following the Catalyst tutorial for section 3. I can't get catalyst to
> create the schema folder. I run the following command:
> perl scripit/myapp_create.pl model DB DBIC::Schema MyApp::Schema
> creat=dynamic dbi:SQLite:myapp.db
> I get the following results:
>  exists "C:\__Catalyst\MyApp\lib\MyApp\Model"
>  exists "C:\__Catalyst\MyApp\t"
> created "C:\__Catalyst\MyApp\lib\MyApp\Model\DB.pm"
> created "C:\__Catalyst\MyApp\t\model_DB.t"
> but the schema folder and schema.pm file is not created. When I attempt to
> run the tets server i get the following message:
> C:\__Catalyst\MyApp>perl script/myapp_server.pl
> Couldn't instantiate component "MyApp::Model::DB", "Cannot load schema
> class 'My
> App::Schema': Can't locate MyApp/Schema.pm in @INC (@INC contains:
> C:/__Catalyst
> /MyApp/script/../lib C:/Perl/site/lib C:/Perl/lib .) at
> C:/Perl/site/lib/Catalys
> t/Model/DBIC/Schema.pm line 295.
>  at script/myapp_server.pl line 55" at script/myapp_server.pl line 55
> Compilation failed in require at script/myapp_server.pl line 55.
> Am I missing somthing?
> My enviroment is:
> Windows XP sp2
> ActiveState Perl 5.8.8 v 819
> Catalyst modules
> ┌───────────────────────────────┬────────┬───────────────────────────────┬────┐
> │name                                    │version │abstract                      
> │area│
> ├───────────────────────────────┼────────┼───────────────────────────────┼────┤
> │Catalyst-Action-RenderView         │0.08    │Sensible default end action.  
> │site│
> │Catalyst-Component-InstancePer»│0.001001│Moose role to create only one
> »│site│
> │Catalyst-Devel                           │1.08    │Catalyst Development
> Tools     │site│
> │Catalyst-Model-DBI                     │0.20    │DBI Model Class               
> │site│
> │Catalyst-Model-DBI-SQL-Library    │0.15    │SQL::Library DBI Model Class  
> │site│
> │Catalyst-Model-DBIC                   │0.16    │(DEPRECATED) DBIC Model
> Class  │site│
> │Catalyst-Model-DBIC-Plain            │0.02    │DBIC Model Class              
> │site│
> │Catalyst-Model-DBIC-Schema        │0.21    │DBIx::Class::Schema Model
> Class│site│
> │Catalyst-Model-DBIC-Schema-Que»│0.05    │DBIx::Class::QueryLog Model
> Cl»│site│
> │Catalyst-Plugin-ConfigLoader         │0.21    │Load config files of
> various t»│site│
> │Catalyst-Plugin-StackTrace           │0.09    │Display a stack trace on
> the d»│site│
> │Catalyst-Plugin-Static-Simple         │0.20    │Make serving static pages
> pain»│site│
> │Catalyst-Runtime                          │5.7015  │Catalyst  Runtime
> version      │site│
> │Catalyst-View-TT                        │0.27    │Template View Class           
> │site│
> └───────────────────────────────┴────────┴───────────────────────────────┴────┘
> Thanks for your help....

View this message in context: http://www.nabble.com/Issue-with-Tutorial-section-3-tp21139137p21140874.html
Sent from the Catalyst Web Framework mailing list archive at Nabble.com.

More information about the Catalyst mailing list