Re: Par not working on Net::FTP::Recursive Script

[email protected] (Roderich Schupp)
Newsgroups perl.par
Message-ID <CAC9r9zZ-N62PtCSJ+3v=AdNg4EN-NdJB5Nnp_TGR9Lw9NFEGbw@mail.gmail.com>
On Mon, Aug 3, 2015 at 1:09 AM, Mike Flannigan <[email protected]> wrote:

> OK, I haven't figured it out 100% yet, but it appears to have
> something to do with the newline at the end of each of these
> lines:
>
> __DATA__
> BkmTNBOhAQjsn3YUJWA9cw2JDp8lcw
>

Good observation! I packed the following script (and checked that it has
Windows CRLF line endings)

--- snip ---
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Useqq = 1;
my @data = <DATA>;
print Dumper(\@data);
__DATA__
fooy
bar
quux
--- snip ---

$ perl data.pl
$VAR1 = [
          "foo\n",
          "bar\n",
          "quux\n"
        ];

but when I pack it

$ pp -o data.exe data.pl
$ .\data.exe
$VAR1 = [
          "foo\r\n",
          "bar\r\n",
          "quux\r\n"
        ];

I checked the script as packed into data.exe and it has its CRLF endings
intact.
But the hack that's used to actually run it (i.e. PAR::_run_member) uses a
filehandle opened in binmode.
Looks like the implicit DATA filehandle inherits this setting somehow.

I'll have to think some more whether changing PAR::_run_member might have
side effects.

Cheers, Roderich
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.