@@ -18,7 +18,7 @@ use vars qw($VERSION @ISA @EXPORT) ;
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw( filter_add filter_del filter_read filter_read_exact) ;
-$VERSION = "1.50" ;
+$VERSION = "1.52" ;
sub filter_read_exact($)
{
@@ -45,10 +45,10 @@ sub filter_add($)
my($obj) = @_ ;
# Did we get a code reference?
- my $coderef = (ref $obj eq 'CODE') ;
+ my $coderef = (ref $obj eq 'CODE');
# If the parameter isn't already a reference, make it one.
- if (!$coderef and !ref $obj) {
+ if (!$coderef and (!ref($obj) or ref($obj) =~ /^ARRAY|HASH$/)) {
$obj = bless (\$obj, (caller)[0]);
}
@@ -501,6 +501,7 @@ Paul Marquess
=head1 LICENSE
Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
+Copyright (c) 2011-2014 Reini Urban. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@@ -2,10 +2,11 @@
* Filename : Call.xs
*
* Author : Paul Marquess
- * Date : 2013-03-29 09:04:42 rurban
- * Version : 1.50
+ * Date : 2014-12-09 02:48:44 rurban
+ * Version : 1.52
*
* Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
+ * Copyright (c) 2011-2014 Reini Urban. All rights reserved.
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
*
@@ -60,7 +61,7 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
if (fdebug)
warn("**** In filter_call - maxlen = %d, out len buf = %" IVdf " idx = %d my_sv = %" IVdf " [%s]\n",
- maxlen, SvCUR(buf_sv), idx, SvCUR(my_sv), SvPVX(my_sv) ) ;
+ maxlen, (IV)SvCUR(buf_sv), idx, (IV)SvCUR(my_sv), SvPVX(my_sv) ) ;
while (1) {
@@ -97,7 +98,7 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
SvCUR_set(my_sv, n) ;
if (fdebug)
warn("recycle %d - leaving %d, returning %" IVdf " [%s]",
- idx, n, SvCUR(buf_sv), SvPVX(buf_sv)) ;
+ idx, n, (IV)SvCUR(buf_sv), SvPVX(buf_sv)) ;
return SvCUR(buf_sv);
}
@@ -153,7 +154,7 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
if (fdebug)
warn("status = %d, length op buf = %" IVdf " [%s]\n",
- n, SvCUR(DEFSV), SvPVX(DEFSV) ) ;
+ n, (IV)SvCUR(DEFSV), SvPVX(DEFSV) ) ;
if (SvCUR(DEFSV))
sv_setpvn(my_sv, SvPVX(DEFSV), SvCUR(DEFSV)) ;
@@ -172,7 +173,7 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
if (fdebug)
warn ("filter_read %d returned %d , returning %" IVdf "\n", idx, n,
- (SvCUR(buf_sv)>0) ? SvCUR(buf_sv) : (STRLEN)n);
+ (SvCUR(buf_sv)>0) ? SvCUR(buf_sv) : (IV)n);
/* PERL_MODULE(my_sv) ; */
/* PERL_OBJECT(my_sv) ; */
@@ -408,4 +408,17 @@
* Do not re-bless already blessed filter_add arguments into the callers package.
Fixes RT #54452
* t/z_pod-coverage.t: omit empty Filter::decrypt (also fixes RT #84405)
- * Fix Perl Compiler detection in Filter::decrypt
\ No newline at end of file
+ * Fix Perl Compiler detection in Filter::decrypt
+
+1.51 2014-12-09 rurban
+----
+
+ * Minor -Wall -Wextra cleanups by jhi and me. Fixes RT #100742
+ * Updated Copyright years
+ * Document and warn about its limitations
+
+1.52 2014-12-19 rurban
+----
+
+ * Fix Filter::Util::Call regression from 1.50, for filter_add({}) or filter_add([]).
+ This broke Switch, see RT #101004.
@@ -6,7 +6,7 @@ use strict;
use warnings;
use vars qw(@ISA $VERSION) ;
@ISA = qw(DynaLoader);
-$VERSION = "1.50" ;
+$VERSION = "1.52" ;
bootstrap Filter::Util::Exec ;
1 ;
@@ -28,6 +28,8 @@ Filters> which use a Unix coprocess.
See L<Filter::exec>, L<Filter::cpp> and L<Filter::sh> for examples of
the use of this module.
+Note that the size of the buffers is limited to 32-bit.
+
=head2 B<filter_add()>
The function, C<filter_add> installs a filter. It takes one
@@ -2,8 +2,8 @@
* Filename : exec.xs
*
* Author : Paul Marquess
- * Date : 2014-06-04 11:16:02 rurban
- * Version : 1.50
+ * Date : 2014-12-09 02:50:27 rurban
+ * Version : 1.52
*
*/
@@ -279,15 +279,14 @@ pipe_read(SV *sv, int idx, int maxlen)
BUF_NEXT(sv) = BUF_START(sv);
if (fdebug)
warn ("*pipe_write(%d) Filt Rd returned %d %" IVdf " [%*s]\n",
- idx, len, BUF_SIZE(sv), BUF_SIZE(sv), BUF_START(sv)) ;
+ idx, len, BUF_SIZE(sv), (int)BUF_SIZE(sv), BUF_START(sv)) ;
}
else {
/* eof, close write end of pipe */
close(pipe_out) ;
if (fdebug)
warn ("*pipe_read(%d) closing pipe_out errno = %d %s\n",
- idx, errno,
- Strerror(errno)) ;
+ idx, errno, Strerror(errno)) ;
}
}
@@ -303,7 +302,7 @@ pipe_read(SV *sv, int idx, int maxlen)
else if (errno != VAL_EAGAIN) {
if (fdebug)
warn ("*pipe_read(%d) closing pipe_out errno = %d %s\n",
- idx, errno, Strerror(errno)) ;
+ idx, errno, Strerror(errno)) ;
/* close(pipe_out) ; */
return 0;
}
@@ -325,14 +324,14 @@ make_nonblock(int f)
if (mode < 0)
croak("fcntl(f, F_GETFL) failed, RETVAL = %d, errno = %d",
- mode, errno) ;
+ mode, errno) ;
if (!(mode & VAL_O_NONBLOCK))
RETVAL = fcntl(f, F_SETFL, mode | VAL_O_NONBLOCK);
if (RETVAL < 0)
croak("cannot create a non-blocking pipe, RETVAL = %d, errno = %d",
- RETVAL, errno) ;
+ RETVAL, errno) ;
}
#endif
@@ -496,7 +495,7 @@ filter_exec(pTHX_ int idx, SV *buf_sv, int maxlen)
if (fdebug)
warn ("filter_sh(idx=%d, SvCUR(buf_sv)=%" IVdf ", maxlen=%d\n",
- idx, SvCUR(buf_sv), maxlen) ;
+ idx, SvCUR(buf_sv), maxlen) ;
while (1) {
STRLEN n_a;
@@ -52,6 +52,6 @@ tee/tee.pm
tee/tee.xs
filter-util.pl
perlfilter.pod
+SIGNATURE Public-key signature (added by MakeMaker)
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
-SIGNATURE Public-key signature (added by MakeMaker)
@@ -4,7 +4,7 @@
"Paul Marquess <pmqs@cpan.org>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141170",
+ "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.142060",
"license" : [
"perl_5"
],
@@ -47,5 +47,5 @@
"url" : "https://github.com/rurban/Filter"
}
},
- "version" : "1.50"
+ "version" : "1.52"
}
@@ -7,7 +7,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141170'
+generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.142060'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -24,4 +24,4 @@ requires: {}
resources:
license: http://dev.perl.org/licenses/
repository: https://github.com/rurban/Filter
-version: '1.50'
+version: '1.52'
@@ -54,6 +54,7 @@ WriteMakefile
'linkext' => {LINKTYPE => ''},
'dist' => {COMPRESS=>'gzip', SUFFIX=>'gz',
DIST_DEFAULT => 'tardist'},
+ 'SIGN' => 1,
($] >= 5.005
? (ABSTRACT => 'Source Filters',
AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
@@ -1,10 +1,11 @@
Source Filters
- Version 1.50
+ Version 1.52
- 2014-06-04 rurban
+ 2014-12-09 rurban
Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
+ Copyright (c) 2011-2014 Reini Urban. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
@@ -26,6 +27,29 @@ applications. It's available at
http://search.cpan.org/dist/Filter-Simple/
+LIMITATIONS
+-----------
+
+Source filters only work on the string level, thus are highly limited
+in its ability to change source code on the fly. It cannot detect
+comments, quoted strings, heredocs, it is no replacement for a real
+parser.
+The only stable usage for source filters are encryption, compression,
+or the byteloader, to translate binary code back to source code.
+
+See for example the limitations in Switch, which uses source filters,
+and thus is does not work inside a string eval, the presence of
+regexes with embedded newlines that are specified with raw /.../
+delimiters and don't have a modifier //x are indistinguishable from
+code chunks beginning with the division operator /. As a workaround
+you must use m/.../ or m?...? for such patterns. Also, the presence of
+regexes specified with raw ?...? delimiters may cause mysterious
+errors. The workaround is to use m?...? instead. See
+http://search.cpan.org/perldoc?Switch#LIMITATIONS
+
+Currently internal buffer lengths are limited to 32-bit only.
+
+
PREREQUISITES
-------------
@@ -49,6 +73,8 @@ The modules can now be built using this sequence of commands:
perl Makefile.PL
make
make test
+
+Building in parallel (-j4) does not work.
The filters have been successfully built and tested on the following
systems (at least):
@@ -14,24 +14,23 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 43ae0fef00ee7f2159c9b1757cc26547ffffa2ce Call/Call.pm
-SHA1 628264b42cb11c39570898dea3085aebcd66005c Call/Call.xs
+SHA1 dc796974e72e839a357c735af25b7a4abd5be0f7 Call/Call.pm
+SHA1 c7675345a364db87c45855ffbd0d3351f638e1a0 Call/Call.xs
SHA1 3d1e6a5e07761b79dae2a67df5e7484ab8517e02 Call/Makefile.PL
SHA1 ab106878b5b6770b97a1a6bfc6ae327930aca030 Call/ppport.h
SHA1 bb5316cb0f0ae4449f3973242908bf656b446aea Call/typemap
-SHA1 1b876bc74a52917f66d4becf915a95768d60780f Changes
-SHA1 06e3dc31b7797e9b6808dccf9b3de04974037300 Exec/Exec.pm
-SHA1 258209b56874be4c04b54a7e8b9b0da0cd26d426 Exec/Exec.xs
+SHA1 e6b6e76561adff3d0256f3097124a945b2a2fd42 Changes
+SHA1 c024a88b3dad50be7a598ef384874d38160d441c Exec/Exec.pm
+SHA1 58b55c30b7c4d4cd81c3bf67a3c0e1ebc7502680 Exec/Exec.xs
SHA1 f5c86e77cfcb10451775fc0d2c1448ba1b7ee7f7 Exec/Makefile.PL
-SHA1 4360844f178edeb60b2379cc8f9000a71c603df0 MANIFEST
-SHA1 51b59419f6e4a1abbd63f7f296fc1068d02a8117 META.json
-SHA1 2d6c4803b078a43dd5b8733cc40145b66f2a1175 META.yml
-SHA1 73451af265f4f5526ccc041ae2c9cc84f2260074 Makefile.PL
-SHA1 3607014f95cb05b058ce2429832cf8d47945e38d README
+SHA1 dbbf2b2b9d934eb383a1984e4b115000a4fed65d MANIFEST
+SHA1 e9b39582b677faf511ca97a34d573d3a2edd0d17 META.yml
+SHA1 7003a94da2386c8966f9bcd773270414bcd91f4f Makefile.PL
+SHA1 37568c2885a5a11fbbbc56bb472cecbc0b5f1d8d README
SHA1 d298989d6a6dde3eae4563d91c7c7cd3c511e050 decrypt/Makefile.PL
SHA1 ed95e519c49033476f6b1084b7a6fd6347ce7737 decrypt/decr
-SHA1 1ef5468d8d4e45bc2c51eb23aa7c1852f7765cd9 decrypt/decrypt.pm
-SHA1 150098326da38ec2c5feae3ce607364d1a07475c decrypt/decrypt.xs
+SHA1 c81195ac248f0a092f8406cd58c956ee30a28bc0 decrypt/decrypt.pm
+SHA1 56abe4fc749caaca96eabae6a8b97ab7ce859f4e decrypt/decrypt.xs
SHA1 0f22731e97b9b3803ffe785d9e2c5665cfd654c6 decrypt/encrypt
SHA1 0bf507061d318b097119837bbda8411f06c2bfb5 examples/closure/Count.pm
SHA1 b8965a11e0a20642dfe99421961a112edf2a8706 examples/closure/Decompress.pm
@@ -53,8 +52,8 @@ SHA1 2e6db8564c4fc18399d98c05609afcfe2e030653 lib/Filter/cpp.pm
SHA1 2a98ca8e4df7d3bff94637dc870e47c95c030913 lib/Filter/exec.pm
SHA1 a8731459699c802f358b30a9dc96eef70f904e86 lib/Filter/sh.pm
SHA1 cef9663cf8f6d83ee79b390d14d7a6e4683fb457 mytest
-SHA1 698323e82a48c4ce1064d81de12d09dfd31d3559 perlfilter.pod
-SHA1 af34efde040dd58d8d5c569c91907e25749486db t/call.t
+SHA1 22f5a6597f64204d7ccbd25442744f7102132d87 perlfilter.pod
+SHA1 47be164f1466fadfb44017d5e038926c77d879c8 t/call.t
SHA1 3644d155108e9e14f7230476454f8a3853cceab6 t/cpp.t
SHA1 abec7e47e7afe5edfebaaa4edcdfb7c3cadc2f04 t/decrypt.t
SHA1 9d37016c431260e9d19fe7f0e3a47f804f1368c6 t/exec.t
@@ -68,12 +67,12 @@ SHA1 ade48e2b6098a0a329312543e1451e7e7fb7bc5f t/z_perl_minimum_version.t
SHA1 1dbe44e2091ab84d8462fda2052e35bf1354d963 t/z_pod-coverage.t
SHA1 c8aa3903d3aba84c19bbd94d677620c758fa07d5 t/z_pod.t
SHA1 8568bca5a96669cb8d8a37eec0453ead6f331b3e tee/Makefile.PL
-SHA1 104bc8a05393c46d04b4d5789d52182a6e8e0e29 tee/tee.pm
+SHA1 843cc2ec523944e1cbe03ccef2ad35dd7002bff0 tee/tee.pm
SHA1 86da5dd869daf1b40405e827eae0241a07e0ce56 tee/tee.xs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
-iEYEARECAAYFAlOPUI8ACgkQmm2SYo/9yUKisQCfVHKo0tQ98rEKPxguK//MPcOa
-zbQAn2l4WMHsAIrMKFEa/wp69oVJ7/uI
-=PrjU
+iEYEARECAAYFAlSUklsACgkQmm2SYo/9yUIPwwCghCtQlXv2HDCJ+s4afppTzVNU
+4AMAn1FHMuZzjqPtDhzkCThg0UrShRpI
+=pQ0V
-----END PGP SIGNATURE-----
@@ -6,7 +6,7 @@ use strict;
use warnings;
use vars qw(@ISA $VERSION);
@ISA = qw(DynaLoader);
-$VERSION = "1.50" ;
+$VERSION = "1.52" ;
bootstrap Filter::decrypt ;
1;
@@ -2,8 +2,8 @@
* Filename : decrypt.xs
*
* Author : Paul Marquess
- * Date : 2014-06-04 11:17:56 rurban
- * Version : 1.50
+ * Date : 2014-12-09 02:58:47 rurban
+ * Version : 1.52
*
*/
@@ -550,6 +550,28 @@ useful features from the C preprocessor and any other macro processors
you know. The tricky bit will be choosing how much knowledge of Perl's
syntax you want your filter to have.
+=head1 LIMITATIONS
+
+Source filters only work on the string level, thus are highly limited
+in its ability to change source code on the fly. It cannot detect
+comments, quoted strings, heredocs, it is no replacement for a real
+parser.
+The only stable usage for source filters are encryption, compression,
+or the byteloader, to translate binary code back to source code.
+
+See for example the limitations in Switch, which uses source filters,
+and thus is does not work inside a string eval, the presence of
+regexes with embedded newlines that are specified with raw /.../
+delimiters and don't have a modifier //x are indistinguishable from
+code chunks beginning with the division operator /. As a workaround
+you must use m/.../ or m?...? for such patterns. Also, the presence of
+regexes specified with raw ?...? delimiters may cause mysterious
+errors. The workaround is to use m?...? instead. See
+http://search.cpan.org/perldoc?Switch#LIMITATIONS
+
+Currently internal buffer lengths are limited to 32-bit only.
+
+
=head1 THINGS TO LOOK OUT FOR
=over 5
@@ -686,7 +686,7 @@ sub import
{
my ($type) = shift ;
- filter_add(bless [] )
+ filter_add([])
}
sub filter
@@ -6,7 +6,7 @@ use strict;
use warnings;
use vars qw( @ISA $VERSION);
@ISA = qw(DynaLoader);
-$VERSION = "1.50" ;
+$VERSION = "1.52" ;
bootstrap Filter::tee ;