Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I manage an application that has been rode hard and put away wet over the years, but is still expected to continue to work. The server OS has been maintained, but the Perl instance has not because there isn't anybody assigned to the box that knows Perl. I need to install a new module for a request, but my management is concerned about how we can back out the changes if there's a problem. I've used CPAN to install it locally on my machine, but there were a ton of dependencies that also had to be installed.

Unfortunately, I don't have a test server to start on, I have to go straight to production. (I didn't say this was an ideal situation)

The server is a windows box. Is is possible to make a backup copy of the Perl directory that I can overlay back on top if the new modules updates/installs doesn't go well?

I know this is a bit vague. I'm not a server admin, and without one, I'm leery of installing something to a production box without a backup plan.

share|improve this question

migrated from stackoverflow.com Oct 2 '12 at 6:42

This question came from our site for professional and enthusiast programmers.

    
Are you upgrading an module you already have installed, or are you installing a module for which no version is currently installed? –  ikegami Oct 1 '12 at 19:38
1  
You could always install to a new directory (using INSTALL_BASE). Perl will only look there as long as the PERL5LIB env variable mentions it. –  ikegami Oct 1 '12 at 19:39
    
I need to install a new module that doesn't currently exist on the server, but it has dependencies on newer versions of modules that do exist. –  MitchelWB Oct 1 '12 at 19:48
    
Then yeah, the idea I presented would be the safest. It'll allow you to use the new versions or not at the "flick of a switch". –  ikegami Oct 1 '12 at 19:52
1  
You can tell cpan to pass INSTALL_BASE to perl Makefile.PL and --install_base to perl Build.PL. Sorry, I don't have time to create a proper answer. –  ikegami Oct 1 '12 at 20:16

3 Answers 3

First approach:

Use this if the new module and the updated ones should be used in many scripts.

Perl modules, after all, just a bunch of files in directory. Simply backup that directory (zip them and store it out of box) then install the module whatever method do you like.

If something goes wrong restore the whole Perl directory.

Second one:

Use this if this new module only used by one or two new modules.

If this is a new module and it is used by a new app you could install it and all its dependencies into a new dir, let's call it c:\new_perl_module and the new module name is fancy::newthing;

Perlbrew is the modern way to install a new version of perl and modules into a separate dir but cpan is capable to do this too.

Then in the script that need this module, add these lines to the very top of you script:

use lib 'c:\new_perl_module';
use fancy::newthing;

This way only this script will use this new and the updated modules. If it fails, comment out these lines and your rollback is done. The installed version of modules are left untouched.

share|improve this answer

Take a backup of your Perl directory tree using whatever takes your fancy, even a simple recursive file copy. Next, install what you need. In the extremely unlikely event that it happens to go pear shaped just restore the Perl tree from your backup. Seriously, it just doesn't get any easer than that.

share|improve this answer

In this case I would use Perlbrew to install a new Perl in the home-dirctory from scratch with all the new modules from CPAN. Like this the older installation gets not touched at all. And it's basically no bad idea to use the newest version of all the modules available. If things screw up, there is also no problem. It's all save in home and Perlbrew takes care of cleaning that up too.

After that, I would have a serious talk to management. If they want you to do magic, why don't you ask them to do the same for you? If a fail is a big problem they should do a magic trick, so that you have a testing environment.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.