Skip to content

Commit

Permalink
Upgrade Filter-Util-Call from version 1.54 to 1.55
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-m-hay committed Jul 31, 2015
1 parent 0dd5b0d commit 356231b
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 25 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Expand Up @@ -1160,6 +1160,8 @@ cpan/Filter-Util-Call/Call.pm Filter::Util::Call extension module
cpan/Filter-Util-Call/Call.xs Filter::Util::Call extension external subroutines
cpan/Filter-Util-Call/filter-util.pl See if Filter::Util::Call works
cpan/Filter-Util-Call/t/call.t See if Filter::Util::Call works
cpan/Filter-Util-Call/t/rt_101033.pm
cpan/Filter-Util-Call/t/rt_101033.t
cpan/Filter-Util-Call/t/rt_54452-rebless.t
cpan/Getopt-Long/lib/Getopt/Long.pm Fetch command options (GetOptions)
cpan/Getopt-Long/t/gol-basic.t See if Getopt::Long works
Expand Down
2 changes: 1 addition & 1 deletion Porting/Maintainers.pl
Expand Up @@ -562,7 +562,7 @@ package Maintainers;
},

'Filter::Util::Call' => {
'DISTRIBUTION' => 'RURBAN/Filter-1.54.tar.gz',
'DISTRIBUTION' => 'RURBAN/Filter-1.55.tar.gz',
'FILES' => q[cpan/Filter-Util-Call
pod/perlfilter.pod
],
Expand Down
27 changes: 25 additions & 2 deletions cpan/Filter-Util-Call/Call.pm
@@ -1,7 +1,7 @@

# Call.pm
#
# 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.
Expand All @@ -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.54" ;
$VERSION = "1.55" ;

sub filter_read_exact($)
{
Expand Down Expand Up @@ -292,6 +292,29 @@ See L<Example 4: Using filter_del> for details.
Internal function which adds the filter, based on the L<filter_add>
argument type.
=item I<unimport()>
May be used to disable a filter, but is rarely needed. See L<filter_del>.
=back
=head1 LIMITATIONS
See L<perlfilter/LIMITATIONS> for an overview of the general problems
filtering code in a textual line-level only.
=over
=item __DATA__ is ignored
The content from the __DATA__ block is not filtered.
This is a serious limitation, e.g. for the L<Switch> module.
See L<http://search.cpan.org/perldoc?Switch#LIMITATIONS> for more.
=item Max. codesize limited to 32-bit
Currently internal buffer lengths are limited to 32-bit only.
=back
=head1 EXAMPLES
Expand Down
6 changes: 1 addition & 5 deletions cpan/Filter-Util-Call/Call.xs
Expand Up @@ -3,7 +3,7 @@
*
* Author : Paul Marquess
* Date : 2014-12-09 02:48:44 rurban
* Version : 1.54
* Version : 1.55
*
* Copyright (c) 1995-2011 Paul Marquess. All rights reserved.
* Copyright (c) 2011-2014 Reini Urban. All rights reserved.
Expand Down Expand Up @@ -131,19 +131,15 @@ filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
DEFSV_set(newSVpv("", 0)) ;

PUSHMARK(sp) ;

if (CODE_REF(my_sv)) {
/* if (SvROK(PERL_OBJECT(my_sv)) && SvTYPE(SvRV(PERL_OBJECT(my_sv))) == SVt_PVCV) { */
count = perl_call_sv((SV*)PERL_OBJECT(my_sv), G_SCALAR);
}
else {
XPUSHs((SV*)PERL_OBJECT(my_sv)) ;

PUTBACK ;

count = perl_call_method("filter", G_SCALAR);
}

SPAGAIN ;

if (count != 1)
Expand Down
8 changes: 4 additions & 4 deletions cpan/Filter-Util-Call/filter-util.pl
Expand Up @@ -9,8 +9,8 @@ sub readFile
my ($filename) = @_ ;
my ($string) = '' ;

open (F, "<$filename")
or die "Cannot open $filename: $!\n" ;
open (F, "<", $filename)
or die "Cannot read $filename: $!\n" ;
while (<F>)
{ $string .= $_ }
close F ;
Expand All @@ -20,8 +20,8 @@ sub readFile
sub writeFile
{
my($filename, @strings) = @_ ;
open (F, ">$filename")
or die "Cannot open $filename: $!\n" ;
open (F, ">", $filename)
or die "Cannot write $filename: $!\n" ;
binmode(F) if $filename =~ /bin$/i;
foreach (@strings)
{ print F }
Expand Down
27 changes: 27 additions & 0 deletions cpan/Filter-Util-Call/t/rt_101033.pm
@@ -0,0 +1,27 @@
package rt_101033;

use strict;
use Filter::Util::Call;

sub import
{
filter_add({});
1;
}

sub unimport
{
filter_del()
}

sub filter
{
my($self) = @_ ;
my $status = 1;
$status = filter_read(1_000_000);
#print "code: !$_!\n\n";
return $status;
}

1;

11 changes: 11 additions & 0 deletions cpan/Filter-Util-Call/t/rt_101033.t
@@ -0,0 +1,11 @@
#! perl
use lib 't';
use rt_101033;

print "1..1\n";
my $s = <DATA>;
print "not " if $s !~ /^test/;
print "ok 1 # TODO RT #101033 + Switch #97440 ignores __DATA__\n";

__DATA__
test
4 changes: 4 additions & 0 deletions pod/perldelta.pod
Expand Up @@ -123,6 +123,10 @@ L<Encode> has been upgraded from version 2.75 to 2.76.

=item *

L<Filter::Util::Call> has been upgraded from version 1.54 to 1.55.

=item *

The PathTools module collection has been upgraded from version 3.55 to
3.56.

Expand Down
30 changes: 17 additions & 13 deletions pod/perlfilter.pod
Expand Up @@ -559,15 +559,17 @@ 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,
See for example the limitations in L<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
regexes with embedded newlines that are specified with raw C</.../>
delimiters and don't have a modifier C<//x> are indistinguishable from
code chunks beginning with the division operator C</>. As a workaround
you must use C<m/.../> or C<m?...?> for such patterns. Also, the presence of
regexes specified with raw C<?...?> delimiters may cause mysterious
errors. The workaround is to use C<m?...?> instead. See
L<http://search.cpan.org/perldoc?Switch#LIMITATIONS>

Currently the content of the C<__DATA__> block is not filtered.

Currently internal buffer lengths are limited to 32-bit only.

Expand All @@ -582,7 +584,7 @@ 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.
filehandle, but on the other hand totally ignore the text after C<__DATA__>.

=back

Expand All @@ -601,9 +603,11 @@ Damian Conway.

Paul Marquess E<lt>Paul.Marquess@btinternet.comE<gt>

Reini Urban E<lt>rurban@cpan.orgE<gt>

=head1 Copyrights

This article originally appeared in The Perl Journal #11, and is
copyright 1998 The Perl Journal. It appears courtesy of Jon Orwant and
The Perl Journal. This document may be distributed under the same terms
as Perl itself.
The first version of this article originally appeared in The Perl
Journal #11, and is copyright 1998 The Perl Journal. It appears
courtesy of Jon Orwant and The Perl Journal. This document may be
distributed under the same terms as Perl itself.

0 comments on commit 356231b

Please sign in to comment.