New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter::Simple executable_no_comments filters don't work (fatal error) #17122
Comments
From Jim@balter.nameCreated by jim@balter.nameFilter::Simple version 0.94 (the latest) does not work with Can't use an undefined value as a subroutine reference at because there's no such type in %selector_for and it doesn't match /^code/ if ($type =~ /^(?:code|executable)/) { However, the documentation says that only code and code_no_comments filters Also: In my attempts to write a filter, I discovered that errors and warnings This has perhaps been fixed in 5.28.0 ... but a lot of people are running earlier versions and Filter::Simple could Perl Info
|
From @jkeenanOn Sun, 11 Aug 2019 03:55:53 GMT, Jim@balter.name wrote:
Filter-Simple was upgraded to version 0.95 within the Perl 5 core distribution in September 2017. However, it appears that no new CPAN release was made; CPAN is stuck at version 0.94. Bcc-ing some people who might be able to help with a new CPAN release. Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From Jim@balter.nameThanks for the response. Looking at 0.95 in the perl 5.30 dist, there are -- Jim On Sun, Aug 11, 2019 at 11:41 AM James E Keenan via RT <
|
From @tonycozOn Sat, 10 Aug 2019 20:55:53 -0700, Jim@balter.name wrote:
The attached fixes this I think. Filter::Simple could use a lot more tests.
I couldn't reproduce this. I modfied ExeNoComments.pm from the attached patch: package Filter::Simple::ExeNoComments; use Filter::Simple; FILTER_ONLY 1; and tried running this code: use lib 't/lib'; my $z = "muddles"; The result: $ ../../perl -I../.. -MTestInit=U2T t/filter_exe_fail.pl Tony |
From @tonycoz0001-perl-134349-fix-and-sanity-check-for-executable_no_c.patchFrom d79c729fe8a3fb291f85c4917078a61b49a76f2d Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 29 Aug 2019 11:24:35 +1000
Subject: (perl #134349) fix and sanity check for executable_no_comments
---
MANIFEST | 1 +
dist/Filter-Simple/lib/Filter/Simple.pm | 3 ++-
dist/Filter-Simple/t/filter_only.t | 19 ++++++++++++++++++-
.../t/lib/Filter/Simple/ExeNoComments.pm | 12 ++++++++++++
4 files changed, 33 insertions(+), 2 deletions(-)
create mode 100644 dist/Filter-Simple/t/lib/Filter/Simple/ExeNoComments.pm
diff --git a/MANIFEST b/MANIFEST
index 7bf62d8479..9abc29258f 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3563,6 +3563,7 @@ dist/Filter-Simple/t/filter.t See if Filter::Simple works
dist/Filter-Simple/t/filter_only.t See if Filter::Simple works
dist/Filter-Simple/t/import.t See if Filter::Simple works
dist/Filter-Simple/t/lib/Filter/Simple/CodeNoComments.pm Helper file for Filter::Simple tests
+dist/Filter-Simple/t/lib/Filter/Simple/ExeNoComments.pm Helper file for Filter::Simple tests
dist/Filter-Simple/t/lib/Filter/Simple/ExportTest.pm Helper file for Filter::Simple tests
dist/Filter-Simple/t/lib/Filter/Simple/FilterOnlyTest.pm Helper file for Filter::Simple tests
dist/Filter-Simple/t/lib/Filter/Simple/FilterTest.pm Helper file for Filter::Simple tests
diff --git a/dist/Filter-Simple/lib/Filter/Simple.pm b/dist/Filter-Simple/lib/Filter/Simple.pm
index 1dcf3c80bf..924c2aecbd 100644
--- a/dist/Filter-Simple/lib/Filter/Simple.pm
+++ b/dist/Filter-Simple/lib/Filter/Simple.pm
@@ -2,7 +2,7 @@ package Filter::Simple;
use Text::Balanced ':ALL';
-our $VERSION = '0.95';
+our $VERSION = '0.96';
use Filter::Util::Call;
use Carp;
@@ -70,6 +70,7 @@ my %extractor_for = (
my %selector_for = (
all => sub { my ($t)=@_; sub{ $_=$$_; $t->(@_); $_} },
executable=> sub { my ($t)=@_; sub{ref() ? $_=$$_ : $t->(@_); $_} },
+ executable_no_comments=> sub { my ($t)=@_; sub{ref() ? $_=$$_ : $t->(@_); $_} },
quotelike => sub { my ($t)=@_; sub{ref() && do{$_=$$_; $t->(@_)}; $_} },
regex => sub { my ($t)=@_;
sub{ref() or return $_;
diff --git a/dist/Filter-Simple/t/filter_only.t b/dist/Filter-Simple/t/filter_only.t
index 57f108677e..cd86707efc 100644
--- a/dist/Filter-Simple/t/filter_only.t
+++ b/dist/Filter-Simple/t/filter_only.t
@@ -4,7 +4,7 @@ BEGIN {
use Filter::Simple::FilterOnlyTest qr/not ok/ => "ok",
"bad" => "ok", fail => "die";
-print "1..9\n";
+print "1..11\n";
sub fail { print "ok ", $_[0], "\n" }
sub ok { print "ok ", $_[0], "\n" }
@@ -41,3 +41,20 @@ print "ok 8\n";
print "not " unless "bad" =~ /bad/;
print "ok 9\n";
+
+use Filter::Simple::ExeNoComments;
+
+=for us
+
+shromplex
+
+=cut
+
+# shromplex
+
+# test the difference from code*
+my $x = "ABC";
+
+print $x eq "TEST" ? "" : "not ", "ok 10 # check strings processed\n";
+
+print "ok 11 # executable_no_comments\n";
diff --git a/dist/Filter-Simple/t/lib/Filter/Simple/ExeNoComments.pm b/dist/Filter-Simple/t/lib/Filter/Simple/ExeNoComments.pm
new file mode 100644
index 0000000000..db2c7bf4f3
--- /dev/null
+++ b/dist/Filter-Simple/t/lib/Filter/Simple/ExeNoComments.pm
@@ -0,0 +1,12 @@
+package Filter::Simple::ExeNoComments;
+
+use Filter::Simple;
+
+FILTER_ONLY
+ executable_no_comments => sub {
+ print STDERR "code <$_>\n";
+ $_ =~ /shromplex/ and die "We wants no shromplexes!";
+ s/ABC/TEST/g;
+ };
+
+1;
--
2.11.0
|
Migrated from rt.perl.org#134349 (status was 'open')
Searchable as RT134349$
The text was updated successfully, but these errors were encountered: