Thread: naming modules
View Single Post
  #3 (permalink)  
Old 03-26-2012, 08:24 AM
Ivan Shmakov
Guest
 
Posts: n/a
Default Re: naming modules

>>>>> Ben Morrow <ben@morrow.me.uk> writes:
>>>>> Quoth Ivan Shmakov <oneingray@gmail.com>:


[...]

>> In particular, I understand that a module name shouldn't be
>> comprised of just the lowercase letters, so to avoid a potential
>> name clash with a future Perl pragma. However, is there a reason to
>> avoid all-lowercase names containing colons (as in, e. g.,
>> common::sense)?


> I would say that module names with the first part all in lowercase
> should be considered reserved: the core has warnings::register, for
> instance, and there are version::AlphaBeta and version::Limit on CPAN
> which are subclasses of version. OTOH there are quite a lot of
> modules with parts after the first in lowercase: LWP::Protocol::*,
> for instance, or quite a few of the DBD modules.


ACK. Thanks!

However, for LWP::Protocol::* it's due to the fact that the URI
schema names are all-lowercase themselves, I suppose.

Unfortunately, even though I dislike mixed-case identifiers, I
have no good reason at hand to avoid it for my Perl code.

> common::sense considers itself to be pragmatic in nature, since all
> it's doing is turning on various core pragmas.


There still is a potential clash should the Perl developers
choose to implement their own common::sense.

>> The other question is whether I should use foo::bar or
>> App::Foo::Bar for the modules related to an application Foo?


> App:: is for implementations of applications, not modules which
> relate to them. So, for instance, App::Ack implements the guts of
> ack(1), rather than being an interface for calling it.


Actually, there's to be the modules that handle a format, or
perhaps a faimily of formats, specific to this particular
application.

If App::MyApp::MyFormat doesn't fit, should it be, e. g.,
Data::MyApp::MyFormat?

>> And then the third one. I intend to provide a module to compute
>> multiple SHA digests at the same time (as may be used, e. g., to
>> generate Debian list files.) The working title is
>> Digest::SHA::combined, but I wonder if I should use
>> Digest::SHA::Combined for consistency instead?


> Yes. Unless you've got a good reason not to, go with WikiWords with
> initial caps and no underscores.


Having C, Shell and Lisp dialects as my "programming
background", I find it quite hard to write in CamelCase.

PS. I'll try to file an RT ticket against Digest::SHA on whether my
module could be added to the distribution.

--
FSF associate member #7257
Reply With Quote