Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: ActivePerl - perl.exe works, wperl.exe does not...

by Anonymous Monk
on Jan 25, 2012 at 03:28 UTC ( #949817=note: print w/ replies, xml ) Need Help??


in reply to ActivePerl - perl.exe works, wperl.exe does not...

Add this at the top of your program

BEGIN { use Win32 qw(SW_HIDE); Win32::SetChildShowWindow(SW_HIDE); my $perl = $^X; if( $perl =~ s/wperl.exe/perl.exe/i ){ system(1, $perl, $0, @ARGV ); exit; } }


Comment on Re: ActivePerl - perl.exe works, wperl.exe does not...
Download Code
Re^2: ActivePerl - perl.exe works, wperl.exe does not...
by spstansbury (Monk) on Jan 26, 2012 at 18:52 UTC

    This works...

    Given that I can run perl.exe with no child window, I can scrap wperl.exe... ;)

    Clearly there's some other difference between the two binaries - I have other wperl scripts that run fine, it was just theNet::SFTP::Foreign line:

    my $sftp = Net::SFTP::Foreign->new( $host, user => $user, password => $password, ssh_cmd => 'plink' );

    that wperl choked on that perl.exe handled without a problem...

    Thanks much for your help! Scott...

      The difference is STDIN/STDOUT/STDERR/

      wperl.exe, being a windows GUI application, doesn't have these

      perl.exe, being a windows console (cmd.exe) application, does have these, but it also has a console window

      So you start wperl because it has no console window, make sure the children get hidden, then launch a hidden perl.exe , because it has a console and STDIN/STDOUT/STDERR

      Apparently Net::SFTP ... needs a STDIN/STDOUT/STDERR for pipes and such

        Lovely, thank You..:-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://949817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2015-07-07 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls