develooper Front page | perl.beginners | Postings from September 2009

typical errors beginners make

Thread Next
Gabor Szabo
September 19, 2009 10:55
typical errors beginners make
Message ID:

there are a bunch of errors that beginners make a lot and that perl
does not catch or that the given error message is too generic.

use warning;

In my perl training classes the first thing I teach is to use strict;
and use warnings;
For some reason - maybe because my students are not English speakers -
many of them type

use warning;

Which gives them the following error:

Can't locate in @INC (@INC contains:
/home/gabor/perl5lib/lib/perl5 /home/gabor/perl5lib/lib/perl/5.10.0
/etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10
/usr/share/perl/5.10 /usr/local/lib/site_perl .) at line 3.
BEGIN failed--compilation aborted at line 3.

This is very frustrating to see.

A few hours into the course it is already ok to explain them what does
this kind of error mean but not in the first hour or so.

Also when someone is learning on her own - like most of the people on
this list - I believe a better explanation would
make the learning experience more pleasant.

Hidden variables

Another error I see often is people writing

if ($line = /blabla/) {


This is a syntactically valid perl code but it is very unlikely the beginner
knows what this means so I'd like to help them avoid falling into this trap
by catching this code and explaining to them.

Padre beginner mode and your help

In Padre we added a "beginner mode" that will catch some of these
typical errors.
We have a naive implementation that will probably miss most of the important
cases and our messages aren't yet good either but it is a start.

The documentation of what we have now can be found here:

That is where I am looking for your help.

If you install and try Padre that's wonderful but even if you don't
use Padre you can help.

If there are common mistakes that you feel should be caught by perl or
where the error message
could be more helpful, please tell me (or the other Padre developers)
about them.

That will be a huge help for the next person who learns Perl and who will
get a better explanation of what went wrong.



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About