Skip Menu |

This queue is for tickets about the Method-Signatures-Simple CPAN distribution.

Report information
The Basics
Id: 78690
Status: open
Priority: 0/
Queue: Method-Signatures-Simple

People
Owner: Nobody in particular
Requestors: perl [...] toby.ink
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.02
Fixed in: (no value)



Subject: Allow multiple shifts
It would be nice to be able to shift more than one argument off the front of a sub. I'm currently doing this: Method::Signatures::Simple::->install_methodhandler( into => $caller, name => 'handle', invocant => '$self = shift; my $ctxt', ); ... which although rather hackish, does actually work. I'd much prefer to be able to write: Method::Signatures::Simple::->install_methodhandler( into => $caller, name => 'handle', invocant => ['$self', '$ctxt'], ); If you agree with the idea in principle, then let me know as I'm happy to supply a patch.
On Tue Jul 31 08:30:21 2012, TOBYINK wrote: Show quoted text
> It would be nice to be able to shift more than one argument off the > front of a sub. I'm currently doing this: > > Method::Signatures::Simple::->install_methodhandler( > into => $caller, > name => 'handle', > invocant => '$self = shift; my $ctxt', > ); > > ... which although rather hackish, does actually work. I'd much prefer > to be able to write: > > Method::Signatures::Simple::->install_methodhandler( > into => $caller, > name => 'handle', > invocant => ['$self', '$ctxt'], > ); > > If you agree with the idea in principle, then let me know as I'm happy > to supply a patch.
I don't have a use-case for it myself, but I can see it being useful in Catalyst apps, for example. I'd be happy to review a patch for this. The repo is on Github. rhesa
Pull request at https://github.com/rhesa/method-signatures-simple/pull/2 The patch allows multiple invocants as an arrayref a la: use Method::Signatures::Simple invocants => [qw( $self $c )]; And also: method some_routine ($self, $c: $param1) { ... } It includes (somewhat sketchy) documentation, and a test case.