[Handel] mp1 database connectivity

Christopher H. Laco claco at chrislaco.com
Wed May 3 14:57:08 CEST 2006


Todd W wrote:
>> Goals
>> ...
>> Get someone to actually use the damn thing. :-)
> 
> k... you've got one :-)

Ha ha. Serves me right. :-)

> 
> This looks like what I need. Something simple enough to grasp the whole 
> thing but still a well planned out way to do it.

You must be talking about another project. :-)

> 
> What I've done so far:
> 
> I got the demo running from the trunk.
> 
> Then I ran:
> 
> script/fundraiser_create.pl Handel::Scaffold dbi:mysql:handel username 
> password


What version of Catalyst are you running? The scaffold/helpers are based
on 5.33, and have some issues under 5.6x... nothing major, just
naming/path issues.


> 
> To set up Handel in my catalyst app. I then copied the index and product 
> templates from the trunk and put them in the catalyst root, and changed the 
> form's action to post to /cart/add
> 
> It works in the Catalyst debugging server, but when I try to run the app 
> from apache, I get the following error when trying to add a product to the 
> cart:
> 
> Caught exception in FundRaiser::Controller::Cart->begin "Can't connect to 
> data source dbname=, no database driver specified and DBI_DSN env var not 
> set at /usr/local/lib/perl5/site_perl/5.8.7/Ima/DBI.pm line 316"
> 
> You can see it at 
> http://fundraiser.waveright.homeip.net/catalog/products.tt2 if you like.
> 
> Not sure why, but evidently using the catalyst server tries to connect one 
> way, and under mod_perl it tries to connect a different way.

I'd suspect something to do with ConfigReader, since it readons from MP
when under MP, and ENV when not under MP, but if you're declaring a
connection, this may be a MP/Apache startup vs. children issue.

> 
> Something that looked strange to me is the calling of ->connection in both 
> the BEGIN block in Handel::DBI and in the Handel::Cart and Handel::Order 
> subclasses.
> 
> My setup:
> 
> Apache 1.3
> perl 5.8.7
> Handel 0.32
> Catalyst 5.68
> RedHat 9
> 
> Here is the server config I'm using:
> 
> <Perl>
>   use lib qw(/home/trwww/FundRaiser/lib);
> </Perl>
> <VirtualHost *>
>   ServerName fundraiser.waveright.homeip.net
>   DocumentRoot /home/trwww/FundRaiser/root
>   ErrorLog /home/trwww/FundRaiser/logs/error_log
>   CustomLog /home/trwww/FundRaiser/logs/access_log common
> 
>   PerlModule     FundRaiser
> 
>   <Location />
>     SetHandler perl-script
>     PerlHandler FundRaiser
>   </Location>
> 
>   <Location /static>
>     SetHandler default-handler
>   </Location>
> 
>   <Files "robots.txt">
>     SetHandler default-handler
>   </Files>
> 
>   <Files "favicon.ico">
>     SetHandler default-handler
>   </Files>
> 
> </VirtualHost>

Hmmm, try loading FundRaiser outside of the virtual, right after you're
use lib.

> 
> I also tried adding:
> 
>   PerlSetVar     HandelDBIDriver   "mysql"
>   PerlSetVar     HandelDBIName     "handel"
>   PerlSetVar     HandelDBIUser     "username"
>   PerlSetVar     HandelDBIPassword "password"
> 
> Above the PerlModule statement, but it gave the same results.
> 
> Thanks in advance for any advice!
> 
> Todd W.

Can you send me a copy of your entire FundRaiser app?
I'll try loading it under my MP install at home....
Unfortunately, I don't have an MP install here at the moment.

-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.rawmode.org/pipermail/handel/attachments/20060503/32a4f3a6/attachment.pgp 


More information about the Handel mailing list