OK, I have this method, gripe, in my base class (Foo) which does some
verbosity sensitive error message control. I have another class
(Foo::Bar) that base's the first.

package Foo::Bar;
use base(Foo);

Now in my code things like:

$baz = Foo::Bar->new();
$baz->gripe("What happened?");

Work just fine, like expected. Where I'm having trouble is in that new
up there. What I wanted to do is be able to call gripe from inside new,
before $self has been blessed (while I'm validating parameters):

# self as first arg so gripe doesn't need recoding
gripe($self,"Now what?");

But that doesn't work. Now I thought use'ing base meant it inherited all
of the base class' methods. But apparently it can't find them until
after the object hass been blessed and gripe is called in OOP syntax
$self->gripe("yeah yeah yeah");.

So now, in my nice new OOP set of modules, I find myself having to use
exporter and export this function, and in my subclasses I need to do:

use base(Foo);
use Foo;

I find this incredibly annoying! Ugly! Inelegant! Am I missing
something? Am I really going to have to import those methods the
old-fashioned way? If anyone has suggestion to have this work the way I
expected, or an elegant way to accomplish this, I'd appriciate it. So
far my only alternate idea is to bless $self right away but not return
it unless validation passes.

If not, could those on the list working on newer versions of Perl kindly
fix this please. Or explain why this has to be (preferably in samll
words)? Thanks!

-- 
Sean Quinlan <[EMAIL PROTECTED]>

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to