From don.peddicord@navy.mil on 2018-10-31 16:51:13
:
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 ------
--- 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
From rschupp@cpan.org on 2018-11-03 14:57:59
:
On 2018-10-31 12:51:13, don.peddicord@navy.mil wrote:
> --------- 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
Migrated from rt.cpan.org#127538 (status was 'open')
Requestors:
From don.peddicord@navy.mil on 2018-10-31 16:51:13 :
From rschupp@cpan.org on 2018-11-03 14:57:59 :