Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > accessing different versions of perl

Reply
Thread Tools

accessing different versions of perl

 
 
Julia Bell
Guest
Posts: n/a
 
      12-06-2003
I would like to run the same script on two different platforms. The
directory in which the script(s) will be stored is common to the two
platforms. (I see the same directory contents regardless of which
platform I use to access the directory.)

Platform 1: perl is installed in /tps/bin/perl. CPAN modules are available
Perl is also installed in /usr/bin/perl Platform 1, but the modules are
not accessible with this version.

Platform 2: perl is installed only in /usr/bin/perl. Modules are not
installed.

The script still can do a lot of the desired functionlity without the
modules, and with either version of perl, so it is useful on both platforms.

Making two separate scripts with different names (stored in the same
directory) would solve the problem (one script accesses /tps/bin/perl
and requires the modules; the other script accesses /usr/bin/perl and
does not require the modules), but I don't want the user to have to
enter two different command lines depending on which platform they are on.

I tried writing a csh script that calls the appropriate version after
checking to see if /tps/bin/perl is installed or not on the host that
executes the csh script. The csh script appears to call the correct
version of the perl script, but none of the perl output that should go
to the screen was displayed.

What's the best way to approach this problem?
Or, if the csh approach is best, where did my STDOUT output go?

(Getting perl installed uniformly with the required modules across both
platforms isn't an option at this time, and I don't want to give up the
added functionality that is available in the /tps/bin/perl version that
has the modules available.)

Julia Bell

 
Reply With Quote
 
 
 
 
dw
Guest
Posts: n/a
 
      12-06-2003

"Julia Bell" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
.....
>
> Platform 1: perl is installed in /tps/bin/perl. CPAN modules are

available
> Perl is also installed in /usr/bin/perl Platform 1, but the modules are
> not accessible with this version.
>
> Platform 2: perl is installed only in /usr/bin/perl. Modules are not
> installed.
>

.....
> What's the best way to approach this problem?
> Or, if the csh approach is best, where did my STDOUT output go?

.....
what does your csh script look like?

>
> (Getting perl installed uniformly with the required modules across both
> platforms isn't an option at this time, and I don't want to give up the
> added functionality that is available in the /tps/bin/perl version that
> has the modules available.)
>

.....

If your own directory is in a common place how about creating a link on each
machine to the correct path....
ln -s /tps/bin/perl ~/perl # on platform 1
ln -s /usr/bin/perl ~/perl # on platform 2
then use
#!/home/id/perl
in your scripts. This should avoid starting up an intermediate shell.

I don't have csh, but this works for me with sh:
#!/bin/sh
if [ -x /tps/bin/perl ]
then exec /tps/bin/perl -x $0 ${1+"$@"}
else exec /usr/bin/perl -x $0 ${1+"$@"}
fi

#!/usr/bin/perl -w
print "$0: running\n";
print "ARGV:\n";
for (my $x = 0; $x<@ARGV; $x++) {
printf "%3d: %s\n", $x, $ARGV[$x];
}



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results from different gcc versions ks C++ 9 03-20-2010 02:09 PM
Different flavors of a gem for different versions of Ruby Ken Bloom Ruby 2 11-04-2008 01:01 AM
How to use 2 DIFFERENT VERSIONS of the SAME MODULE in the same perl program ? Yves Petinot Perl Misc 9 06-30-2004 08:26 AM
Compatibility of perl on different HPUX-Versions Alex F. Perl Misc 2 02-23-2004 12:01 PM
dbm file locking with different versions of perl Matt Johnson Perl 0 08-08-2003 11:58 AM



Advertisments