Hi Mark,
It would affect any sub called without parens that takes an anonymous subroutine as a parameter. However, this particular example hit our code using parameterized roles with Moose:
https://metacpan.org/pod/MooseX::Role::Parameterized
which provides the method sub to declare methods.
Are you suggesting that the parameterized role module should use prototypes so that it can take code blocks without the `sub`? That seems possible, although not currently implemented in it, but ideally this module should run on most valid Perl and not require awkward workarounds or modifying of third party modules.
Thanks!
Greg
On Mon Aug 17 11:20:26 2015, MGRIMES wrote:
Show quoted text> Greg,
>
> Can you give me some more color on where this would be used? I am
> aware of issues with anonymous subs, ie:
>
> my $x = {
> bar => func ($param) { say $param },
> };
>
> I would really like to get this working, but it doesn't really fit
> into the existing solution. I've got an open GitHub issue for it.
>
> I'm not certain where the syntax in your example would be used? Which
> package are you getting the method keyword from? How is that different
> from:
>
> method _path { $path }
>
> Thanks,
> Mark
>
>
> On Fri Aug 14 17:31:30 2015, OSCHWALD wrote:
> > Using the 1.04 and the latest Perl::Tidy, tidying of:
> >
> > method _path => sub { $path };
> >
> > fails with:
> >
> > expecting ':' or ';' or '{' after definition or declaration of sub
> > '_path' but saw '='
> >
> > Adding parens to method() stops the error from occurring.
> >
> > Greg