Noame has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I have SSH question.
I have Perl script (genMakeFiles.pl) on WIN remote machine which executing ¡¥MSDEV¡¦ command to export a makefile from a Visual C++ V6.0 project (.DSP) file.
I wrote another Perl script - BuildMakeFiles.pl, that running on Unix machine and connecting to the remote Win machine with SSH command and executing the above Perl script (genMakeFiles.pl).
To make the long story short: BuildMakeFiles.pl (UNIX) „³ SSH „³ genMakeFiles.pl (WIN) „³ MSDEV.
In case that MSDEV command will fail it present message box to the windows with question and BuildMakeFiles.pl is stuck.
How can I catch this scenario? I think to write a timer that after 3 min. Will return an error something like the code below:

my $buildCMD = "$sshCMD \"perl $VM_HOME/genMakeFiles.pl " . "-u $ST_USER " . "-p $ST_PASSWORD " . "-v $ST_VIEW " . "-l $ST_LABEL\""; print "-I- $buildCMD"; my $counter = 1; open (CMD, "$buildCMD | ") or die "\n-E- system '$buildCMD' failed: ($ +?) ($!)"; while (<CMD>) { print "$_\n"; sleep 1; $counter++; if ($counter < 180) { print "\n\n-E- Failed to generate MAKE file ¡V Exiting. \n"; exit 1; } }

Please advice.
Thanks.

Replies are listed 'Best First'.
Re: SSH Qustion
by Anonymous Monk on Apr 16, 2009 at 11:10 UTC
    Add a timer using alarm, but also improve genMakeFiles.pl so it doesn't block forever
      How can I open Perl command with ‘open’ command (as describe in the example) and use 'while' command.
      Because when I opened Perl command using 'open' command the script start to run and I can add more manipulation on it like timer and etc.
      Please advice
Re: SSH Qustion
by Bloodnok (Vicar) on Apr 16, 2009 at 11:31 UTC
    Does VC++ support OLE ?

    If so, I'd seriously consider using Win32::OLE in genMakeFiles.pl to talk to VC++ to generate the make file.

    A user level that continues to overstate my experience :-))
Re: SSH Qustion
by cdarke (Prior) on Apr 16, 2009 at 13:54 UTC
    Are you still using VC 6 because of the ability to generate makefiles? If it helps, I have a perl script which converts VS .Net .dsp files into UNIX makefiles. It is OK for relatively simple projects, but you can always use it as a base. I used it to convert around 300 projects without any issues. It is on my scratchpad.
      Hi
      I've cheked the script and it is nice but basic.
      My DSP files are complicated, currently the best and secure way is to generate them to makefiles from VC 6.
      Thanks.