Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: eval a command

by tmharish (Friar)
on Feb 21, 2013 at 14:13 UTC ( #1019952=note: print w/ replies, xml ) Need Help??


in reply to eval a command

The following code exists and the fork prints "Hello World" after the required 5 sec.

use strict ; use warnings ; my $cmd = 'sleep 5; print "Hello World\n";' ; my $pid = fork(); if (defined $pid && $pid == 0) { # child eval $cmd; } exit 0;

OS, Perl version and details on the command you are trying to execute might help


Comment on Re: eval a command
Download Code
Re^2: eval a command
by Xantara (Initiate) on Feb 21, 2013 at 14:56 UTC

    All the commands that I run are subroutines of perl modules only. Execution of the $cmd, calls userdefined perl module API. In my case $mci->Do(); OS - Windows XP Perl Version 5.6

      If you can update from 5.6 its probably a good idea.

      On the other hand did you try to directly call that function and see if that works. Also why not just call these functions instead of using eval?

      5.6 is over ten years old, seriously consider upgrading if at all posible.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (16)
As of 2014-12-19 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (90 votes), past polls