Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 933
Eric Strom Avatar asked Nov 30 '10 19:11

Eric Strom


1 Answers

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.

like image 102
squeeks Avatar answered Nov 06 '22 13:11

squeeks