How do I choose a package name for a custom Perl module that does not collide with builtin or CPAN packages names?

前端 未结 6 544
南方客
南方客 2020-11-30 03:37

I have read the perldoc on modules, but I don\'t see a recommendation on naming a package so it won\'t collide with builtin or CPAN module/package names.

In the past

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 04:04

    If you need the maximum level of certainty that your module name will not conflict with someone else's you can take a page from Java's book: name the module with the name of the companies domain. So if you work for Example, Inc. and their domain name is example.com, you would name your HTML parser module Com::Example::HTML::Parser or Example::Com::HTML::Parser. The benefit of the first is that if you have multiple subunits they can all have their own name space, but the modules will still sort together:

    • Com::Example::Biz::FindCustomers
    • Com::Example::IT::ParseLogs
    • Com::Example::QA::TestServer

    but it does look odd at first.

提交回复
热议问题