in reply to Re^2: kind of effort required for learning OO perl ?!
in thread kind of effort required for learning OO perl ?!

What double bless...are you referring to this:
sub new { my ($class) = @_; return(bless(dog->new(),$class)); }
?

I borrowed this syntax from the perlbot example:

sub new { my $type = shift; my $self = Bar->new; $self->{'biz'} = 11; bless $self, $type; }
When I checked that $self reference was indeed blessed before it was passed through bless again:
DB<3> p UNIVERSAL::isa($self,'Bar'); 1
What is the harm?

Celebrate Intellectual Diversity

Replies are listed 'Best First'.
Re^4: kind of effort required for learning OO perl ?!
by chromatic (Archbishop) on Jul 29, 2010 at 23:08 UTC

    What does dog->new() return? If you didn't have any new() defined in Bar, what would Bar->new() return?

    I borrowed this syntax from the perlbot example

    Thanks. I'll submit a patch to fix that example code.