On Sun, 04 Jun 2006 11:06:40 -0600, tinti <[EMAIL PROTECTED]> wrote:
I have a problem when executing a command file (.cmd) in perl using
win32-gui. When I am running my script with perl -w file.pl
everything works fine but as soon as I am building an .exe file using:
pp --gui -I lib -c -i lib\favicon.ico -o file.exe file.pl
my program is running all .cmd files in a command prompt box.
First, don't use exec() unless you want your perl script to exit.
Second, you don't need (and almost certainly don't want) $0 = ...
When you run 'perl -w file.pl', you're running it in a command prompt
(although you may be hiding it at the start of your program). In this
case, the system reuses your existing prompt box. But when you run it as
'file.exe', you don't have one, so the system makes one for you.
I don't have much experience with PAR, but I suspect that taking off the
--gui option will fix your problem. Of course, then you'd get the flicker
of the command prompt window showing up briefly before being hidden.
While I have not tried it, a quick gance at the documentation suggests
that Win32::Console might be another way to go; the docs indicate you can
create a console in memory.