Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you develop your Perl applications as CPAN modules?

Recently I read a blog post saying that it is a good practice to develop Perl applications just as you would develop a CPAN module. (Here it is – thanks David!) One of the reasons given was that you could simply run cpan . in the project dir to install all the dependencies. This sounds reasonable, and I also like the “uniform interface” that you get. When you come across such an application, you know what the makefile does etc. What are other advantages and disadvantages to this approach?


Update: Thanks for the answers. I’ve got one more question about the dependency installing, I’ll post it separately.

like image 260
zoul Avatar asked Nov 05 '09 11:11

zoul


People also ask

What is CPAN module in Perl?

The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors.

How modules are created in Perl?

Creating a moduleA module in Perl is just a file in which there is a single namespace (package) and where the name of the file is the same as the name of the package inside with the . pm extension. So in our case if we rename the namespace_lib.pl to be Calc.pm then suddenly we have a module.

What is the difference between CPAN and Cpanm?

The main difference between the two is that if you have Perl you should already have the cpan command. Whereas you won't have cpanm unless/until you install it.


1 Answers

Generally, yes, I'd say it's a good idea. Catalyst makes this easy, as the catalyst.pl helper script will set up a basic framework for your web app, completed with a Makefile.PL etc.

This means that packaging your application and deploying it to a server is trivially easy.

Edit: I think the original blog post you were thinking of was Write your code like it's going on CPAN from Perlbuzz.

"By treating code we were never going to release to CPAN as if we were, we win the support of all of the CPAN toolchain. A toolchain that is getting better every day."

like image 189
David Precious Avatar answered Oct 23 '22 07:10

David Precious