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 开发者_StackOverflowthere 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 theprovides
or some other section ofMETA.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.
精彩评论