Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: eval a command

by tmharish (Friar)
on Feb 21, 2013 at 14:13 UTC ( [id://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

Replies are listed 'Best First'.
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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1019952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-03-19 03:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found