-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter::Util::Call problem with $_ #9216
Comments
From ambrus@math.bme.huCreated by ambrus@math.bme.huThis is a strange problem with Filter::Util::Call. Here is a perl script use Filter::Util::Call; The above code works as expected: it prints hello world. However, if I modify it by deleting the line with the arrow, I get this: use Filter::Util::Call; This code does not work. It exits with 0 exit code without printing I could reproduce this bug on both perl 5.10.0 linux-x86 and perl 5.8.8 I've first posted the bug at "http://www.perlmonks.com/?node_id=664944" -- Thanks and keep up the good work, Ambrus Perl Info
|
From @steve-m-hayIt is because the anonymous filter sub is supposed to return the The return value of the filter sub is simply a success/failure indicator This is all documented in the Filter::Util::Call manpage: http://search.cpan.org/~pmqs/Filter-1.34/Call/Call.pm#filter()_and_anonymous_sub |
@steve-m-hay - Status changed from 'new' to 'rejected' |
From ambrus@math.bme.hu(note: this is a dupe of a message I sent in email to On Thu Jan 31 08:33:12 2008, shay wrote:
Dear shay, I'm sorry but I don't think your argument stands, and must insist on 1 use Filter::Util::Call; The variable $_ is filled with the original source by the filter_read The first snippet of the code in my bug report (with both line 4 and The second code snippet in the bug report differs from this only in Finally, please note that BrowserUK has a suspicion on what causes Thanks for your patience, Ambrus |
ambrus@math.bme.hu - Status changed from 'rejected' to 'new' |
From ambrus@math.bme.huOn ticket #50430, shay comments at Thu Jan 31 08:33:12 2008:
Dear shay, I'm sorry but I don't think your argument stands, and must insist on 1 use Filter::Util::Call; The variable $_ is filled with the original source by the filter_read The first snippet of the code in my bug report (with both line 4 and The second code snippet in the bug report differs from this only in Finally, please note that BrowserUK has a suspicion on what causes Thanks for your patience, Ambrus |
From @steve-m-hayZsbán Ambrus wrote:
You're quite correct. My apologies for being too hasty before. I'd missed the fact that filter_read sets $_ for you, despite it also being clearly documented.
I had a quick look and I wonder if it is to do with the "local" $_ that is created prior to the perl_call_sv() being made mortal. The debugger shows DEFSV is cleared by the time perl_call_sv() returns, so perhaps a FREETMPS has happened somewhere? (Can ENTER+SAVETMPS / FREETMPS+LEAVE blocks be nested? I've always been a little uneasy with this stuff, and am currently rather rusty too.) Anyway, the attached patch moves the mortalization of the local $_ until just before the FREETMPS, well after the perl_call_sv(), and fixes the bug without breaking any tests. Would somebody with more knowledge of these matters care to comment? |
From @steve-m-hay |
The RT System itself - Status changed from 'new' to 'open' |
From @steve-m-hayMy previous patch is now applied to bleadperl in change 33341. |
@steve-m-hay - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#50430 (status was 'resolved')
Searchable as RT50430$
The text was updated successfully, but these errors were encountered: