Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Exec() argument format

by sacked (Hermit)
on Jul 25, 2005 at 21:32 UTC ( [id://477982]=note: print w/replies, xml ) Need Help??


in reply to Exec() argument format

Is ComLine.pl executable?

What is the value of $! after the failed call?
exec('ComLine.pl', @args ) or die "Can't exec: $!";
Aside, you'll generally want to use system rather than exec because exec never returns. Instead, it replaces the currently running program with the program passed as the first parameter.

If you have any code that follows the call to exec, you should use system instead.

Please see perlfunc for details about the return values from exec and system.

--sacked

Replies are listed 'Best First'.
Re: Exec() argument format
by MonkPaul (Friar) on Jul 25, 2005 at 21:52 UTC
    Ok, it says cannot execute - No such file or directory.
    ALthough im passing in the file off command line anyway.

    The ComLine.pl is executable. Im at a loss here.

    I was thinking of using system() but there is no code afterwards and im printing out to a web page in anothe file so i didnt want to lock anything.

      As suggested by eyepopslikeamosquito above, consider using the full path to the ComLine.pl program:
      exec( '/path/to/ComLine.pl', @args ) or die "exec: $!"
      or invoke the Perl interpreter ($^X, documented in perlvar), also suggested above.

      --sacked
        Sure but both my files are in the same location. i guess the $^Xsolution is the next best bet.

Log In?
Username:
Password:

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

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

    No recent polls found