473,573 Members | 4,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,Nytor psv. 5,183 23 TÄBY SWEDEN
Ma**********@en ea.se http://www.enea.se +46850714626 +46709714626
ga******@algone t.se http://www.algonet.se/~gafvelin +4687201233
PGP 0x9EC47877 40D5AB62551ED1A 0DEDE1FFBCF0F5B 2D9EC47877
PGP 0x91BAB71D DEF5B01307C484C 31CEE15DEE34516 6891BAB71D
PGP 0x5DA31679 18449D0BE17C96C 9D440CA96CF8BC0 E0
-----------------------------------------------------------------
Jul 19 '05 #1
0 1703

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

Similar topics

4
2770
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) 2. boolean options (--squibble) 3. data lines (MUNGE:x:y:z:frob)
1
1361
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 Py_BuildValue. I would like the python function to return a list of strings. However, the length of the list, (*argc in the function call), will vary at run...
12
4058
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 the built in operators: class Foo(object): class __metaclass__(type): def __getattribute__(self, name): print "Klass", name
4
4727
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 <stdio.h> #define MAX 20 int x; int size_request(void); //asks the user to enter the size x size square.
4
1920
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 when we attempt to deploy the application and the third party component causes a security exception. Description: The application attempted to...
19
5151
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, visible place in a header file. My question is that is there any situation where using magic numbers is not necessarily a bad thing? lets say that we...
1
2656
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 options are handled and the way input, output and error messages are reported. Program 'X' is a console application. I had it pretty well figured...
6
6490
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 the lines mime_magic.debug = Off and mime_magic.magicfile = "C:\Program Files\PHP\extras\magic.mime". Now my phpinfo() says fileinfo support is...
9
16134
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 been able to find is the python-magic module at http://hupp.org/adam/hg/python-magic/. Is this "THE" python-magic module. (It seems to be to...
0
7741
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7661
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7978
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7730
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6349
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5252
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3692
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
987
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.