develooper Front page | perl.perl5.porters | Postings from October 2011

[perl #101976] [PATCH] Remove cruft from the module example

Thread Next
Father Chrysostomos via RT
October 23, 2011 14:27
[perl #101976] [PATCH] Remove cruft from the module example
Message ID:
On Sat Oct 22 19:42:51 2011, schwern wrote:
> I noticed that the module example in perlmod is a bit long, crufty and
> out of
> date.  I wouldn't teach someone to write a module like that.  It
> hasn't been
> seriously touched in about 10 years.  This patch fixes up the most
> glaring
> problems while retaining its utility as a teaching boilerplate.
> * require Exporter instead of use with no import
> * Declare and initialize variables together.
> * Eliminate archaic RCS/CVS versioning clutter.
> * Explain what @ISA does.
> * Remove archaic (and slower) &func syntax from exporting
> * Remove %EXPORT_TAGS.  It's not explained and rarely used.
> * Remove redundant @EXPORT_OK
> * Use cleaner $priv_func->() syntax rather than &$priv_func.

My only objection is that newbies often think $priv_func->() looks too
much like a method call and wish Perl had an alternate syntax.... :-)  I
seem to remember a discussion about that some time ago.  I personally
use & all the time, as it’s shorter than ->.

> * Eliminate prototypes, they're clutter, rarely used and dangerous.

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