http://www.perlmonks.org?node_id=824943

markus_b has asked for the wisdom of the Perl Monks concerning the following question:

I've inherited the maintenance of the PDF::Create module on CPAN. This module consists of five modules (.pm) in three directories PDF, PDF/Image and PDF/Page. The entire API goes through the main module in PDF/Create.pm, or via objects created through it. No user code calls the others directly.

In order to simplify the maintenance (only one $VERSION to care for) and straight line the module I'm contemplating to remove the subdirectories and move the modules there (with slight renaming) to the PDF directory.

The changes required are small and all my (admittedly limited) tests work fine with the new arrangement without change.

I'm looking for wisdom and discussion on my endeavor.

Markus

Replies are listed 'Best First'.
Re: Simplifying CPAN module namespace
by toolic (Bishop) on Feb 23, 2010 at 21:38 UTC
    One concern would be to preserve backward compatibility for existing code. As long as no one was advised to reach down into one of the modules (for example: PDF::Image::GIF->new();), there should be no problem. Since the POD for PDF::Create does not seem to allow for that possibility, you are probably safe.

    Another concern is name collisions. Is it possible for you to somehow check other CPAN PDF distributions for .pm files which match your new names? For example, if some other dist has a file PDF/Foo.pm, you shouldn't name your file as such. This is by no means a complete list, but it is a good place to start.

      Yes, backwards compatibility is a must. Nobody should have used any other module directly, nothing was documented that way (and the module source is almost devoid of any comment), so the chance is slim. Of course, there always might be that daredevil who knows better.

      I did check the others on the same namespace (PDF::<xxx>) and there is a bunch, but nothing will collide. I thought to rename them anyway (PDF::Create::Page -> PDF::CreatePage, PDF::Image::GIF -> PDF::CreateGIF) to make it obvious that they belong together.

      I'm worried too about side-effects of CPAN. For example, what will happen to the (now orphaned) subdirectories ?

      Markus

Re: Simplifying CPAN module namespace
by Herkum (Parson) on Feb 26, 2010 at 18:31 UTC

    Another problem with the CPAN installation process is it does not delete files only creates and updates. Deletes are not part of the normal install process.

    Your reorganizing the files, may have end up conflicting with older files that still exist. So you should

    • Deprecate the older modules, for example, make them loadable but not do anything or they blow up. OR,
    • See if your new code can live with the older modules without conflicts. So you will need to have copies of the older files sitting in the lib directory seeing if a problem will occur.