[Catalyst-dev] Tutorial Fails under Apache Mod_Perl

William Anderson william_anderson at yahoo.com
Thu Dec 5 20:11:35 GMT 2013

Hi all,

I found the cause of my problems.

While chasing down the bug into Catalyst::Authentication::Credential::Passw=
I find that this creates a user object via $realm->find_user($userfindauthi=
nfo, $c);
this is a Catalyst::Authentication::Realm::SimpleDB, with a hashref appened
to it. The object is returned if a matching user is found, and undef is =

returned if no matching user is found. =

Note that while doing this, I first logged out of the test site with port 3=
and logged back in successfully. I then reloaded the root url for the =

"production" site at port 80, and found that I was logged in. I then went t=
o the =

/books/list page, and was rewarded with a different crash:
=A0=A0=A0 DBIx::Class::Storage::DBI::catch {...} (): DBI Connection failed: =

=A0=A0=A0 DBI connect('myapp.db','',...) failed: unable to open database fi=
le =

=A0=A0=A0 at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1395. at =

=A0=A0=A0 /home/onestopw/lib/MyApp/Controller/Books.pm line 44

Ah Ha!! The root of my problem is the PWD value, and the location where
the application will look for the files that it is supposed to use. The scr=
ipt myapp_server.pl inherits the PWD from the shell it is run from. =

And its that simple!!! apache mod_perl has a different PWD value, and it wa=
s not
finding the database file. Rather then crashing outright when this error oc=
the Catalyst MyApp ran until the model objects tried to access the database=
 and, because the file could not be found, crashing in wierd and hard to de=
bug ways. =

To fix, simply specify the full file system path to the myapp.db file. This=
 is likely to be a problem with ALL filesystem objects that the application=
 wants to use.

This simple, stupid, problem could be avoided if, during startup Catalyst c=
hecks to see if we can actually see, open, touch the database (file or serv=
er), and if not, fail in some way that makes it obvious that it can not see=
 the database. Actually, I would go so far to say that this is a bug and th=
at this should=A0 be fixed it Catalyst.=A0 =

Anyway, I love open source sofware because I can dig in and fix problems li=
ke this without calling the vendor's technical support.

Thank You,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst-dev/attachments/20131205/7=

More information about the Catalyst-dev mailing list