in reply to runtime problem
toolic is correct. This is cool though...
sub FakeOO { eval "require $_[0]"; bless \($_[0]), "FakeOO"; } sub FakeOO::AUTOLOAD { my $pkg = ${+shift}; $pkg->can($FakeOO::AUTOLOAD =~ /::(\w+)$/)->(@_); } my $scalar_util = FakeOO("Scalar::Util"); $scalar_util->looks_like_number(123);
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: runtime problem
by ColonelPanic (Friar) on Nov 15, 2012 at 10:29 UTC | |
Re^2: runtime problem
by jonagondos (Novice) on Nov 14, 2012 at 20:00 UTC |
In Section
Seekers of Perl Wisdom