Fix: empty @_ when calling empty-proto subs without parens
Graham Barr wrote:
<snip>
> OK, so I thought that prototypes in Socket.pm (which is probably
> a good idea) could help here, but... guess what the following
> script outputs
>
> sub fred ()
> {
> warn join(" ",@_);
> }
>
> fred;
> @_ = qw(a b c);
> &fred;
> fred;
> __END__
>
> It outputs ...
>
> Warning: something's wrong at yyy line 3.
> a b c at yyy line 3.
> a b c at yyy line 3.
>
> OK I can belive the second one as it has the & style call (which
> the pod states overrides prototypes) but I was very amazed at
> the last call.
>
> Is this a bug ?? I think so as the pod suggests that a sub defined
> as
>
> sub mytime ();
>
> and a statement such as
>
> mytime +2;
>
> will by the same as
>
> mytime() + 2
>
> but this is not the case, it seems it would be
>
> &mytime(@_) + 2
>
OK, here is a patch which fixes this. It requires a modification
to perly.y and perly.c (I cannot re-generate perly.c here
but it is a simple fix)
it chamges the output of the above script to
Warning: something's wrong at yyy line 3.
Warning: something's wrong at yyy line 3.
a b c at yyy line 3.