[Maypole] CGI::Maypole oddity - import()

From: Dave Howorth (dhoworth at mrc-lmb.cam.ac.uk)
Date: Thu Jan 27 2005 - 14:40:05 GMT


I've been trying to track down a weird bug. I had a problem with my
Maypole app, so to isolate it I ran it under Maypole::CLI. Instead of
helping diagnose the first problem, it gave me completely different
behaviour! I've just tracked down the cause and thought I'd record it
in case it helps anybody else (or me in another six months :)

The problem turns out to be my BeerDB::import() method. I've written one
and it works just fine, but Maypole::CLI never calls it! Checking, it
looks like Apache::MVC wouldn't call it either. CGI::Maypole calls it
because my beer.cgi looks like the standard documented one:

      #!/usr/bin/perl -w
      use strict;
      use BeerDB;
      BeerDB->run();

For consistency, I guess we ought to change the doc and the manual to say:

      #!/usr/bin/perl -w
      use strict;
      require BeerDB;
      BeerDB->run();

and add a warning.

FWIW, the reason I have an import method is that I also run
free-standing programs that use the module. Database loaders, for
example. They are able to configure it properly - mainly the db
connection - by saying:

      use BeerDB ('some parameters');

and then make use of all the Class::DBI-based features. I've now
overridden Maypole::init to call my import method until a better
solution occurs to me.

Now I can get back to my original problem ...

Cheers, Dave

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT