Uri Guttman wrote:
> 
> >>>>> "SQ" == Sean Quinlan <[EMAIL PROTECTED]> writes:

>   SQ> Work just fine, like expected. Where I'm having trouble is in that new
>   SQ> up there. What I wanted to do is be able to call gripe from inside new,
>   SQ> before $self has been blessed (while I'm validating parameters):
> 
>   SQ> # self as first arg so gripe doesn't need recoding
>   SQ> gripe($self,"Now what?");
> 
> that is a direct sub call and doesn't do any method lookup in the @ISA
> tree.
> 

good catch. 

> if Foo::gripe is written to take a class OR an object (and it could be
> done that way), then you can call it like:
> 
>         Foo->gripe( blah ) ;

you can avoid the hard-coding.

sub new
{
        my $class = shift;

        # blah de blah

        $class->gripe("charlie browns teacher");

        my $obj = \"magic beans here";

        return bless $obj,$class;
}


This would allow you to get around hard coding the class name.


If it DOES need an object, I don't quite understand why
you cant do the bless in new, call gripe, and just return
the object when you're done.

sub new
{
        my $class = shift;
        my [EMAIL PROTECTED];
        bless $obj, $class;

        $obj->gripe("waaah wah whaa waaah");

        $obj->magic_bean_verification;

        return $obj;
}
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to