Skip Menu |

This queue is for tickets about the PAR-Packer CPAN distribution.

Report information
The Basics
Id: 127538
Status: open
Priority: 0/
Queue: PAR-Packer

People
Owner: Nobody in particular
Requestors: don.peddicord [...] navy.mil
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: __DATA__ file handle not available when Filter(s) used
Date: Wed, 31 Oct 2018 16:49:28 +0000
To: "bug-PAR-Packer [...] rt.cpan.org" <bug-PAR-Packer [...] rt.cpan.org>
From: "Peddicord, Don D JR CIV SPAWARSYSCEN-ATLANTIC, 59440" <don.peddicord [...] navy.mil>
pp Windows 10 , Strawberry perl 5.26 PAR Packager, version 1.047 (PAR version 1.015) --------- perl code -- use strict; use warnings; foreach (<DATA>) { print "data: $_ \n"; } 1; __END__ __DATA__ This is line one This is line two ------- end ------ Show quoted text
--- command line ---- C:\perlutils\Perl64\perl\site\bin\pp -c -F Bleach -f Bleach -o pp-flter-err-demo.exe pp-filter-error-demo.pm --- end ---- --Results --- pp-flter-err-demo.exe readline() on unopened filehandle DATA at (eval 13) line 3. ---end --- Filter::Crypto has same results. No filter is fine. Thanks. Don Don Peddicord SPAWAR Systems Center Atlantic don.peddicord@navy.mil<mailto:don.peddicord@navy.mil> 843-218-6901
On 2018-10-31 12:51:13, don.peddicord@navy.mil wrote: Show quoted text
> --------- perl code --
Hi Don, I checked how PAR::Filter::Bleach transforms you script when it gets packed and the resulting file looks OK (esp. __DATA__ hasn't been stripped). The problem appears to be caused by Perl itself. Try the following script (this is essentially how PAR::Filter::Bleach works): ----- snip ----- $_=<<'...'; print "---\n$_---\n"; eval $_; use strict; use warnings; print "DATA start\n"; foreach (<DATA>) { print "data: $_ \n"; } print "DATA end\n"; 1; __DATA__ This is line one This is line two ... ----- snip ----- Running this I get: --- use strict; use warnings; print "DATA start\n"; foreach (<DATA>) { print "data: $_ \n"; } print "DATA end\n"; 1; __DATA__ This is line one This is line two --- DATA start readline() on unopened filehandle DATA at (eval 1) line 4. DATA end So "eval STRING;" somehow ignores __DATA__ content in STRING. PAR::Filter::Crypto is implemented differently: it's a source filter (cf. "perldoc perlfilter", esp. "THINGS TO LOOK OUT FOR"), but source filters also interact badly with __DATA__: ----- snip ----- use Filter::exec qw( cat ); use strict; use warnings; print "DATA start\n"; foreach (<DATA>) { print "data: $_ \n"; } print "DATA end\n"; 1; __DATA__ This is line one This is line two ----- snip ----- Running it produces: DATA start DATA end So, in short, packing scripts that use __DATA__ with-f/-F won't work and there's nothing PAR::Packer can do about it. Cheers, Roderich