Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: X10 and Windows

by Anonymous Monk
on Aug 06, 2002 at 01:55 UTC ( [id://187889]=note: print w/replies, xml ) Need Help??


in reply to Re: X10 and Windows
in thread X10 and Windows

It seems to be printing the command correctly before the system call, but nothing ever appears after I call 'system($command)' I'm lost!

Replies are listed 'Best First'.
Re: Re: Re: X10 and Windows
by moof1138 (Curate) on Aug 06, 2002 at 02:11 UTC
    You could try calling system() like this:
    system($command) == 0 or warn "System call failed with error # $?";
    Or try using backticks:
    print `$command`;
    Between the two you hopefully should get something useful for diagnostics.
Re: Re: Re: X10 and Windows
by Rex(Wrecks) (Curate) on Aug 06, 2002 at 18:18 UTC
    Try this:
    my @test = system($command) ; print @test ;

    This will give you the command output. Example:
    #!/usr/bin/perl -w use strict ; my @test = system("dir") ; print @test ;

    Will give you:
    Volume in drive E is E_Drive Volume Serial Number is XXXX-XXXX Directory of E:\TempCode\test 08/06/2002 11:05a <DIR> . 08/06/2002 11:05a <DIR> .. 08/06/2002 11:05a 1,336 systemCommand.pl 1 File(s) 1,336 bytes 2 Dir(s) 1,629,966,336 bytes free 0
    While:
    #!/usr/bin/perl -w use strict ; my @test = system("dirt") ; print @test ;

    Will give you:
    'dirt' is not recognized as an internal or external command, operable program or batch file. 256
    This should be usefull in at least telling you if the command is being executed and what the results are.

    "Nothing is sure but death and taxes" I say combine the two and its death to all taxes!
      Thanks, This was helpful, but unfortunatley it returned the number '256' Anyone have anyidea what that relates to? Thanks
        quoted from man page regarding system() :
                       The return value is the exit status of the program as returned
                       by the "wait" call.  To get the actual exit value shift right
                       by eight (see below).  See also "exec".  This is not what you
                       want to use to capture the output from a command, for that you
                       should use merely backticks or "qx//", as described in
                       "'STRING'" in perlop.  Return value of -1 indicates a failure
                       to start the program (inspect $! for the reason).
        
        You can get to this by issuing the "perldoc -f system" command.

        Tiago

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-23 18:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found