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

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
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?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2015-11-29 22:22 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (753 votes), past polls