How to tell CPAN (Perl) about packages created with meta

I have several CPAN modules that make extensive use of meta-programming to cut down on boiler-plate and to ease refactoring.

The consequence of this however is that there are many packages that get created programmatically, thus there is never a package X::Y::Z; line in the source code for CPAN to find (and then use to add the namespace to your first-come list of reserved namespaces).

So my question is if there is a preferred way of letting CPAN know about these runtime created packages. Here are the options I am currently considering:

  • Manually search down all of the packages and create a dummy pm file for CPAN to index.
  • Manually search and then update Build.PL to include them in the provides list.
  • Add some code to the meta-programming routines to keep track of which packages are used, and add a hook into to build dist to update the provides or some other section of META.yaml
  • The last option is currently what I am leaning towards. I'd like to know if there are any problems with this approach, or any better ways of keeping CPAN updated with the complete list of packages.


    If I'm reading you correctly this is a non-issue, providing you don't clobber other namespaces. There is no pre-requisite to declare every namespace created, only the base namespace of your distribution and the files associated with the distribution. If you wanted to "reserve" certain namespaces, instead of creating blank .pm files, look at creating .pod files and document instead.

    链接地址: http://www.djcxy.com/p/49086.html

    上一篇: 使用C#从Active Directory获取组

    下一篇: 如何告诉CPAN(Perl)使用meta创建的包