Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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 :-)


In reply to Re: non-CPAN module distributions by adrianh
in thread non-CPAN module distributions by mp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 03:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found