in reply to here document help

First of all (just so you know) the code is using a Bourne Shell heredoc. Not a perl heredoc.

I don't see any problem with the code. I ran the following (on Fedora 6):
#! /usr/bin/perl -w use strict; use Data::Dumper; my @result = `sh << EOF; pwd; sleep 10; date; EOF`; print Dumper(\@result);
The output looked fine:
$ ./ $VAR1 = [ '/home/chad ', 'Thu Apr 3 12:27:32 MDT 2008 ' ];
The ps output looks fine.
6204 pts/1 S+ 0:00 sh -c sh << EOF;?pwd;?sleep 10;?date;?EOF
Have you tried running the command from a shell yourself? I suspect the ssmcons program is hanging. Maybe is not responding or closing the connection.

Replies are listed 'Best First'.
Re^2: here document help
by srinivas_rocks (Sexton) on Apr 04, 2008 at 13:11 UTC
    Thanks for the reply

    I tried to execute the command in the command prompt with an <Enter> after each statement and it is giving me the correct output with out hanging.

    since I am new to this perl programming..can you tell me whether a script working from command prompt will hang when executed from perl script?

    waiting for your valuable suggestions.


      Launching a shell interactively and manually entering the script line by line is different from launching a shell with a here-document.

      I recommend that you either launch the shell with the commands to execute separated by semicolons or that you write out a shell script and launch that shell script from Perl. Both ways are far easier to debug.

      Also, I'm not really sure whether your command line is correct. You should launch the shell with sh -c commands... and not sh comands... I think. But then, I avoid such trickery.