On 11/16/05, Kieren Diment <[EMAIL PROTECTED]> wrote:
> 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.
No. This error means you have a bare string, and you need to put it in
quotes. Theoretically, the => should automagically enquote the string
to its left, but in certain versions of Perl, I've seen this fail. So
say "BeerDB::Handpump" instead of BeerDB::Handpump
d.
-------------------------------------------------------
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_idv28&alloc_id845&op=click
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel