Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What CPAN modules are "good reads"?

by ghenry (Vicar)
on Jun 13, 2005 at 17:57 UTC ( [id://466235]=note: print w/replies, xml ) Need Help??


in reply to What CPAN modules are "good reads"?

I have learnt a lot from CGI.pm

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!
  • Comment on Re: What CPAN modules are "good reads"?

Replies are listed 'Best First'.
Re^2: What CPAN modules are "good reads"?
by merlyn (Sage) on Jun 14, 2005 at 11:37 UTC
    As in, "What not to do?" {grin}

    Let's see:

    • The "lincoln loader" instead of SelfLoader: check
    • Custom importer instead of Exporter: check
    • Funky "is this a method or a subroutine" repeated everywhere: check
    • Funky "args preceded by dash and/or args inside a hashref": check
    • Odd mix of globals and/or use parameters and/or object instance vars to determine behavior: check
    Admittedly, some of this stuff was created before the core functionality was available. But there's some mighty scary code in there.

    In Lincoln's defense, this code is probably the second most frequently invoked module, after strict, and has had to deal with a lot of legacy issues.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re^2: What CPAN modules are "good reads"?
by bart (Canon) on Jun 13, 2005 at 19:26 UTC
    Better unlearn it fast!

      Yes, it sounds as if I should.

      Walking the road to enlightenment... I found a penguin and a camel on the way.....
      Fancy a yourname@perl.me.uk? Just ask!!!

      Err... why?

        Oh, several reasons. Most of all, it does some things I think were a major mistake, like trying to determine whether a sub is called as a function or as a method, at runtime.

        Furthermore, it has its own "optimization" using AUTOLOAD, defining sub definitions as strings and evalling them at runtime when the sub is first called. Again, it's not something I want to see in every module.

        Leave out those major stumbling blocks (for me anyway), and you do get some readable code, I agree. But the module is still too big for its own good.

        I'm quite convinced there must be many much better examples of modules to use as a model on how to do things.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-16 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found