This is a perennial problem with Maypole, but I'm lucky enough not to
be dealing with one of these cases at the moment. But I'm wondering if
this little tweak might help.
In Maypole::setup,
foreach my $subclass ( @{ $config->classes } )
{
no strict 'refs';
unshift @{ $subclass . "::ISA" }, $config->model;
$config->model->adopt($subclass)
if $config->model->can("adopt");
# Load custom model code, if it exists - nb this must happen after the
# unshift, to allow code attributes to work
eval "use $subclass";
die "Error loading $subclass: $@"
if $@ and $@ !~ /Can\'t locate \S+ in [EMAIL PROTECTED]/;
}
The new code is the 2 lines (eval, die) after the comment.
If you have custom code in table classes, it means you don't need to
load it in the driver.
If you're also using CDBI::Loader (i.e. standard Maypole), then I
think, if you load your table classes in the driver, the loader will
stamp all over their @ISA. In many cases this won't matter, because
usually all you will have in there is the main Maypole model class,
and it gets re-instated in the unshift above. But if you have anything
else in there, it'll be hard to figure out where it's gone.
Anyway, the advantages of this code are:
1) don't need to fill your driver with use MyApp::SomeTable statements
2) don't need to say use base 'MyApp::MainModel' or use base
'Maypole::Model::Base' in each of these table classes to allow them to
contain Exported methods.
I'm just wondering if it might also cut down on the phantom errors.
d.
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel