Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: non-CPAN module distributions

by adrianh (Chancellor)
on Sep 16, 2003 at 22:02 UTC ( #291976=note: print w/replies, xml ) Need Help??

in reply to non-CPAN module distributions

Is this a bad approach? Would it be better to just keep using the source module files (*.pm) directly without modulizing them, and just come up with some way to handle unit tests, rather than use the h2xs-generated framework?

I don't think it's a bad approach - but there are certainly other ways of going about it. For example:

  • Group your unit tests (by name, by directory, etc.) and use tools like Test::Verbose or a hand rolled test runner to run just the tests you want. For example if you prefix all test scripts with the module name you can use Test::Verbose to do things like:
    % tv t/ModuleName*.t
  • Use something like <plug bias="author">Test::Class</plug> to combine the unit tests for a module into a single test script.
Previously, the mod_perl-driven website that used these modules used "use lib ..." to access the source for the libraries directly so there was no module build process, but in converting them to module distributions, they will each require building with ...

You can get ExtUtils::MakeMaker to do most of the work for you.

With these not being CPAN modules, what is a good way to determine which version of each module is currently installed on a system?

That's what $VERSION is for :-)

Also, what is a good way to handle the build process so that only those modules that have been modified are rebuilt? I can do a CVS update of the module sources on each system, but I need some way to determine which modules need to be re-built and re-installed. I have thought of making a global Makefile (or perl script that does basically the same thing a Makefile would do) to handle this, but am not sure if that's the best approach.

When I go this route this is the structure I use:

AppBundle/ Makefile.PL t/ acceptance_test1.t acceptance_test2.t ... Module1/ Makefile.PL t/ lib/ ... Module2/ Makefile.PL t/ lib/ ...

Where the root Makefile.PL is like this one, and the individual module Makefile.PL files are as you would normally expect.

This allows me to:

  • To checkout individual modules, run the module perl Makefile.PL and be able to develop a module independently of the application as a whole.
  • Checkout the entire AppBundle, run the root Makefile.PL and build, test and install the application as a whole.

In fact I have a hook script that, on commit, does a make test on the application as a whole and mails me if it goes wrong. I'm a Subversion user, but I'm sure it will carry across to CVS.

Hope this makes sense :-)

Replies are listed 'Best First'.
Re: Re: non-CPAN module distributions
by BrowserUk (Patriarch) on Sep 17, 2003 at 02:59 UTC

    Thanks for posting the link to Subversion. I'd never heard of it, but it's now installed and I am a convert!

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

      Subversion rocks :-)

      Actually, it just occurred that subversion would offer another solution to the separation of tests issue. You could create a separate directory in a subversion repository that had a per-module Makefile.PL and external definition links to the appropriate module and test code from the main directory.

      You could then checkout a module that could be worked on stand alone, and have all changes automatically checked into the main tree.

      No idea if/how you would do this in CVS.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://291976]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-05-28 21:20 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (101 votes). Check out past polls.