From: Jarkko Hietaniemi Date: Fri, 17 May 2002 02:56:14 +0000 (+0000) Subject: Upgrade to Filter::Simple 0.78. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=55909bcd913ef5a79a5a982c1ba7f83a08b9b651;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Filter::Simple 0.78. (Keep #14432, let Damian know of it.) p4raw-id: //depot/perl@16641 --- diff --git a/lib/Filter/Simple.pm b/lib/Filter/Simple.pm index e68fca1..1ab5b98 100644 --- a/lib/Filter/Simple.pm +++ b/lib/Filter/Simple.pm @@ -4,7 +4,7 @@ use Text::Balanced ':ALL'; use vars qw{ $VERSION @EXPORT }; -$VERSION = '0.77'; +$VERSION = '0.78'; use Filter::Util::Call; use Carp; @@ -20,7 +20,7 @@ sub import { sub FILTER (&;$) { my $caller = caller; my ($filter, $terminator) = @_; - no warnings 'redefine'; + local $SIG{__WARN__} = sub{}; *{"${caller}::import"} = gen_filter_import($caller,$filter,$terminator); *{"${caller}::unimport"} = gen_filter_unimport($caller); } @@ -98,6 +98,7 @@ my %selector_for = ( sub gen_std_filter_for { my ($type, $transform) = @_; return sub { my (@pieces, $instr); + $DB::single=1; for (extract_multiple($_,$extractor_for{$type})) { if (ref()) { push @pieces, $_; $instr=0 } elsif ($instr) { $pieces[-1] .= $_ } @@ -388,6 +389,8 @@ In other words, the previous example, would become: 1 ; +Note that the source code is passed as a single string, so any regex that +uses C<^> or C<$> to detect line boundaries will need the C flag. =head2 Disabling or changing behaviour @@ -453,7 +456,7 @@ or: } { terminator => "" }; -B be contained on a single source line.> @@ -525,7 +528,7 @@ For example: FILTER_ONLY code => sub { s/BANG\s+BANG/die 'BANG' if \$BANG/g }, - quotelike => sub { s/BANG\s+BANG/CHITTY CHITYY/g }; + quotelike => sub { s/BANG\s+BANG/CHITTY CHITTY/g }; The C<"code"> subroutine will only be used to filter parts of the source code that are not quotelikes, POD, or C<__DATA__>. The C @@ -573,7 +576,7 @@ found in the source code. Note that you can also apply two or more of the same type of filter in a single C. For example, here's a simple macro-preprocessor that is only applied within regexes, -with a final debugging pass that printd the resulting source code: +with a final debugging pass that prints the resulting source code: use Regexp::Common; FILTER_ONLY @@ -651,7 +654,7 @@ C subroutine you might have explicitly declared. However, Filter::Simple is smart enough to notice your existing C and Do The Right Thing with it. -That is, if you explcitly define an C subroutine in a package +That is, if you explicitly define an C subroutine in a package that's using Filter::Simple, that C subroutine will still be invoked immediately after any filter you install. diff --git a/lib/Filter/Simple/README b/lib/Filter/Simple/README index 832643d..5ec13de 100644 --- a/lib/Filter/Simple/README +++ b/lib/Filter/Simple/README @@ -1,5 +1,5 @@ ============================================================================== - Release of version 0.77 of Filter::Simple + Release of version 0.78 of Filter::Simple ============================================================================== @@ -46,10 +46,20 @@ COPYRIGHT ============================================================================== -CHANGES IN VERSION 0.77 +CHANGES IN VERSION 0.78 - - Re-allowed user-defined terminators to be regexes + - Re-corified test modules in line with Jarkko's new scheme + + - Various POD nits unknitted (thanks Autrijus) + + - Added the missing DotsForArrows.pm demo file (thanks Autrijus) + + - Added support for Perl 5.005 + + - added prereq for Text::Balanced in Makefile.PL + + - Added note about use of /m flag when using ^ or $ in filter regexes ============================================================================== diff --git a/lib/Filter/Simple/t/data.t b/lib/Filter/Simple/t/data.t index c90702b..8d58046 100644 --- a/lib/Filter/Simple/t/data.t +++ b/lib/Filter/Simple/t/data.t @@ -1,7 +1,7 @@ BEGIN { if ($ENV{PERL_CORE}) { chdir('t') if -d 't'; - @INC = qw(lib/Filter/Simple ../lib); + @INC = qw(lib/Filter/Simple ../lib); } } diff --git a/lib/Filter/Simple/t/export.t b/lib/Filter/Simple/t/export.t index 805a67a..40c62da 100644 --- a/lib/Filter/Simple/t/export.t +++ b/lib/Filter/Simple/t/export.t @@ -1,7 +1,7 @@ BEGIN { if ($ENV{PERL_CORE}) { chdir('t') if -d 't'; - @INC = qw(lib/Filter/Simple ../lib); + @INC = qw(lib/Filter/Simple ../lib); } } diff --git a/lib/Filter/Simple/t/filter.t b/lib/Filter/Simple/t/filter.t index d971b81..f1d71d9 100644 --- a/lib/Filter/Simple/t/filter.t +++ b/lib/Filter/Simple/t/filter.t @@ -1,7 +1,7 @@ BEGIN { if ($ENV{PERL_CORE}) { chdir('t') if -d 't'; - @INC = qw(lib/Filter/Simple ../lib); + @INC = qw(lib/Filter/Simple ../lib); } } diff --git a/lib/Filter/Simple/t/filter_only.t b/lib/Filter/Simple/t/filter_only.t index 9f81a3c..e537609 100644 --- a/lib/Filter/Simple/t/filter_only.t +++ b/lib/Filter/Simple/t/filter_only.t @@ -1,7 +1,7 @@ BEGIN { if ($ENV{PERL_CORE}) { chdir('t') if -d 't'; - @INC = qw(lib/Filter/Simple ../lib); + @INC = qw(lib/Filter/Simple ../lib); } } diff --git a/lib/Filter/Simple/t/import.t b/lib/Filter/Simple/t/import.t index 99306de..d087692 100644 --- a/lib/Filter/Simple/t/import.t +++ b/lib/Filter/Simple/t/import.t @@ -1,7 +1,7 @@ BEGIN { if ($ENV{PERL_CORE}) { chdir('t') if -d 't'; - @INC = qw(lib/Filter/Simple ../lib); + @INC = qw(lib/Filter/Simple ../lib); } }