in reply to Re^2: Use of uninitialized value $selector in split at /usr/local/share/perl/5.18.2/Net/OpenSSH/Parallel.pm line 141.
in thread Use of uninitialized value $selector in split at /usr/local/share/perl/5.18.2/Net/OpenSSH/Parallel.pm line 141.

My suggestion is actually to do some homework before you start the debugger, because it will help you figure out what you can skip over and what you need to actually watch closely. Look in Parallel.pm at line 141, and figure out how the value of $selector is assigned. See what subroutine within Parallel.pm you're in, and look in your code for where you call that particular subroutine. That's where you need to start.

Your next step is to go to here to read the Perl debugger tutorial. Are you familiar with debuggers? It allows you to execute your program one statement at a time, and inspect the values of variables. It is an invaluable aid to finding and fixing bugs. Your research will tell you where to set a breakpoint in your code; the debugger will execute the lines up to the breakpoint and stop there. Now you can inspect your variables and make sure that the value which will end up in $selector has the value you expect.

Update: looks like NetWallah has already done some of this for you. Either put a watch on $Ubuntu_ip, or set a breakpoint for line 144, the foreach my $Ubuntu_ip .... Inspect $refHashConvertArrayUbuntu to see if it has the values you expect.

Dum Spiro Spero
  • Comment on Re^3: Use of uninitialized value $selector in split at /usr/local/share/perl/5.18.2/Net/OpenSSH/Parallel.pm line 141.
  • Download Code

Replies are listed 'Best First'.
Re^4: Use of uninitialized value $selector in split at /usr/local/share/perl/5.18.2/Net/OpenSSH/Parallel.pm line 141.
by thanos1983 (Parson) on Jan 29, 2015 at 23:10 UTC

    Hello GotToBTru,

    Thank you again for your time and effort replying back to my question. Well I tried a few times to play around with the perl debugger, it seems to be something really good. But to be honest someone needs to spend some time to get use to it, it is not the easiest thing to play around.

    Well ase you said I did my research and unfortunately the foreach my $Ubuntu_ip .... was not the error because it was printing normally.

    So the next step I thought that I was not able to close the fileHandles so I used die conditions instead of warnings for debugging at least. My assumption was wrong again, then I start printing the process step by step manually and I noticed that I was passing empty values on my objects and I was not able to understand why.

    Then as I final step I remember that when I was passing a value to an object I had to use reference to the value. So when I used references where was needed it worked perfectly.

    I guess the process would have been extremely faster with a debugger instead of doing it manually, thank you for the proposal I will try to start applying it from now on.

    Seeking for Perl wisdom...on the process of learning...not there...yet!

      Maybe a little less code would have made it easier also :-)

        Hello poj,

        Thank you for your time and effort, it looks much better than mine, I will update my approach. There are so many things that I need to learn. :D

        Seeking for Perl wisdom...on the process of learning...not there...yet!