SPUG: Template Toolkit and Module::Build

Michael R. Wolf MichaelRWolf at att.net
Sat Nov 27 17:21:38 PST 2010

Anyone used TT2 and Module::Build together?

I'm looking for a (non-web) set of best (or at least OK) practices that works with Module::Build.  I'm familiar with the basics of Build.PL for creating and installing a module (or 3), but could use some guidance for the "ancillary" pieces of a distribution that needs run-time non-module parts.

By "best practice", I mean a combination of practices in client code, Build.PL, and directory structure that works well with
 - Build && Build test	# regression testing
 - perl -I blib/lib t/xxx.t	# debugging modules
 - perl -I blib/lib bin/main.pl	
 - Build dist			# distribution
 - Build install			# client installation

* Where did you put the templates (*.tt) and the stand-alone Perl programs (*.pl) relative to Dist-Name/lib/Dist/Name.pm?
* How did that change from development to deployment?
* How did the 'main' program reference the the template directories in Template->new( { INCLUDE_PATH => [dir1 dir2] } )?
* What sections did you use in Build.PL to make sure the *.pl and *.tt files worked with Build targes of 'test', 'dist', and 'install'?
* Was $FindBin::Bin/../dir1/dir2 a part of the solution? Or was there some library-relative piece?

It might be instructive to me (and others) to do a 'ls -r' in a new distribution, and various cut/paste references to *.tt and *.pl from Build.pl and main-program.pl.

Alternatively, a URL to a better description of Buld.PL (no, not how to sub-class it, how to *use* it as it is -- just my beef with the "Cookbook" and "Authoring".  OK end mini-rant)

...Or a suggestion of a CPAN module that does it well.


Michael R. Wolf
    All mammals learn by playing!
        MichaelRWolf at att.net

More information about the spug-list mailing list