in reply to Re: Re: Re: Foo::Button->new vs. newButton()
in thread Foo::Button->new vs. newButton()
Incidentally, if you wanted to get that syntax elsewhere you could provide an autoload routine:-
sub AUTOLOAD { my $f = $AUTOLOAD; $f=~s/.*:://; if ($f =~ /^new(.*)/) { return $1->new(@_); } else { die "Undefined subroutine: $f"; } }
I don't think it's a very good idea though, and that wouldn't give you a Foo::Button, just a button. Probably not good at all :) You can do all sorts of interesting things with AUTOLOAD
|
|---|