So the generic BeerDB looks like this:

package BeerDB;
use Maypole::Application qw(-Debug) ;
BeerDB->config->{application_name}="BeerDB the Incremental Way";
BeerDB->config->uri_base("http://localhost/beer";);
BeerDB->config->template_root("/usr/local/src/beer/templates/");
BeerDB->config->rows_per_page(10);
BeerDB->config->display_tables([qw[beer brewery pub style user]]);
BeerDB->setup('dbi:mysql:beer', 'root', '');
BeerDB::Brewery->has_many(beers => "BeerDB::Beer");
BeerDB::Beer->has_a(brewery => "BeerDB::Brewery");
BeerDB::Style->has_many(beers => "BeerDB::Beer");
BeerDB::Beer->has_a(style => "BeerDB::Style");
BeerDB::Handpump->has_a(beer => "BeerDB::Beer");
BeerDB::Handpump->has_a(pub => "BeerDB::Pub");
BeerDB::Pub->has_many(beers => [ BeerDB::Handpump => 'beer' ]);
# ^^^ dies here
BeerDB::Beer->has_many(pubs => [ BeerDB::Handpump => 'pub' ]);
1;


as you know.

But you need to use strict; and use warnings;

When you do, it dies:

[Wed Nov 16 20:04:03 2005] [error] Bareword "BeerDB::Handpump" not allowed while "strict subs" in use at /usr/local/src/beer/lib// BeerDB.pm line 20.\nBareword "BeerDB::Handpump" not allowed while "strict subs" in use at /usr/local/src/beer/lib//BeerDB.pm line 21. \nCompilation failed in require at (eval 19) line 3.\n

so the horrible hack is to wrap it up in no strict 'subs'; and use strict subs; around the references to BeerDB::Handpump.

But that's pretty ugly.

Is there an ugly bug category on cpan?

Look, if it's a trivial application, and you need to resort to kludges like this to confirm to best practice, and get it going, then it's no good.

Any other test cases you want me to run?

kd


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel

Reply via email to