Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: base.pm vs @ISA (typos)

by tye (Sage)
on Oct 08, 2007 at 14:44 UTC ( #643475=note: print w/replies, xml ) Need Help??


in reply to base.pm vs @ISA

For me, the major advantage of base.pm was that it originally would catch typos for you. Since use base qw( Food::Barf ); would die if there was no Food/Barf.pm to load (because the module's name is actually Foo::Bar).

But Schwern's careless featuritis broke that most important feature and broke it so badly that Schwern basically abandoned the module as unfixable when he finally noticed his mistake.

I think the breakage is fairly easy to fix so I'm quite disappointed that Schwern not only broke a nice module but also chose to not fix it. Not that I'd go back to using the module any time soon after it was fixed, since there would still be too many broken versions of it in circulation.

Luckily this is no big loss for me since it only saves one line of typing, the typos can still be caught by basic unit testing, and I hardly ever use inheritance in Perl anyway.

Update: I have a distinct memory of looking at the source code to base.pm when I first started using it and finding something extremely simple. Looking around now I suspect that this is a false memory and base.pm may have been broken in some of these ways all along. Mea culpa. It wouldn't be the first time the "obvious design requirement" (to me) was only in my head.

- tye        

Replies are listed 'Best First'.
Re^2: base.pm vs @ISA (typos)
by adrianh (Chancellor) on Oct 09, 2007 at 11:52 UTC
    For me, the major advantage of base.pm was that it originally would catch typos for you. Since use base qw( Food::Barf ); would die if there was no Food/Barf.pm to load (because the module's name is actually Foo::Bar).

    That's interesting. I never knew base() ever did that. When did the functionality change?

    Personally I like the current behaviour more - since I can switch between inline and file-based classes without having to change any code. A definite plus as far as I'm concerned.

      There is little reason for the two features to be mutually exclusive.

      All that is needed is a better choice for when to not require and to not then also ignore if require fails.

      Also note that the behavior that several people have had problems with and that caused me to stop using the module (and that Schwern appeared to abandon trying to fix) is the one that forces people to add require even though they used base. So running into that problem would break your favorite feature.

      So the fixes I would make would prevent your pet feature from breaking.

      Also note that there are several pitfalls to putting multiple related classes into a single file (just a few days ago somebody at PerlMonks had exactly that problem) and base.pm as I would fix it would require that parent classes be defined before derived classes, which might catch some problems for some people but might be inconvenient for you.

      - tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2022-01-24 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?