in reply to Re: Capitalized subroutine names and packages
in thread Capitalized subroutine names and packages
I agree in spirit but disagree on some of the details. The main thing that should not be done is having a package name that doesn't contain "::".
I'd rather have a subroutine named "Bar" than one named "bar". Consider sub Log versus sub log and then doing log("Error at....") and you'll get "Argument isn't numeric" and "Can't take log of 0".
I try to use multi-word subroutine names so that I can avoid conflicts with both poorly named modules and with keywords that have slipped my mind (or got created since I wrote the code, etc.) by using initial lower case and capitals in the middle ("logToFile"). But when I get lazy and use a single-word subroutine name, then I try to remember to capitalize (if you don't, then you need to always call it with a leading ampersand, &log(), to be safe).
Perl has lots of poorly named modules. The worst two are O.pm and B.pm. But CGI.pm and CPAN.pm are also bad names that should be changed. They don't even work well in English because someone says "I'm using CPAN" and I don't know if they are talking about the module or CPAN itself (the Archive Network, ya know, the thing that you'd know I was talking about when I said "CPAN" if it weren't for someone short-sightedly naming a module that).
All modules should have "::" in their name.
- tye
|
|---|