Created
May 17, 2011 23:57
-
-
Save clsn/977701 to your computer and use it in GitHub Desktop.
Trying to filter!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ###### XXX.pm: | |
| #!/usr/bin/perl | |
| package XXX; | |
| use Filter::Simple; | |
| FILTER { | |
| s/MXM/#/g; | |
| } | |
| 1; | |
| ############################ | |
| # Then, tst.pl. Note that at this point it doesn't even trigger the filter: | |
| #!/usr/bin/perl | |
| use strict; | |
| $|=1; | |
| use XXX; | |
| sub dbg { | |
| # print STDERR @_; | |
| } | |
| my $c=0; | |
| for (my $i=0; $i<100_000_000; $i++) { | |
| $c++; | |
| dbg("Debugging $i!\n"); | |
| } | |
| ############################# | |
| # even Deparse doesn't like it. :( But it's fine if I don't use XXX. | |
| # time perl -MO=Deparse tst.pl | |
| #Global symbol "$i" requires explicit package name at tst.pl line 15. | |
| #Unmatched right curly bracket at tst.pl line 16, at end of line | |
| #syntax error at tst.pl line 16, near "}" | |
| #tst.pl had compilation errors. | |
| #use strict 'refs'; | |
| #$| = 1; | |
| #use XXX; | |
| #sub dbg { | |
| # | |
| #} | |
| #my $c = 0; | |
| #$c++; | |
| #dbg "Debugging ${'i'}!\n"; | |
| #; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment