in reply to Re^2: Calling a sub routine from an object
in thread Calling a sub routine from an object

I can't see anything wrong with the way you're calling the sub (this doesn't really have anything to do with OO btw, the ForkManager is OO but your code just uses it normally). If you say that $a is being printed, then I suspect something is going wrong in the sub. Could you try to implement a minimum piece of real code which can be run on it's own and illustrates your problem (i.e. strip out anything that's not necessary to make it fail)? That will make it possible for us to find out what's going wrong.

Wild stab in the dark: I think this is again just a typo, but to be sure, you have:

if (b) { discover (b); sub discover { do lots of repetitive stuff }

Obviously "b" should be "$b" as mentioned before, but you also have a right brace missing:

if ($b) { discover ($b); } sub discover { # do lots of repetitive stuff }
As I said, I guess that won't be the problem, just double-checking.

There are ten types of people: those that understand binary and those that don't.

Replies are listed 'Best First'.
Re^4: Calling a sub routine from an object
by carric (Beadle) on Jan 05, 2006 at 20:53 UTC
    As I should have done to start with, I went back and put a little debug line in my script within the sub, and as you suspected, it's running the sub, but NOT executing all the way through like it was when I wasn't forking it with this module (pun intended). The sub is supposed to kick off several nmap scans, save the output to different files per network, etc. and it simply isn't doing it. The issue ISN'T what I thought it was.. for some reason, it appears the fork mgr runs the parts of the sub it feels like running, and chunks the rest.. I have it set to do 8 threads, and each thread should take a while, but it rips through a list of 20 networks instantly, prints them all out, and does nothing further, so I guess I gotta figure out what's different. I appreciate your help. UPDATE: Well, as it turns out, I had hosed the path to nmap in my subroutine, and Perl wasn't telling me. I'm thinking I GOTTA learn how to use the debugger.
      I'm thinking that instead of a debugger, you should probably be checking return values from something. If your program called nmap directly, did it also check the exit status from nmap to make sure it worked properly? Debuggers are useful, yes, but more important is writing code to tell you what goes wrong when something does go wrong.