You cannot have binding of methods before INIT because the type of invocant is determined at runtime
I beg to differ :-)
#! /usr/bin/perl use strict; use warnings; INIT { print "in INIT\n"; print "out INIT\n"; } BEGIN { print "in BEGIN\n"; { package Foo; sub new { bless {}, shift }; sub foo { print "I'm a ", shift, "\n"}; } Foo->new->foo; print "out BEGIN\n"; } __END__ in BEGIN I'm a Foo=HASH(0x181af90) out BEGIN in INIT out INIT
In reply to Re^2: compile or run-time inheritance
by adrianh
in thread compile or run-time inheritance
by sh1tn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |