Hi, Ok, I think this is a perl2exe (www.perl2exe.com) bug but I figured I would post it here just in case anyone had already also run across this. I'm now using Open2 to create a child process for my perl program on win32, and I can't use both open2 *and* the -gui option on perl2exe at the same time.
I've paid for the full version of perl2exe, soley for the use of the -gui option really, and now I can't use it. Here is a perfect example of the problem. This first program is just one that open2's the second program (after compiled) and they talk back and forth a bit. If I compile this first program with the -gui option,the program starts and then dies right away without really doing anything that I can tell. It won't even print anything out if you run the exe from a console. But, if you just don't compile it with the -gui option, then it works great.
#!/usr/local/bin/perl -w
print "got here!\n";
use Tk;
use IPC::Open2;
$| = 1;
###open2(\*IN, \*OUT, "$^X f2.pl");
open2(\*IN, \*OUT, "f2.exe");
my $mw = new MainWindow;
$mw->Label(-text => 'Print file')->pack;
my $font = $mw->Entry(-width => 10);
$font->pack;
my $filename = $mw->Entry(-width => 10);
$filename->pack;
$mw->Button(-text => 'make test1 file',
-command => sub{print OUT "test1.txt\n";}
)->pack;
$mw->Button(-text => 'make test2 file',
-command => sub{print OUT "test2.txt\n";}
)->pack;
$mw->Button(-text => 'Exit',
-command => \&my_exit
)->pack;
MainLoop;
sub my_exit {
print OUT "die\n";
close IN;
close OUT;
exit;
}
Here is the code for f2.exe which you can compile with our without -gui into f2.exe.
#!/usr/local/bin/perl -w
use IPC::Open2;
$| = 1;
while ($line = <STDIN>) {
last if ($line =~ /die/i);
#print "child_got_this:$line";
chomp $line;
open TTT, ">$line";
print TTT "file is $line\n";
close TTT;
}
exit;
Again, I think this is a problem with perl2exe, and they are looking into it, but I thought people here might like to know about this or like the challenge as well. Thanks!
Justin Eltoft
"If at all god's gaze upon us falls, its with a mischievous grin, look at him" -- Dave Matthews
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.