elef has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use warnings; use Tk; use utf8; my $mw = Tk::MainWindow->new; $mw -> Button(-text=>"Exit", -command => sub {exit(0)}) -> pack(-pady +=> 20); my $convert_bin; my $condition; if (!$condition) { my $bin_win = $mw->Toplevel(-title => 'A toplevel'); $bin_win->minsize(300, 200); $bin_win->update; $bin_win->raise; $bin_win->focus; $bin_win ->Label( -text => "Just testing", -font => 'bold',)->pack +(-pady => 10); $bin_win ->Label( -text => "Please click browse and specify a rand +om file.\nThe script will try and print the file path to c:/test/file +path.txt.",)->pack(-pady => 10); my $filepicker = sub { # this sub is launched when the Browse b +utton is pressed, see further down $convert_bin = $mw ->getOpenFile( -title => "Please choose the file", -multiple => 0, ); mkdir "c:/test"; open (OUT, ">:encoding(UTF-8)", "c:/test/filepath.txt") or pri +nt "Can't open file: $!"; # this fails when the script is packed i +nto an exe with PAR::Packer print OUT "File path: $convert_bin"; close OUT; $bin_win->destroy; }; # don't delete this ; my $buttbrowse = $bin_win -> Button(-text=>"Browse", -command =>[\&$fi +lepicker]) -> pack(-pady => 20); } MainLoop;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filehandle open fails in script packed with PAR::Packer
by Anonymous Monk on Jan 14, 2014 at 21:03 UTC | |
by elef (Friar) on Jan 14, 2014 at 21:16 UTC | |
by Anonymous Monk on Jan 14, 2014 at 21:44 UTC | |
by elef (Friar) on Jan 14, 2014 at 22:05 UTC | |
by Anonymous Monk on Jan 15, 2014 at 01:58 UTC | |
|
Re: Filehandle open fails in script packed with PAR::Packer
by elef (Friar) on Jan 17, 2014 at 10:12 UTC | |
by marto (Cardinal) on Jan 17, 2014 at 10:15 UTC |