Do you develop your Perl applications as CPAN modules?

前端 未结 3 1510
后悔当初
后悔当初 2020-12-30 03:34

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 r

相关标签:
3条回答
  • 2020-12-30 04:14

    publishing things to CPAN mean responsibility. you need provide a good document, further supporting and others. or else, don't go CPAN.

    Thanks

    0 讨论(0)
  • 2020-12-30 04:19

    Yes, simply because "CPAN module" only establishes very liberal practices. I prefer Module::Install, I believe most sane people should too. To get a basic distribution running with module install I simply use module-starter:

    module-starter --mi --module "Foo::Bar" --author "Evan Carroll" --email "foo@bar.com"

    Then right after, I edit the pod in lib/Foo/Bar.pm: I don't like pod in the middle of my code. I typically move it all to the bottom and delete the FUNCTION, and VERSION section too, because 99.9% of my modules are OO with Moose, and Module::Install will read it from $Foo::Bar::VERSION.

    Then I run git-init, edit the .gitignore file and add 'MANIFEST', 'Meta.yml', 'Makefile.old', 'blib/', 'inc/', and what ever temp files the editor I'm creating might be using. (If you're pushing to CPAN you'll want to add the .gitignore, and .git/ to MANIFEST.skip that way they don't go up too.) Then I git add ., and I've got my module in git with a bootstrapped build/test system.

    Then I run github, create a repo, upload my module, and add the public repository to Makefile.PL repository git://github.... and start coding.

    Even if you don't push to CPAN, module-install provides a pretty good foundation for a good module.

    Other advantages, you can run make dist, and get a tarball and host it very easily on a private http server, and then simply tell a client or a server to install with cpanp http://host/path. You also get all of the advantages of Module::Install, it will use dmake on windows, and download dmake if you don't have it. It is pretty magical with cross platform goodness.

    There are no major disadvantages, or even note-worthy minor ones.

    0 讨论(0)
  • 2020-12-30 04:22

    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."

    0 讨论(0)
提交回复
热议问题