473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Wrapper on magic line?

Hi!

I have an intresting problem for our programming community on Solaris.

I want to develop an environment where:
1) The developers shouldn't need to bother about which Perl version to use.
2) When the Perl version is changed in a controlled manner, the change should be instant.
3) For developers whose scripts fails after a Perl version change, there should be a roll-back possibility.

The infra structure in our department provides a cornucopia of Perl versions.
These are installed under eg. /app/perl/5.8.1/bin/perl
Furthermore, to support a specific version of Perl you have to run a script that modifies
your $PATH so that that specific Perl is found first in the PATH.
Some solutions that I have tried:
Solution 1:
Put the explicit path to your Perl interpretator as the magic line, eg:
Of course, you have to run the script that modifies your PATH prior to the script execution.

A script example:
#!/app/perl/5.8.1/bin/perl
printf "Hello, World!\n";

The drawback is that you have to update gazillions of magic lines when wechange to a new Perl version.
Solution 2:
Use a symbolic link to point to your current Perl version.
Still you have to run the script that modifies your PATH prior to the script execution.

A link example:
ln -s /app/perl/5.8.1/bin/perl /home/foobar/current_perl

A script example:
#!/home/foobar/current_perl
printf "Hello, World!\n";

The (smaller) drawback is that you have to edit the magic line if you deliberately want to override the Perl version.
Solution 3:
Use a wrapper that selects a Perl from the path.
Still you have to run the script that modifies your PATH prior to the script execution.

A script example:
#!/usr/bin/env perl
printf "Hello, World!\n";

If you don't like the selected Perl you can re-modify your PATH an continue.
Additions requirements:
When investigating this I found that you sometimes want to save your scripts in a CM-system,
eg. ClearCase. Furthermore you want to execute old verions of a script with that old Perl version that
exixtsed when it was developed.

Solution 4: (A combination of 2 and 3)
First you have a symbolic link in your CM-system that points to your selected Perl version.
This link is baselines along with the script source.

A link example:
ln -s /app/perl/5.8.1/bin/perl /vobs/foobar/current_perl

Secondly, you have a better wrapper that you put in the magic line:

A script example:
#!/vobs/foobar/perlwrapper
printf "Hello, World!\n";

The wrapper does ths following:
1) Checks if the environment (PATH etc.) is compatible with the Perl thatis pointed to by the
symbolic link.
2) If not, the environment is adjusted, using the script mentioned above.
3) Starts Perl.

Now my problem:
Where to find info of how to write such a wrapper.

--
Hälsningar/Regards,
-----------------------------------------------------------------
Mats Nilsson
ENEA Embedded Technology AB,Box232,Nytorpsv. 5,183 23 TÄBY SWEDEN
Ma**********@enea.se http://www.enea.se +46850714626 +46709714626
ga******@algonet.se http://www.algonet.se/~gafvelin +4687201233
PGP 0x9EC47877 40D5AB62551ED1A0DEDE1FFBCF0F5B2D9EC47877
PGP 0x91BAB71D DEF5B01307C484C31CEE15DEE345166891BAB71D
PGP 0x5DA31679 18449D0BE17C96C9D440CA96CF8BC0E0
-----------------------------------------------------------------
Jul 19 '05 #1
0 1692

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Edvard Majakari | last post by:
Hi, I was wondering what would be the most elegant way for creating a Python class wrapper for a command line utility, which takes three types of arguments: 1. options with values (--foo=bar)...
1
by: Garett Shulman | last post by:
Hello, I am trying to create a wrapper for a function with the following prototype: int ap_get_playlist(int session, int *argc, char ***the_list); I'm not quite sure how to construct the...
12
by: Egil M?ller | last post by:
Is there any way to create transparent wrapper objects in Python? I thought implementing __getattribute__ on either the wrapper class or its metaclass would do the trick, but it does not work for...
4
by: winnerpl | last post by:
Hey guys I'm trying to get a magic square but I'm stuck with it printing out only 1's and 0's in random places. Hope you experts can can provide some input on what I'm doing wrong. #include...
4
by: Stephen | last post by:
Hi I am currently developing a web application that has a third party component on it. The third party component is a graph component from Xceed that uses a number of dlls. The problems occur...
19
by: youpak2000 | last post by:
Are MAGIC numbers always bad? Using magic numbers (constant numbers) in programs are generally considered a bad programming practice, and it's recommended that to define constants in single,...
1
by: Tony Freixas | last post by:
Hello, I'm trying to create a wrapper for a program. I want to execute program 'X' by running program 'Y', such that 'Y' appears to function pretty much like 'X' both in the way command line...
6
by: tinman77 | last post by:
Hello, I'm having a terrible time using the functions finfo_open and finfo_file. I'm using PHP 5 on IIS 5.1 and Windows XP. I have enabled php_mime_magic.dll and php_fileinfo.dll and also added...
9
by: Larry Hale | last post by:
I've heard tell of a Python binding for libmagic (file(1) *nixy command; see http://darwinsys.com/file/). Generally, has anybody built this and worked with it under Windows? The only thing I've...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.