use strict;
use warnings;
use Tk;
use Capture::Tiny qw(:all);
use Cwd;
use Data::Dumper;
# BUG or unknown feature in pp: dll files are not extracted
# Workaround:
# --> renamed dll files in "./PDIMLink" to txt files
# --> at start dll files are renamed back to dll
my $dll_path = "$ENV{'PAR_TEMP'}/inc/PDIMlink/host/x86-win32";
rename("$dll_path/bin/cygwin1.txt", "$dll_path/bin/cygwin1.dll");
rename("$dll_path/bin/tcl.txt", "$dll_path/bin/tcl.dll");
rename("$dll_path/lib/cpluslib.txt","$dll_path/lib/cpluslib.dll");
my $mw = MainWindow->new;
$mw->geometry("220x150+100+120");
$mw->title("Test - PP with --gui option");
$mw->Button(
-text => "Start",
-command =>
sub
{
my ($stdout, $stderr, @result);
open( my $fh1, ">", "V:/log1.txt" );
print $fh1 Dumper(\%ENV);
close( $fh1 );
($stdout, $stderr, @result) = capture
{
my $cwd = getcwd;
chdir("$ENV{'PAR_TEMP'}/inc/PDIMlink");
`pdim_link.bat "1.elf"`;
chdir($cwd);
};
# this file is NOT created if --gui option is active
open( my $fh2, ">", "V:/log2.txt" );
print $fh2 "STDOUT: $stdout\n";
print $fh2 "STDERR: $stderr\n";
print $fh2 "Result: @result\n";
print $fh2 "$ENV{'PAR_TEMP'}/inc/PDIMlink\n";
print $fh2 Dumper(\%ENV);
close( $fh2 );
}
)->pack;
MainLoop;
The "pdim_link.bat" file I'm not allowed to publish. But I'll try to reproduce the same behaviour with a bat file which I can publish to you.
Now to the code: If I pack it with the --gui option, i.e. pp --gui -a "./PDIMlink" -o test.exe test.pl then "pdim_link.bat" does NOT work and the file "log2.txt" is NOT created.
If I pack the code without the --gui option, i.e. pp -a "./PDIMlink" -o test.exe test.pl then both files (log1.txt and log2.txt) are created and "pdim_link.bat" works as expected.
The file "log1.txt" which contains the Dump of the environment variables is not different (apart from the cryptical path e.g. .../cache-94cdd0fc50fcdc36d7cd4972d0f2afa676e0b848/.. ) with or without using the gui option. |