develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #107726] Filter::Simple with immediately following "no"

Kevin Ryde
January 7, 2012 15:33
[perl #107726] Filter::Simple with immediately following "no"
Message ID:
# New Ticket Created by  Kevin Ryde 
# Please include the string:  [perl #107726]
# in the subject line of all future correspondence about this issue. 
# <URL: >

With recent debian perl 5.14.2, if a Filter::Simple module is turned off
with a "no" immediately after being turned on, like

    use MyFilter;
    no MyFilter;

then the remaining script after the "no" is ignored.  The attached
foo.el script and module show the problem.  Running

    perl foo.el

I expected it to print "this part is not filtered", but it doesn't.  If
you put a blank line after "use MyFilter" it does.

I struck this with Smart::Comments when I'd deleted everything between
use and no, but left those lines intending perhaps to add back some code
there shortly ...

Nosing around Filter::Simple it looks like when the terminator is found
on the very first call of the filter_add() handler, the handler returns
0, which the perl parser perhaps takes to mean EOF, and therefore stops

I expect it ought to return with "no MyFilter" or suitably mangled
terminator, to have that run as code.

Dunno if an empty "use/no" block ought to be shown to the FILTER{} etc
code of the subclass.  I suppose currently a "use MyFilter" immediately
followed by EOF has not called with an empty, so maybe no empties should
be shown to it, by default at least. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About