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

Adding a "last step" to a MakeMaker installer (solved)

by graff (Chancellor)
on Mar 05, 2009 at 08:08 UTC ( [id://748451]=perlquestion: print w/replies, xml ) Need Help??

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

I'm using ExtUtils::MakeMaker, which works great, and there's just one more thing I'd like to handle, but I don't quite see how...

My module includes some text tables that get turned into Berkeley DB files, and I have that covered as a first step in Makefile.PL. The "make install" step puts the DB files into a "MyModule_DB/v1_0" path that sits directly next to the installed "MyModule.pm", which is what I want. Now just one more thing:

Someday I'll send out a new version of the tables -- probably without any changes to the perl module -- so MyModule.pm stays exactly the same, but "MyModule_DB" will contain a "v2_0" or whatever (later on, tables and code will end up with separate versioning tracks and separate distros). In order to have a stable "default" behavior for the module as the tables get upgraded, I want "MyModule_DB" to also contain a symlink called "CurrentVersion", which would always point to the most recently installed version of the tables.

(Some users may want to keep older tables around for cross-version comparisons or backwards compatibility, and the module supports this.)

So back to the main question: what would I put into Makefile.PL (and/or elsewhere in the distro) so that the very last thing that happens during "make install" is: create a symlink called $(INSTALLSITELIB)/MyModule_DB/CurrentVersion that points to $(INSTALLSITELIB)/MyModule_DB/v1_0 (i.e the table version that goes out with this first release of the module).

I'm not exactly sure whether "INSTALLSITELIB" is the right monicker for this, or what the syntax would be to get it to interpolate properly within Makefile.PL; in fact, it would suffice if I just figure out how to run a specific perl script (to be supplied in the distro) as the last thing in the "make install" step. This script should be able to look up the path to MyModule.pm in %INC, work out the _DB path from that, and put the symlink there.

Whatever it takes, I just need that symlink created at install time. And when I send out new tables, a similar install process will replace the old symlink with a new one.

(I could also just put a loud note in the INSTALL instructions, telling the user to run this little script to make the symlink. But that's ugly, and some users are bound miss that step or screw it up somehow...)

UPDATE: As pointed out by Anonymonk below, I really just needed a better way to define what the "CurrentVersion" of the tables is.

Replies are listed 'Best First'.
Re: Adding a "last step" to a MakeMaker installer
by Anonymous Monk on Mar 05, 2009 at 08:20 UTC
    I think a better idea would be to generate a module MyModule_DB/CurrentVersion.pm instead of a symlink
      Bingo. Thanks, AM, whoever you are.

        whoever you are
        .oO( Anonymous is Legion. )

        And you didn't even know bears could type.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-24 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found