in reply to Re: Duh. What am I missing about inherited constructors?
in thread Duh. What am I missing about inherited constructors?
I expected that the call to new would wind-up executing the code in Foo which would, by means of $class->SUPER::, invoke the one in Bar...But it does. What makes you think it doesn't? I cannot deduce the problem from your code snippet.
use 5.010; package Bar; sub new { say "Bar!"; []; } package Foo; use base qw/Bar/; sub new { my $class = shift; say "Foo!"; my $self = $class->SUPER::new(@_); bless $self, $class; return $self; } package main; my $bletch = Foo->new; say ref($bletch); __END__ Foo! Bar! Foo
|
---|