Closed p5pRT closed 11 years ago
This is a bug report for perl from petercmartini@gmail.com -----------------------------------------------------------------
When a prototype is declared inline\, like sub foo( $ $ )\, the extra spaces are removed before the prototype '$$' is attached. Other places in the core that actually handle prototypes assume spaces have already been stripped\, which can lead to subtle bugs\, such as:
perl -MScalar::Util=set_prototype -e 'sub foo{} BEGIN { set_prototype \&foo\, " \$ "; } foo 1;' Not enough arguments for main::foo at -e line 1\, near "1;" Execution of -e aborted due to compilation errors.
Patch attached. I opted to modify a copy of the prototype instead of the prototype directly on the theory that if someone took the time to add extra whitespace\, we'll leave it there for them.
On Mon Jun 24 15:19:41 2013\, pcm wrote:
When a prototype is declared inline\, like sub foo( $ $ )\, the extra spaces are removed before the prototype '$$' is attached. Other places in the core that actually handle prototypes assume spaces have already been stripped\, which can lead to subtle bugs\, such as:
perl -MScalar::Util=set_prototype -e 'sub foo{} BEGIN { set_prototype \&foo\, " \$ "; } foo 1;' Not enough arguments for main::foo at -e line 1\, near "1;" Execution of -e aborted due to compilation errors.
Patch attached. I opted to modify a copy of the prototype instead of the prototype directly on the theory that if someone took the time to add extra whitespace\, we'll leave it there for them.
Thanks\, applied as d16269d8356f921e8939320f5cfd7d08d130c078.
Tony
The RT System itself - Status changed from 'new' to 'open'
@tonycoz - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#118623 (status was 'resolved')
Searchable as RT118623$