Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
This now works:
package Some::Package;
use Sub::Signatures 'strict';
sub new { bless {} => shift }
sub foo($self, ARRAY $bar) {
return sprintf "arrayref with %d elements" => scalar @$bar;
}
sub foo($self, HASH $bar) {
$bar->{this} = 1;
$bar;
}
It doesn't work with subclassing, though. I think we'll have to add a new items to the import list:
use Sub::Signatures qw/methods/; # 'strict' is optional
I'm unsure of how to handle the special case of methods that can be called as both classes and methods. If it's a class name, it defaults to SCALAR. Otherwise, it defaults to the class name. I think I will have to set it up to ignore the type of the first argument with methods unless the programmer explicitly states it. That seems like a nice compromise.
lvalue subs? (Score:2)
Re:lvalue subs? (Score:2)
Argh! I hadn't even considered lvalue subs. I'll have to think about them. At the present time I don't see support for them being offered without someone being gracious enough to send a patch :) (after it gets to the CPAN, of course.)