srlbharu has asked for the wisdom of the Perl Monks concerning the following question:
I am getting the below error only when I try to create child process using fork in the code mentioned below
foreach $cmd(@commands) { if($cmd =~ /CGDCONT/i){ unless (fork) { eval $cmd; if ($@) { print "When executing: $cmd\nFollowing error occured:$@\ +n"; } exit; } } else{ eval $cmd; if ($@) { print "When executing: $cmd\nFollowing error occured: $@\n +"; } } }
Error msg when I run the above code:
Engine::_Execute(..\..\perl\modules/Engine.pm:122): 122: unless (fork) { DB<1> s Bizarre SvTYPE [37] at ..\..\perl\modules/Engine.pm line 122. Engine::_Execute(C:/Perl/lib/Carp.pm:97): 97: { local $@; require Carp::Heavy; } # XXX fix require to not clea +r $@?
It means there are some localized scalar variables are trying to restore in a child process hence throwing error
"Attempt to free unreferenced scalar"
There is some modules where carp.pm is used. I replaced all the places of carp with warn and tried but no luck still it is showing the same. Please let me know how to debug this issue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Forking Problem: Attempt to free unreferenced scalar
by Anonymous Monk on Mar 07, 2013 at 19:36 UTC | |
by srlbharu (Acolyte) on Mar 08, 2013 at 05:02 UTC |