Yiyi Hu skribis 2005-10-28 3:17 (+0800):
> class A {
> has $.b;
> method show { "$.b".say };
> };
> A( b => 5 ).show;`
This is how some other language construct objects, but not how Perl does
it. In other words: you should not want this.
Perhaps it is possible to have a class export a sub to its "use"r.
class A {
has $.b handles { 'show' => 'say' };
eval "sub $?CLASS is export { $?CLASS.new(\$?ARGS) }";
}
Not sure about the existence of $?ARGS, or how else to write it. Well,
@_, but the signature might be different.
Juerd
--
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html
http://convolution.nl/gajigu_juerd_n.html