[Maypole] could 5.6 prevent modules from accessing parent for some reason? (answer)
Kevin
kevin@allpoetry.com
Tue, 06 Jul 2004 18:00:52 -0700
Just answering my own question for the sake of the archives.
Turned out I had an error in the has_a statement in my sub-module, and
when loading it via:
Limitbreak::User->require;
Errors are not shown as they are with use(). Since require is so
perl-4-ish, I hadn't been familiar with that. A better suggestion would
be to use (working from memory here):
Limitbreak::User->require or warn "Unable to load User.pm: $!, $@";
Further complications were also added by Apache::StatINC, since the has_a
methods die() if their functions are already created. I hope to get
around this by wrapping the setup call in an eval to catch errors and
continue re(compilation). I've always found StatINC extremely handy for
testing while developing.
Ciao,
Kevin
On Thu, 24 Jun 2004 12:36:02 -0700, Kevin <kevin-temp2@writesoon.com>
wrote:
> I had tried that as well, and sorry for leaving out the lines at the top
> of Limitbreak/User.pm
>
> #Limitbreka/User.pm#
> package Limitbreak::User;
> use base 'Apache::MVC';
> Limitbreak::User->has_a(user => "Limitbreak::Identity");
>
> Couldn't require Limitbreak - Can't locate object method "has_a" via
> package "Limitbreak::User" (perhaps you forgot to load
> "Limitbreak::User"?) at Limitbreak/User.pm line 4.
>
>
> If concat Limitbreak/User.pm to Limitbreak.pm and take out the 'use'
> part, it loads fine, but this is less than ideal obviously :)
>
> A additional confusion is when I try to add my own method
> package Limitbreak::User;
> use base 'Apache::MVC';
> sub mytest :Exported {
> my ($self, $r) = @_;
> warn "testing, world";
> $r->{template} = "view";
> }
>
> And test it with:
> perl -MMaypole::CLI=Limitbreak -e1 http://localhost/user/test/
>
> I get this error:
> file error - usertest/: not found at
> /usr/lib/perl5/site_perl/5.6.1/Maypole/View/Base.pm line 66.
>
> Seems like maybe its passing through the name (sans /'s) to try and find
> a custom template, even though I set the template back to 'view'? I am
> very confused :)
>
> Thanks,
> Kevin
>
> On Wed, 23 Jun 2004 23:28:58 -0700, Carl Hayter <hayter@usc.edu> wrote:
>
>> On Wed, Jun 23, 2004 at 11:05:47PM -0700, Kevin wrote:
>>> I'm getting the error:
>>>
>>> Couldn't require Limitbreak - Can't locate object method "columns" via
>>> package "Limitbreak::User" (perhaps you forgot to load
>>> "Limitbreak::User"?) at Limitbreak/User.pm line 5.
>>>
>>> I've tried to follow the first recipe here:
>>> http://maypole.simon-cozens.org/doc/Request.html
>>>
>>> #Limitbreak.pm
>>> package Limitbreak;
>>> use base 'Apache::MVC';
>>> use Class::DBI::Loader::Relationship;
>>> Limitbreak->setup("...");
>>>
>>> Limitbreak::User->require;
>>>
>>>
>>> #Limitbreak::User#
>>> Limitbreak::User::untaint_columns ( printable => [qw/username email
>>
>> Limitbreak::User::untaint_columns ( %args )
>> and
>> Limitbreak::User->untaint_columns ( %args )
>>
>> may act differently, try the second way.
>>
>> ----
>> Carl
>
>
>
--
Ciao,
Kevin
Allpoetry.com Community Manager
"Say the word before the rain comes"