Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: 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 07:36 UTC ( [id://1114877]=note: print w/replies, xml ) Need Help??


in reply to Re: 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.

Hello GotToBTru,

Thank you for your time and effort reading and replying to my question. Well to be honest I am not really familiar with debugging Perl. I searched online and I found that I should execute the code like perl -d main.pl. When I do that the script stops at line 10 and gives me the following error when I type l:

Loading DB routines from perl5db.pl version 1.39_10 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(main.pl:10): our %WARNS = (); DB<1> l 10==> our %WARNS = (); 11: my %dir_all = (); 12: my %sudo_passwords = (); 13 14: my $confFile = "conf.ini"; 15: my $dirFile = "directories.ini"; 16 17: my $objectFiles = FiLeS->new( "confRef" , "dirRef" ); 18: my $refHashDir = $objectFiles->getFiles( $dirFile ); 19: my $refHashconf = $objectFiles->getFiles( $confFile ); DB<1>

How can I proceed from that point. I tried all commands in debug help.

I have added all missing modules just in case that someone wants to experiment.

Seeking for Perl wisdom...on the process of learning...not there...yet!
  • Comment on Re^2: Use of uninitialized value $selector in split at /usr/local/share/perl/5.18.2/Net/OpenSSH/Parallel.pm line 141.
  • Select or Download Code

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

    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

      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 :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found