Mailinglist Archive: opensuse-commit (1212 mails)
| < Previous | Next > |
commit perl-Filter for openSUSE:Factory
- From: root@xxxxxxxxxxxxxxx (h_root)
- Date: Mon, 03 Aug 2009 19:39:07 +0200
- Message-id: <20090803173907.E7DB7637B@xxxxxxxxxxxxxxx>
Hello community,
here is the log from the commit of package perl-Filter for openSUSE:Factory
checked in at Mon Aug 3 19:39:07 CEST 2009.
--------
--- perl-Filter/perl-Filter.changes 2009-03-09 13:00:06.000000000 +0100
+++ /mounts/work_src_done/STABLE/perl-Filter/perl-Filter.changes
2009-08-03 16:50:02.000000000 +0200
@@ -1,0 +2,6 @@
+Mon Aug 3 15:50:48 CEST 2009 - anicka@xxxxxxx
+
+- update to 1.37
+ * No new feature or bug fixes - just sync with perl core.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
Filter-1.36-Call.diff
Filter-1.36.diff
Filter-1.36.tar.bz2
New:
----
Filter-1.37-Call.diff
Filter-1.37.diff
Filter-1.37.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Filter.spec ++++++
--- /var/tmp/diff_new_pack.l8yxby/_old 2009-08-03 19:38:59.000000000 +0200
+++ /var/tmp/diff_new_pack.l8yxby/_new 2009-08-03 19:38:59.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package perl-Filter (Version 1.36)
+# spec file for package perl-Filter (Version 1.37)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: perl-Filter
-Version: 1.36
+Version: 1.37
Release: 1
Requires: perl = %{perl_version}
AutoReqProv: on
Group: Development/Libraries/Perl
-License: Artistic License
+License: Artistic License ..
Url: http://cpan.org/modules/by-module/Filter/
Summary: Source Filters
Source: Filter-%{version}.tar.bz2
++++++ Filter-1.36-Call.diff -> Filter-1.37-Call.diff ++++++
++++++ Filter-1.36-Call.diff -> Filter-1.37.diff ++++++
--- perl-Filter/Filter-1.36-Call.diff 2009-03-09 13:00:16.000000000 +0100
+++ /mounts/work_src_done/STABLE/perl-Filter/Filter-1.37.diff 2009-08-03
16:50:01.000000000 +0200
@@ -1,10 +1,16 @@
---- Makefile.PL
-+++ Makefile.PL
-@@ -12,7 +12,6 @@
- use strict;
+--- decrypt/decr
++++ decrypt/decr
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
- my @files = qw( filter-util.pl
-- Call/Call.pm
- Exec/Exec.pm
- decrypt/decrypt.pm decrypt/decr decrypt/encrypt
- tee/tee.pm
+ # This script will decrypt a Perl script that has been encrypted using the
+ # "encrypt" script. It cannot decrypt any other kind of encrypted Perl script.
+--- examples/filtdef
++++ examples/filtdef
+@@ -1,4 +1,4 @@
+-#!/usr/local/bin/perl
++#!/usr/bin/perl
+
+ use strict ;
+ use warnings ;
++++++ Filter-1.36.tar.bz2 -> Filter-1.37.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Filter-1.36/Changes new/Filter-1.37/Changes
--- old/Filter-1.36/Changes 2009-02-28 12:03:42.000000000 +0100
+++ new/Filter-1.37/Changes 2009-06-10 00:20:23.000000000 +0200
@@ -301,3 +301,8 @@
----
* Fixed install issue [RT #28232]
+
+1.37 9 June 2009
+----
+
+ * No new feature or bug fixes - just sync with perl core.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Filter-1.36/META.yml new/Filter-1.37/META.yml
--- old/Filter-1.36/META.yml 2009-02-28 12:11:19.000000000 +0100
+++ new/Filter-1.37/META.yml 2009-06-10 00:21:05.000000000 +0200
@@ -1,10 +1,21 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Filter
-version: 1.36
-version_from:
-installdirs: perl
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+--- #YAML:1.0
+name: Filter
+version: 1.37
+abstract: Source Filters
+author:
+ - Paul Marquess <pmqs@xxxxxxxx>
+license: perl
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires: {}
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.52
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Filter-1.36/Makefile.PL new/Filter-1.37/Makefile.PL
--- old/Filter-1.36/Makefile.PL 2009-02-28 12:06:44.000000000 +0100
+++ new/Filter-1.37/Makefile.PL 2009-06-08 23:42:05.000000000 +0200
@@ -50,7 +50,7 @@
WriteMakefile(
NAME => 'Filter',
- VERSION => '1.36',
+ VERSION => '1.37',
'linkext' => {LINKTYPE => ''},
'dist' => {COMPRESS=>'gzip', SUFFIX=>'gz',
DIST_DEFAULT => 'tardist'},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Filter-1.36/filter-util.pl
new/Filter-1.37/filter-util.pl
--- old/Filter-1.36/filter-util.pl 2009-02-28 12:06:51.000000000 +0100
+++ new/Filter-1.37/filter-util.pl 2009-06-10 00:19:29.000000000 +0200
@@ -45,6 +45,7 @@
$Inc = '' ;
foreach (@INC)
{ $Inc .= "\"-I$_\" " }
+$Inc = "-I::lib" if $^O eq 'MacOS';
$Perl = '' ;
$Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Filter-1.36/perlfilter.pod
new/Filter-1.37/perlfilter.pod
--- old/Filter-1.36/perlfilter.pod 2001-02-18 21:26:05.000000000 +0100
+++ new/Filter-1.37/perlfilter.pod 2009-06-08 23:33:15.000000000 +0200
@@ -1,7 +1,6 @@
=head1 NAME
perlfilter - Source Filters
-
=head1 DESCRIPTION
@@ -19,12 +18,10 @@
=head1 CONCEPTS
Before the Perl interpreter can execute a Perl script, it must first
-read it from a file into memory for parsing and compilation. (Even
-scripts specified on the command line with the C<-e> option are stored in
-a temporary file for the parser to process.) If that script itself
-includes other scripts with a C<use> or C<require> statement, then each
-of those scripts will have to be read from their respective files as
-well.
+read it from a file into memory for parsing and compilation. If that
+script itself includes other scripts with a C<use> or C<require>
+statement, then each of those scripts will have to be read from their
+respective files as well.
Now think of each logical connection between the Perl parser and an
individual file as a I<source stream>. A source stream is created when
@@ -57,7 +54,7 @@
A source filter is a special kind of Perl module that intercepts and
modifies a source stream before it reaches the parser. A source filter
-changes the our diagram like this:
+changes our diagram like this:
file ----> filter ----> parser
@@ -84,18 +81,17 @@
modules, a source filter is invoked with a use statement.
Say you want to pass your Perl source through the C preprocessor before
-execution. You could use the existing C<-P> command line option to do
-this, but as it happens, the source filters distribution comes with a C
-preprocessor filter module called Filter::cpp. Let's use that instead.
+execution. As it happens, the source filters distribution comes with a C
+preprocessor filter module called Filter::cpp.
Below is an example program, C<cpp_test>, which makes use of this filter.
Line numbers have been added to allow specific lines to be referenced
easily.
- 1: use Filter::cpp ;
+ 1: use Filter::cpp;
2: #define TRUE 1
- 3: $a = TRUE ;
- 4: print "a = $a\n" ;
+ 3: $a = TRUE;
+ 4: print "a = $a\n";
When you execute this script, Perl creates a source stream for the
file. Before the parser processes any of the lines from the file, the
@@ -125,18 +121,18 @@
The parser then sees the following code:
- use Filter::cpp ;
- $a = 1 ;
- print "a = $a\n" ;
+ use Filter::cpp;
+ $a = 1;
+ print "a = $a\n";
Let's consider what happens when the filtered code includes another
module with use:
- 1: use Filter::cpp ;
+ 1: use Filter::cpp;
2: #define TRUE 1
- 3: use Fred ;
- 4: $a = TRUE ;
- 5: print "a = $a\n" ;
+ 3: use Fred;
+ 4: $a = TRUE;
+ 5: print "a = $a\n";
The C<cpp> filter does not apply to the text of the Fred module, only
to the text of the file that used it (C<cpp_test>). Although the use
@@ -163,7 +159,7 @@
possible to stack a uudecode filter and an uncompression filter like
this:
- use Filter::uudecode ; use Filter::uncompress ;
+ use Filter::uudecode; use Filter::uncompress;
M'XL(".H<US4''V9I;F%L')Q;>7/;1I;_>_I3=&E=%:F*I"T?22Q/
M6]9*<IQCO*XFT"0[PL%%'Y+IG?WN^ZYN-$'J.[.JE$,20/?K=_[>
...
@@ -200,7 +196,7 @@
C<decrypt> filter (which unscrambles the source before Perl parses it)
included with the source filter distribution is an example of a C
source filter (see Decryption Filters, below).
-
+
=over 5
@@ -248,9 +244,9 @@
Here is an example script that uses C<Filter::sh>:
- use Filter::sh 'tr XYZ PQR' ;
- $a = 1 ;
- print "XYZ a = $a\n" ;
+ use Filter::sh 'tr XYZ PQR';
+ $a = 1;
+ print "XYZ a = $a\n";
The output you'll get when the script is executed:
@@ -277,23 +273,23 @@
becomes M.)
- package Rot13 ;
+ package Rot13;
- use Filter::Util::Call ;
+ use Filter::Util::Call;
sub import {
- my ($type) = @_ ;
- my ($ref) = [] ;
- filter_add(bless $ref) ;
+ my ($type) = @_;
+ my ($ref) = [];
+ filter_add(bless $ref);
}
sub filter {
- my ($self) = @_ ;
- my ($status) ;
+ my ($self) = @_;
+ my ($status);
tr/n-za-mN-ZA-M/a-zA-Z/
- if ($status = filter_read()) > 0 ;
- $status ;
+ if ($status = filter_read()) > 0;
+ $status;
}
1;
@@ -342,16 +338,16 @@
the source file in rot13 format. The script below, C<mkrot13>, does
just that.
- die "usage mkrot13 filename\n" unless @ARGV ;
- my $in = $ARGV[0] ;
- my $out = "$in.tmp" ;
+ die "usage mkrot13 filename\n" unless @ARGV;
+ my $in = $ARGV[0];
+ my $out = "$in.tmp";
open(IN, "<$in") or die "Cannot open file $in: $!\n";
open(OUT, ">$out") or die "Cannot open file $out: $!\n";
- print OUT "use Rot13;\n" ;
+ print OUT "use Rot13;\n";
while (<IN>) {
- tr/a-zA-Z/n-za-mN-ZA-M/ ;
- print OUT ;
+ tr/a-zA-Z/n-za-mN-ZA-M/;
+ print OUT;
}
close IN;
@@ -361,12 +357,12 @@
If we encrypt this with C<mkrot13>:
- print " hello fred \n" ;
+ print " hello fred \n";
the result will be this:
use Rot13;
- cevag "uryyb serq\a" ;
+ cevag "uryyb serq\a";
Running it produces this output:
@@ -388,7 +384,7 @@
## DEBUG_BEGIN
if ($year > 1999) {
- warn "Debug: millennium bug in year $year\n" ;
+ warn "Debug: millennium bug in year $year\n";
}
## DEBUG_END
@@ -403,7 +399,7 @@
## DEBUG_BEGIN
#if ($year > 1999) {
- # warn "Debug: millennium bug in year $year\n" ;
+ # warn "Debug: millennium bug in year $year\n";
#}
## DEBUG_END
@@ -413,62 +409,62 @@
use strict;
use warnings;
- use Filter::Util::Call ;
+ use Filter::Util::Call;
- use constant TRUE => 1 ;
- use constant FALSE => 0 ;
+ use constant TRUE => 1;
+ use constant FALSE => 0;
sub import {
- my ($type) = @_ ;
+ my ($type) = @_;
my (%context) = (
Enabled => defined $ENV{DEBUG},
InTraceBlock => FALSE,
Filename => (caller)[1],
LineNo => 0,
LastBegin => 0,
- ) ;
- filter_add(bless \%context) ;
+ );
+ filter_add(bless \%context);
}
sub Die {
- my ($self) = shift ;
- my ($message) = shift ;
- my ($line_no) = shift || $self->{LastBegin} ;
+ my ($self) = shift;
+ my ($message) = shift;
+ my ($line_no) = shift || $self->{LastBegin};
die "$message at $self->{Filename} line $line_no.\n"
}
sub filter {
- my ($self) = @_ ;
- my ($status) ;
- $status = filter_read() ;
- ++ $self->{LineNo} ;
+ my ($self) = @_;
+ my ($status);
+ $status = filter_read();
+ ++ $self->{LineNo};
# deal with EOF/error first
if ($status <= 0) {
$self->Die("DEBUG_BEGIN has no DEBUG_END")
- if $self->{InTraceBlock} ;
- return $status ;
+ if $self->{InTraceBlock};
+ return $status;
}
if ($self->{InTraceBlock}) {
if (/^\s*##\s*DEBUG_BEGIN/ ) {
$self->Die("Nested DEBUG_BEGIN", $self->{LineNo})
} elsif (/^\s*##\s*DEBUG_END/) {
- $self->{InTraceBlock} = FALSE ;
+ $self->{InTraceBlock} = FALSE;
}
# comment out the debug lines when the filter is disabled
- s/^/#/ if ! $self->{Enabled} ;
+ s/^/#/ if ! $self->{Enabled};
} elsif ( /^\s*##\s*DEBUG_BEGIN/ ) {
- $self->{InTraceBlock} = TRUE ;
- $self->{LastBegin} = $self->{LineNo} ;
+ $self->{InTraceBlock} = TRUE;
+ $self->{LastBegin} = $self->{LineNo};
} elsif ( /^\s*##\s*DEBUG_END/ ) {
$self->Die("DEBUG_END has no DEBUG_BEGIN", $self->{LineNo});
}
- return $status ;
+ return $status;
}
- 1 ;
+ 1;
The big difference between this filter and the previous example is the
use of context data in the filter object. The filter object is based on
@@ -484,23 +480,23 @@
essence of the filter is as follows:
sub filter {
- my ($self) = @_ ;
- my ($status) ;
- $status = filter_read() ;
+ my ($self) = @_;
+ my ($status);
+ $status = filter_read();
# deal with EOF/error first
- return $status if $status <= 0 ;
+ return $status if $status <= 0;
if ($self->{InTraceBlock}) {
if (/^\s*##\s*DEBUG_END/) {
$self->{InTraceBlock} = FALSE
}
# comment out debug lines when the filter is disabled
- s/^/#/ if ! $self->{Enabled} ;
+ s/^/#/ if ! $self->{Enabled};
} elsif ( /^\s*##\s*DEBUG_BEGIN/ ) {
- $self->{InTraceBlock} = TRUE ;
+ $self->{InTraceBlock} = TRUE;
}
- return $status ;
+ return $status;
}
Be warned: just as the C-preprocessor doesn't know C, the Debug filter
@@ -511,8 +507,7 @@
EOM
Such things aside, you can see that a lot can be achieved with a modest
-amount of code. I<[Note that Tuomas' toy VRML parser on p. 17 had the
-same difficulty parsing VRML strings that look like comments. -Jon]>
+amount of code.
=head1 CONCLUSION
@@ -531,7 +526,7 @@
Once you can identify individual blocks, try allowing them to be
nested. That isn't difficult either.
-Here is a interesting idea that doesn't involve the Debug filter.
+Here is an interesting idea that doesn't involve the Debug filter.
Currently Perl subroutines have fairly limited support for formal
parameter lists. You can specify the number of parameters and their
type, but you still have to manually take them out of the C<@_> array
@@ -543,9 +538,9 @@
into this:
sub MySub($$@) {
- my ($first) = shift ;
- my ($second) = shift ;
- my (@rest) = @_ ;
+ my ($first) = shift;
+ my ($second) = shift;
+ my (@rest) = @_;
...
}
@@ -555,12 +550,31 @@
you know. The tricky bit will be choosing how much knowledge of Perl's
syntax you want your filter to have.
+=head1 THINGS TO LOOK OUT FOR
+
+=over 5
+
+=item Some Filters Clobber the C<DATA> Handle
+
+Some source filters use the C<DATA> handle to read the calling program.
+When using these source filters you cannot rely on this handle, nor expect
+any particular kind of behavior when operating on it. Filters based on
+Filter::Util::Call (and therefore Filter::Simple) do not alter the C<DATA>
+filehandle.
+
+=back
+
=head1 REQUIREMENTS
The Source Filters distribution is available on CPAN, in
CPAN/modules/by-module/Filter
+Starting from Perl 5.8 Filter::Util::Call (the core part of the
+Source Filters distribution) is part of the standard Perl distribution.
+Also included is a friendlier interface called Filter::Simple, by
+Damian Conway.
+
=head1 AUTHOR
Paul Marquess E<lt>Paul.Marquess@xxxxxxxxxxxxxxx<gt>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Filter-1.36/t/call.t new/Filter-1.37/t/call.t
--- old/Filter-1.36/t/call.t 2009-02-28 12:06:51.000000000 +0100
+++ new/Filter-1.37/t/call.t 2009-06-10 00:19:29.000000000 +0200
@@ -1,10 +1,26 @@
+BEGIN {
+ if ($ENV{PERL_CORE}){
+ chdir('t') if -d 't';
+ @INC = ('.', '../lib');
+
+ require Config; import Config;
+ %Config=%Config if 0; # cease -w
+ if ($Config{'extensions'} !~ m{\bFilter/Util/Call\b}) {
+ print "1..0 # Skip: Filter::Util::Call was not built\n";
+ exit 0;
+ }
+ require 'lib/filter-util.pl';
+ }
+ else {
+ require 'filter-util.pl';
+ }
+}
+
use strict;
use warnings;
use vars qw($Inc $Perl);
-require 'filter-util.pl';
-
print "1..32\n" ;
$Perl = "$Perl -w" ;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx
| < Previous | Next > |