Open Source rocks, learning from code by debugging --page 2--

When started you can step trough the program using the F11 key, so after pressing the F11 for a while the podviewer pops up. Using the debugger I can just watch the program walking trough all kinds of external modules which are subsequently opened in the editor.
This is great for learning to understand what it's doing. When a loop gets executed it shows the highlighted line going up and down. I can even see the program building variables in loops as it is showing the contents on screen. After a while the program pauses execution as there is no next step without user input. Now the podviewer is only waiting for input and that's exactly what I'm going to give it.

Here's a screenshot showing the debugger running the podviewer down left it's showing current variable values:

I enter the value text in the box for the name of the perl module I want to show the documentation for, this is none existent but I don't need it to show any document anyway. What I'm after is the place in the code where the value in this box is used.

On the moment I enter a letter in the box the program execution goes to this function:

$combo->entry->signal_connect('changed', sub {
if ($combo->entry->get_text eq '') {
$load_button->set_sensitive(0);
} else {
$load_button->set_sensitive(1);
if ($combo->entry->get_text =~ /::/) {
$up_button->set_sensitive(1);
} else {
$up_button->set_sensitive(0);
}
}
});

In combination with the knowledge of the program's behavior this piece of code becomes pretty clear, my knowledge of Perl is very limited but I understand it responds to a change in the box and executes a subroutine. If the box is empty the load button (this is the button next to the box) is made inactive.
In all other cases it's set active, if it contains :: then the up button is also activated.

I press F11 folowed by another letter in the box and the loop executes again starting from
if ($combo->entry->get_text eq '') {

After I enter the text "text" in the box and click the load button next to the box, program execution continues.

The next screenshot shows the variable value I just entered in the podviewer, in the debugger and it's place in the code. It seems like I found the first place where the value entered is used (and it's name).

Now I have an entry for further analyzing of the code, so I can start learning more about it and experiment with some modifications. I think it's so amazing what I can do because this podviewer is open source and all the libraries it uses are open source. This makes it so incredibly transparant as I can watch the internals of all related modules while the program is executing.

This is it for today, in the next article I'll be writing more about experimenting with this code. Comments are appreciated, it can take a while before they get published. (different time zone)

back to page 1