U
Unknown Poster
I don't see how this not only compiles under Perl 5.6.1, but the call to
init() in the Parent class works, with a scalar or bareword that refers
to nothing. (It fails if there is no invocant at all.) Why is the call
seen below considered OK by the compiler?
-------------------
package Child;
use base("Parent");
use strict;
use warnings;
sub new
{
my $i = shift;
my $hr = x->SUPER::init(); #or even $x
my $s = {%$hr, count => 0, label => 'none'};
return bless $s, ref($i) || $i;
}
..
..
..
init() in the Parent class works, with a scalar or bareword that refers
to nothing. (It fails if there is no invocant at all.) Why is the call
seen below considered OK by the compiler?
-------------------
package Child;
use base("Parent");
use strict;
use warnings;
sub new
{
my $i = shift;
my $hr = x->SUPER::init(); #or even $x
my $s = {%$hr, count => 0, label => 'none'};
return bless $s, ref($i) || $i;
}
..
..
..