Discussion:
Why to use a lib folder for a CPAN module
Alex Becker
2014-10-08 17:59:12 UTC
Permalink
Hi!

When creating the base for a new CPAN module using h2xs (e.g. with the
command h2xs -b 5.10 -XA -n Super::Duper::Module), there is a lib folder
created.

In this lib folder, the name space is mirrored by a directory tree (e.g.
lib/Super/Duper/Module.ppm).

Now, while browsing CPAN, I noticed some older modules not having a lib
folder.

So, I personally like the lib folder because it's easy to identify where
the module's code resides.

But, is there any other advantage? Or to ask in another fashion: is it
recommended to use a lib folder and if yes, why?

Kind regards,
Alex
Shlomi Fish
2014-10-09 08:22:33 UTC
Permalink
Hi Alex,

On Wed, 8 Oct 2014 19:59:12 +0200
Post by Alex Becker
Hi!
When creating the base for a new CPAN module using h2xs (e.g. with the
command h2xs -b 5.10 -XA -n Super::Duper::Module), there is a lib folder
created.
First of all, you should not use h2xs, but rather Dist-Zilla or Module-Starter
( https://metacpan.org/release/Module-Starter ).
Post by Alex Becker
In this lib folder, the name space is mirrored by a directory tree (e.g.
lib/Super/Duper/Module.ppm).
Now, while browsing CPAN, I noticed some older modules not having a lib
folder.
Yes, and it's a bad idea.
Post by Alex Becker
So, I personally like the lib folder because it's easy to identify where
the module's code resides.
But, is there any other advantage? Or to ask in another fashion: is it
recommended to use a lib folder and if yes, why?
Using a lib folder makes everything ordered and nice, and allows you to do
perl -Mblib or sometimes perl -Ilib / etc. and is good for good measure. NEVER
Scatter your modules elsewhere.

Regards,

Shlomi Fish
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
Beginners Site for the Vim text editor - http://vim.begin-site.org/

To have bugs is human; to find them — divine.

Please reply to list if it's a mailing list post - http://shlom.in/reply .
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
http://learn.perl.org/
Ken Peng
2014-10-09 08:24:48 UTC
Permalink
Module-starter is cool. I always use that for my packages management.
Post by Shlomi Fish
First of all, you should not use h2xs, but rather Dist-Zilla or Module-Starter
(https://metacpan.org/release/Module-Starter ).
--
To unsubscribe, e-mail: beginners-***@perl.org
For additional commands, e-mail: beginners-***@perl.org
http://learn.perl.org/
Loading...