ZJ.Mike.2009 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks,

I'm trying to package a Perl script to EXE using the pp utility bundled with PAR::Packer with the Filter::Crypto on. But something is wrong there. Without the filter, things are ok. With it, no. I think it has something to do with the DATA section in the script but I don't how to fix this problem. The following runable script might demonstrate the problem but I'm not sure if my problem is OS specific or not. The problem is this: when I use

pp --gui -o 1.exe test.pl

the EXE works like expected. It displays the content in the DATA section. But with</code>

pp --gui -f Crypto -M Filter::Crypto::Decrypt -o 2.exe test.pl

the EXE does not output any content.

use Win32::GUI; use strict; use warnings; my $mw = new Win32::GUI::DialogBox( -text => 'Test', -left => 300, -top => 100, -left => 60, -width => 200, -height => 200, ); $mw->Show(); my $result = $mw->AddTextfield( -left => 0, -top => 40, -size => [180,100], -vscroll =>1, -multiline => 1, ); my $button = $mw->AddButton( -name => 'button', -text => 'Go', -left => 120, -top => 10, -visible =>1, ); Win32::GUI::Dialog; sub button_Click { while(<DATA>) { $result->Append("$_\r\n"); } } __DATA__ This is LINE1 This is LINE2 This is LINE3
Thanks like always for any guidance/pointers/suggestions/comments :)

Replies are listed 'Best First'.
Re: What does the Filter::Crytpo module do to the DATA section?
by Anonymous Monk on Feb 06, 2010 at 12:57 UTC
    Checking the basics script/test.pl main 44 (-s DATA) 1416 tell(DATA) 1416 fileno(DATA) 6 seek DATA,0 ==> 1 package main; shift @INC; #line 1 "script/test.pl" use Filter::Crypto::Decrypt; ......encrypted junk here
      Thanks Anonymous Monk
Re: What does the Filter::Crytpo module do to the DATA section?
by Anonymous Monk on Feb 06, 2010 at 11:18 UTC
    And why are you using DATA section?

      Why not? The following would also do, though

      $result->Append("$_\r\n\") for split /^/m, <<'__EOI__'; This is LINE1 This is LINE2 This is LINE3 __EOI__

      What I question is the use of \n\r\n as the line terminator.

      I know I don't have to include data in the data section but it feels neat to have code and data together in one single script.