in reply to Are codefilters restricted to valid code?

I'm not sure that Filter::Simple is supposed to work with both, the filtering code and the filtered code in one file. I've split up your code into two files and then changed executable_no_comments to code and now it works :)

#!/usr/bin/perl package LanX; use strict; use Filter::Simple; my $transform = sub { warn "$_"; s{ X(\w+)\[ } {\$$1->\[}xg; s{ X(\w+) } {\$$1}xg; warn "=> $_"; $_; }; FILTER_ONLY "code" => $transform; #FILTER_ONLY "executable_no_comments" => $transform; 1;

and

#!/usr/bin/perl #use strict; BEGIN { require '732082-f.pm'; LanX->import(); }; Xarr=[1..3]; print "@Xarr";

Replies are listed 'Best First'.
Re^2: Are codefilters restricted to valid code?
by LanX (Saint) on Dec 22, 2008 at 15:05 UTC
    Thx Max! 8 )

    I got confused with the All-in-one_interface (and my personal x-mas-virus ... cough!!! ; )

    Unfortunately "executable_no_comments" doesn't work, changing to "code" seems neccessary!

    Cheers Rolf

    UPDATE while general codefilters are executed before parsing , most of the FILTER_ONLY options in Filter::Simple rely on valid code (which in general makes sense, but surprises in this example...)