Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

PAR target for Module::Build

by gaal (Parson)
on Mar 09, 2005 at 16:14 UTC ( [id://437941] : perlquestion . print w/replies, xml ) Need Help??

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

I wanted to package up a module as a PAR dist, but couldn't figure out how to get either Build.PL or the PAR tools to include extra files from my par/ dir, and possibly my tests, into blib/ or the PAR::Dist target.

So I cooked up this hackaround. It may be useful for people, but I'm posting this as a SoPW and not a Snippet because somehow I feel I'm doing something wrong. Certainly, this only Works For MeTM because the module I'm packaging is pure Perl and doesn't need a blib/; YMMV and if you know the Right Thing to do here, please let me know.

In any case, here it is. It just makes a PAR from everything in your MANIFEST, and names it DIST-VER.par. Usage:

./Build.PL && ./Build pardist

In your Build.PL, instead of

my $build = new Module::Builder

Put this:

my $class = Module::Build->subclass ( class => 'My::Builder', code => q# sub make_parfile { my ($self, $file) = @_; $file =~ s/(?<!\.par)$/.par/; print "Creating $file\n"; require Archive::Zip; my $zip = Archive::Zip->new(); $zip->addFile($_) for keys %{ $self->_read_manifest('MANIFEST') +}; die 'write error' unless $zip->writeToFileNamed( $file ) == Arch +ive::Zip->AZ_OK; } sub ACTION_pardist { my($self) = @_; $self->make_parfile(join "-", $self->dist_name, $self->dist_vers +ion); } #, ); my $build = $class->new # The rest is the same.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://437941]
Approved by moot
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-02-06 00:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found