Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Not able to collect data from ``

by gvinu4u (Acolyte)
on Jun 04, 2010 at 02:25 UTC ( #843041=perlquestion: print w/ replies, xml ) Need Help??
gvinu4u has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I'm not able to collect the data $data="install app device_path"' $Result=`$data`; The success output is <code> c:\Automation>install app device_path <blank> c:\Automation> <\code> Failure output is <code> c:\Automation>install app device_path <blank> Error: Code 254587 <blank> c:\Automation> <\code> I also tried with STDERR redirecting even that did not work $Result = `$Data 2>&1`; Please help me on this thanks in advance

Comment on Not able to collect data from ``
Re: Not able to collect data from ``
by almut (Canon) on Jun 04, 2010 at 05:32 UTC

    With proper formatting (<c>...</c> tags for code, <p>...</p> for other paragraphs), your post would have looked like this:

    Hi all, I'm not able to collect the data

    $data="install app device_path"' $Result=`$data`;

    The success output is

    c:\Automation>install app device_path <blank> c:\Automation>

    Failure output is

    c:\Automation>install app device_path <blank> Error: Code 254587 <blank> c:\Automation>

    I also tried with STDERR redirecting even that did not work

    $Result = `$Data 2>&1`;

    Please help me on this thanks in advance

    Also, instead of saying "I'm not able to", or "it doesn't work" etc., it's better to describe what exactly is happening, for example that the script does not run because it's producing an error message (if so, which?), or that the install command does not run, or that it does run, but its output goes to the console, etc.

    In case the script doesn't run, that could be because your code as shown does not compile (note the superfluous trailing single quote/missing semicolon).  Also, $data and $Data are two different variables in Perl.

Re: Not able to collect data from ``
by cdarke (Prior) on Jun 04, 2010 at 07:52 UTC
    It is possible that it cannot run the install program. The reason might be that it cannot find the program file, or you do not have permissions, or something else. Rather than trying to guess the reason though, it would be better to test the exit code in $? after the `back-ticks` command.

    Since you are running on Windows, make sure you are running this from CMD.EXE, not by double-clicking from Windows Explorer. Sometimes an error message is written directly to the console by the Windows shell, by-passing STDOUT and STDERR, for example
    'install' is not recognized as an internal or external command, operable program or batch file.
    and that might be missed.
      Thanks for the reply Dark.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2014-08-21 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (141 votes), past polls