[Handel] mp1 database connectivity

Todd W trwww at sbcglobal.net
Wed May 3 14:12:46 CEST 2006


> Goals
> ...
> Get someone to actually use the damn thing. :-)

k... you've got one :-)

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

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

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.

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>

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.




More information about the Handel mailing list