
rpaskudniak
User

Feb 21, 2011, 6:04 PM
Post #1 of 2
(2954 views)
|
Building a CPAN-Worthy distribution with module and a script
|
Can't Post
|
|
Greetings. Although I am not (by own evaluation) and advanced Perl programmer, I am posting my question in this section because my post in the "Intermediate" section has yet to receive an answer. The quick version of the story: My dist contains a module and a script. When I install it, the module goes into a known place; the scripts seems to have been ignored. Now the fuller story: I have a Perl module for which I'd like to build a CPAN-worthy distribution. I also want to include a runnable script that uses the module, serving as both an example and a useful application. I started with h2xs to build the skeleton distribution and copied/edited my .pm file in there. What about the script that uses it? Taking what appears to be a cue in ExtUtils-ModuleMaker-0.51, I manually added a scripts directory parallel to the lib directory. Here's what by directory structure looks like, with comments added:
$ find UNLreport UNLreport # Top level directory UNLreport/lib # Subdir generated by h2xs UNLreport/lib/UNLreport.pm # The star module of this dist UNLreport/Makefile # Generated by perl Makefile.PL UNLreport/Makefile.PL # Makefile builder generated by h2xs UNLreport/MANIFEST # See comments below UNLreport/README # Edited from the original skeleton UNLreport/scripts # I added this subdirectory UNLreport/scripts/beautify-unl.pl # The script I was talking about UNLreport/t # The test stuff. Leaving these UNLreport/t/UNLreport.t # alone for now Now about the MANIFEST file:
Makefile.PL MANIFEST README t/UNLreport.t lib/UNLreport.pm scripts/beautify-unl.pl # I added this entry to the MANIFEST And, of course, I ran the appropriate:
perl Makefile.pl make dist The result was UNLreport-1.02.tar.gz. Now, I built this all under Cygwin (Windows-7). I then booted Ubuntu, copied the gz to /Var/Downloads (my way of setting a private standard) and unpacked, untar'ed, ran the appropriate stuff through make install. So where did my stuff end up? Well, the module ended up as:/usr/local/share/perl/5.10.1/UNLreport.pm All fine and well for a simple module. Now what about the script I stuck into the scripts directory? Looks like my emulation of ExtUtils was misdirected. Come to think of it, I'm not sure of where I did want the script to get installed. I think something like in /usr/local/share/scripts (which would have to create) but I was hoping there would be an attempt by the "make install" to put it someplace, get an error, and I would create the necessary directory. BTW, here's the install session, as best as I could edit it from the messed up "scripts" output
Script started on Mon 21 Feb 2011 07:45:19 PM EST rasputin@maxwell:/var/Downloads/UNLreport-1.02$ perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for UNLreport rasputin@maxwell:/var/Downloads/UNLreport-1.02$ make cp lib/UNLreport.pm blib/lib/UNLreport.pm Manifying blib/man3/UNLreport.3pm rasputin@maxwell:/var/Downloads/UNLreport-1.02$ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/UNLreport.t .. t/UNLreport.t .. 1/1 t/UNLreport.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.05 CPU) Result: PASS rasputin@maxwell:/var/Downloads/UNLreport-1.02$ sudo make install [sudo] password for rasputin: Installing /usr/local/share/perl/5.10.1/UNLreport.pm Installing /usr/local/man/man3/UNLreport.3pm Appending installation info to /usr/local/lib/perl/5.10.1/perllocal.pod rasputin@maxwell: /var/Downloads/UNLreport-1.02 rasputin@maxwell:/var/Downloads/UNLreport-1.02$ exit Script done on Mon 21 Feb 2011 07:46:35 PM EST So now that you know what I'm up to: - How do I get my distribution to include the script? - How do I tell it where to put the script Thank you, O Gurus, for your guidance here. -------------------- -- Rasputin Paskudniak (In perpetual pursuit of undomesticated, semi-aquatic avians)
|