Posted by Herbert Poul |
|
EDIT: i started my "log" in the wiki, so i'll move it here..
-------- snip ------ I have now started to look through the catalyst documentation .. hopefully to find out how to start using it :) 1438: ok, since i'm lazy i downloaded the 'CatInABox' tar.gz file.. (containing catalyst 5.7006) extracted it .. and it seems to work .. now get's started with creating an application ;) -------- /snip ------- ok, created a new application: herbert-pouls-computer:~/dev/frameworkcomparison/catalyst herbert$ catalyst.pl BarCrud created "BarCrud" created "BarCrud/script" created "BarCrud/lib" created "BarCrud/root" created "BarCrud/root/static" created "BarCrud/root/static/images" created "BarCrud/t" created "BarCrud/lib/BarCrud" created "BarCrud/lib/BarCrud/Model" created "BarCrud/lib/BarCrud/View" created "BarCrud/lib/BarCrud/Controller" created "BarCrud/barcrud.yml" created "BarCrud/lib/BarCrud.pm" created "BarCrud/lib/BarCrud/Controller/Root.pm" created "BarCrud/README" created "BarCrud/Changes" created "BarCrud/t/01app.t" created "BarCrud/t/02pod.t" created "BarCrud/t/03podcoverage.t" created "BarCrud/root/static/images/catalyst_logo.png" created "BarCrud/root/static/images/btn_120x50_built.png" created "BarCrud/root/static/images/btn_120x50_built_shadow.png" created "BarCrud/root/static/images/btn_120x50_powered.png" created "BarCrud/root/static/images/btn_120x50_powered_shadow.png" created "BarCrud/root/static/images/btn_88x31_built.png" created "BarCrud/root/static/images/btn_88x31_built_shadow.png" created "BarCrud/root/static/images/btn_88x31_powered.png" created "BarCrud/root/static/images/btn_88x31_powered_shadow.png" created "BarCrud/root/favicon.ico" created "BarCrud/Makefile.PL" created "BarCrud/script/barcrud_cgi.pl" created "BarCrud/script/barcrud_fastcgi.pl" created "BarCrud/script/barcrud_server.pl" created "BarCrud/script/barcrud_test.pl" created "BarCrud/script/barcrud_create.pl" herbert-pouls-computer:~/dev/frameworkcomparison/catalyst herbert$ --- Last Edited by Herbert Poul at 2007-11-11 21:29:24 --- Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
great.. launched catalyst, got a nice welcome page:
herbert-pouls-computer:~/dev/frameworkcomparison/catalyst/BarCrud herbert$ script/barcrud_server.pl debug Debug messages enabled debug Loaded plugins: .----------------------------------------------------------------------------. | Catalyst::Plugin::ConfigLoader 0.13 | | Catalyst::Plugin::Static::Simple 0.14 | '----------------------------------------------------------------------------' debug Loaded dispatcher "Catalyst::Dispatcher" debug Loaded engine "Catalyst::Engine::HTTP" debug Found home "/Users/herbert/dev/frameworkcomparison/catalyst/BarCrud" debug Loaded Config "/Users/herbert/dev/frameworkcomparison/catalyst/BarCrud/barcrud.yml" debug Loaded components: .-----------------------------------------------------------------+----------. | Class | Type | +-----------------------------------------------------------------+----------+ | BarCrud::Controller::Root | instance | '-----------------------------------------------------------------+----------' debug Loaded Private actions: .----------------------+--------------------------------------+--------------. | Private | Class | Method | +----------------------+--------------------------------------+--------------+ | /default | BarCrud::Controller::Root | default | | /end | BarCrud::Controller::Root | end | '----------------------+--------------------------------------+--------------' info BarCrud powered by Catalyst 5.7006 You can connect to your server at http://herbert-pouls-computer.local:3000 info *** Request 1 (0.067/s) 396 [Sun Nov 11 14:42:49 2007] *** debug "GET" request for "/" from "192.168.1.3" info Request took 0.056400s (17.730/s) .----------------------------------------------------------------+-----------. | Action | Time | +----------------------------------------------------------------+-----------+ | /default | 0.001194s | | /end | 0.000172s | '----------------------------------------------------------------+-----------' Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
according to the tutorial the first step is to create a SQL structure by hand ..
since it uses DBIx::Class which i've never used before.. i'll try to figure out if there is another way .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
well ok .. i gave up .. i now simply create a new postgresql database and create my tables there .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok, this is what i came up with:
CREATE TABLE bar ( id serial primary key, name varchar(255) not null, location text not null, -- Wifi: n: none, y: yes, p: paid wifi char(1) not null, creationdate timestamp with time zone not null, editdate timestamp with time zone not null -- TODO: Add user relation ); CREATE TABLE beer ( id serial primary key, name varchar(255) not null ); -- n:m relation between bar and beer CREATE TABLE bar_beer ( bar_id integer not null, beer_id integer not null, PRIMARY KEY(bar_id, beer_id) ); CREATE TABLE comment ( id serial primary key, -- TODO: Add user relation postdate timestamp with time zone not null, body text not null ); i still need to figure out how authentication works and how i reference a user .. but anyway .. i'll start with this .. (the same thing is the tutorial doing .. so .. i'm good with it :) ) Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok .. i got a bit distracted by the fact that there are quite a few files that were autogenerated..
so i'm searching for a tool to count the lines ... let's try http://www.dwheeler.com/sloccount/sloccount-2.26.tar.gz Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok, it seems it isn't that bad
SLOC Directory SLOC-by-Language (Sorted) 117 script perl=117 20 lib perl=20 0 misc (none) 0 root (none) 0 t (none) 0 top_dir (none) Totals grouped by language (dominant language first): perl: 137 (100.00%) Total Physical Source Lines of Code (SLOC) = 137 Development Effort Estimate, Person-Years (Person-Months) = 0.02 (0.30) (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05)) Schedule Estimate, Years (Months) = 0.13 (1.58) (Basic COCOMO model, Months = 2.5 * (person-months**0.38)) Estimated Average Number of Developers (Effort/Schedule) = 0.19 Total Estimated Cost to Develop = $ 3,351 (average salary = $56,286/year, overhead = 2.40). so i'll continue with the tutorial Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
umm.. i thought the tutorial was out of date because it told me to create a 'MyAppDB.pm' and 'MyAppDB/' directory to put my "database models" into .. although the script already created a BarCrud/Model/ directory ...
but.. obviously .. it was correct .. it seems those Model class will get auto generated.. anyway .. i'll move my models into BarCrudDB :( Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok .. moved models, added comments model .. ready to go . Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Herbert Poul |
|
ok .. bad news.. obviously the CatInABox didn't come with some required helper classes:
herbert-pouls-computer:~/dev/frameworkcomparison/catalyst/BarCrud herbert$ script/barcrud_create.pl model BarCrudDB DBIC::Schema BarCrudDB dbi:Pg:dbname=cat_barcrud 'test' 'test' '{ AutoCommit => 1 }' exists "/Users/herbert/dev/frameworkcomparison/catalyst/BarCrud/script/../lib/BarCrud/Model" exists "/Users/herbert/dev/frameworkcomparison/catalyst/BarCrud/script/../t" Couldn't load helper "Catalyst::Helper::Model::DBIC::Schema", "Can't locate Catalyst/Helper/Model/DBIC/Schema.pm in @INC (@INC contains: /Users/herbert/dev/frameworkcomparison/catalyst/CatInABox/extlib /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .) at (eval 11) line 3. " at script/barcrud_create.pl line 23 herbert-pouls-computer:~/dev/frameworkcomparison/catalyst/BarCrud herbert$ Hey, we have Signatures !!! Great, isn't it ? ;) |