SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Sponsored Links

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

Program Version Switch (pvswitch)

What is it?

pvswitch is a very tiny program which makes it possible to use different program installations on one machine flawlessly.

It's flexibility is intended for people who need to run programs against different interpreter versions.

But it can also be used for different purposes like switching the version of a compiler, text editor, mail reader, browser, whatever.

Why do I need a tool for this?

Actually it is most useful for developers of interpreter based programs which are started via a hash-bang line (#!).

The following example explains the usage for perl programs, but the very same is true for all other interpreter languages.

If you install two or more different perl versions on your machine, you could just call the respective perl binary you want to use..

perl myscript.pl
/path/to/another/perl myscript.pl

This works fine, although it isn't very convenient. However if you are starting your program using the hash-bang line like

#! /usr/bin/perl

and then just start it by

./myscript.pl

you would need to change the file itself to use another perl version. Again it is possible, but not very convenient.

And here comes pvswitch: it's purpose is to make such situations convenient. Further it solve some problems which come up if multiple people want to use different perl versions. pvswitch allows even to run one program in two shells with different perl versions. This is possible because pvswitch uses a environment variable to select the interpreter version to use. This environment variable can be set in different sessions independently.

How does it work?

pvswitch is installed as new program binary (e.g. perl) the old one will be renamed to program.pvswitch.

Now every time you execute a this program (e.g. perl), pvswitch is executed. It doesn't matter how you start the program...

        perl myscript.pl
        ./myscript.pl  if it has a hash-bang '! /usr/bin/perl'

for both cases the pvswitch binary will be executed, pvswitch will than check for the environment variable PVSWITCH_PERL_BINARY (if you are running perl), if it is found it tries to find this key in the configuration file pvswitch.conf and execute the program which is configured for the version configured set in the environment variable (e.g. perl.pvswitch). So it just executes the real program (e.g. perl interpreter). Depending on the environment a different version might be selected.

There are some convenient tools (e.g. perlver, pvconfig) to configure this.

Limitations

pvswitch will not work for executables which are liked to use a specific program version. Most prominent example is mod_perl.

Obtaining the most recent version

You can fetch the latest pvswitch version at the authors homepage:

http://www.fatalmind.com/software/pvswitch/

How can I install pvswitch?

Please have a look into the INSTALL document included in this distribution.

Authors contact

       e-mail: mws@fatalmind.com
     homepage: http://www.fatalmind.com/
    whishlist: http://www.amazon.de/exec/obidos/wishlist/1JW6LC92SAK62/
               http://amazon.com/gp/registry/3BXRJP9W3WMDX

Copyright

Program Version Switch (pvswitch)
Copyright (C) 2004 Markus Winand <mws@fatalmind.com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Sponsored Links

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.