In the spirit of giving this season, I'm making progress on getting some of my work out the door, if not yet ready for prime time, then at least in a distributable form.

Spent some time in the archives reading How to make a CPAN Module Distribution, José's Guide for creating Perl modules, ExtUtils::ModuleMaker and a few distractions along the way.

These all seem to assume a much cleaner development environment than I deal with. I'm a pack rat. I'll throw together half-baked notes, save back sample data or test results, sample code and leave it in my primary work directory. cvs does not seem to mind until I do a cvs add _some_new_file_. But I need a way of easily extracting the files I'm interested in sharing, without destroying my work environment, in a ready to distribute form. I call this: build_distro.pl, on its way to being something more useful. Here is a snippet of the docs.

=head2 build_distro() build_distro() takes a source directory with a properly formatted MANIFEST file and produces a tar.gzipped package of the file +s specified in the MANIFEST file. =cut
#!/usr/bin/perl -w use strict; use warnings; # name of tar package to build my $pkg = "Foo_Bar_0_01.tar"; # expressed as a relative path to directory with MANIFEST my $basedir = "Foo_Bar_0_01"; =head1 NAME build_distro.pl - build a tar.gz from a MANIFEST =head1 VERSION Version 0.01 =cut our $VERSION = '0.01'; =head1 SYNOPSIS This script will accept a package name and a source directory and use them to build a gzipped tarball for distribution of only those files and directories not commented out from a MANIFEST list in the source directory. To use, at the moment: /path/to/build_distro.pl after hard coding in the values for $pkg and $basedir and changing the current directory to the path where you want to package written to. Longrange the interface is imagined as: use Module::BuildDistro; my $pkg = Module::BuildDistro->new({ -source => 'Your_New_Module' +}); $pkg->build_distro(); or, perhaps simply: module-build-distro --source=Your_New_Module/ =head1 EXPORT build_distro() =head1 FUNCTIONS =head2 build_distro() build_distro() takes a source directory with a properly formatted MANIFEST file and produces a tar.gzipped package of the file +s specified in the MANIFEST file. =cut sub build_distro { } print "Our working directory is: ", `pwd`,"\n"; if(-f $pkg){ warn "$pkg already exists."; print "Shall I delete $pkg (y/n)?"; my $response = <STDIN>; chomp($response); if($response eq 'y'){ unlink($pkg); print "I have just deleted $pkg.\n"; } else { die "I can not build new distribution without deleting old one."; } } open(MANIFEST,"$basedir/MANIFEST") or die "Unable to open $basedir/MANIFEST. ?: $?, !: $!"; my $result = `tar -cf $pkg $basedir/MANIFEST`; if(!defined($result)){ warn "Failed to create tar ball: $pkg. ?: $?, !: $!"; } FILE: while(<MANIFEST>){ chomp($_); if(/^#/){ print "Skipping $_.\n"; next FILE; } unless ($_ eq ""){ $result = `tar -rf $pkg $basedir/$_`; if(!defined($result)){ warn "Failed to append $basedir/$_ to the tar ball: $pkg. ?: $?, + !: $!"; } } } $result = `gzip $pkg`; if(!defined($result) ){ warn "Failed to gzip the package file.i ?: $?, !: $!"; } 1;
So my questions this fine morning are two fold:
Thanks,
-- Hugh

if( $lal && $lol ) { $life++; }

In reply to Building a package for distribution: How do the pros do it? by hesco

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.