Making progress

So I have been making slow but steady progress with my studies. Up to chapter 20 now of the book (CCNA). I’ve also been bumping my head against some pitfalls/restrictions in Perl 5.
I had to write some quick and dirty hacks to stop my app from crashing after I added automatic translations. I had tried try and catch loops but the program would still crash if not on the first occerance of the error but the second or third.
I ended up doing the following:
[code language=”perl”]
my $meaning;
$meaning = undef;
eval { $meaning = $dictionary->get_meaning($translatekey); }; warn $@ if $@;
if ($@) {
return "Error word definition not found!\n";
} else {
$meaning =~ m/(1[^2]*2)/;
$meaning = $1;
$meaning =~ s/\n//g;
$meaning =~ s/2//g;
$translatedtxt .= "Dictionary definition:\n" . $mea ning . "\n";
return $translatedtxt;
It stops the translator module from crashing my app. It also allows me to return a value to the part of the code that called this subroutine (it returns text with “Error …”).
This program works well but the response time now is over 1 second to retrieve the translations.
It took me sometime to figure out how to add a BoxSizer to wxWidgets and the documentation on wxPerl is hard to come by – a sign that Perl is not attracting as many developers as it should/could/deserves.
The full source code is on my Github page.
I plan to mess around with some more Cisco labs soon so hopefully I can write about something other than Perl soon….

Leave a comment

Your email address will not be published. Required fields are marked *