perl installation on HP-UX

Hi,

I have a little question.
On my HP-UX server I just installed Perl v5.8.
The previous version on it was v 4.0

I installed it under root and whenever I log in (telnet) with root it is stil perl v5.8 (perl v).
I can add the installation pad to the PATH to when Im logged on as user (both using export PATH="yourpath ${PATH}"  and setenv PATH "yourpath:$PATH" ).  
For the rest of the session I then have perl v5.8

If I logout and login again as user its back to v4.

What can be wrong?
I guess the PATH gets reset when I logout/login but dont know where to adapt that?

Thanks for any advice.
pliniusAsked:
Who is Participating?
 
yuzhCommented:
You need to modify the user's login script to use perl 5.8 in their PATH variable,
eg.
for ksh/sh user, put the following in their .profile
PATH=/path-to-perl5.8/bin:$PATH
export PATH
for csh/tcsh shell user, put the following in their .cshrc file
set path=(/path-to-perl5.8/bin $path)
after modify the login script, the user login out and their login again, they can start to use perl 5.8
0
 
Adam314Commented:
For ksh/bash, you can edit the path in  /etc/profile  to have it affect all users.
For csh, you can edit the path in  /etc/csh.cshrc  or  /etc/csh.login  to have it affect all users.

You could also rename the v4 perl to something else, like perlv4.  To find it's location, type "which perl" at a prompt before modifying your path.
0
 
pliniusAuthor Commented:
Hi,
thanks all for your comments but I did change the files in /etc.
This didn't made any difference.
Also, in the user homedir I looked at the files .profile.
In it there was this text:
#
# default login behaviour
#
# Take all environment settings from the central source.
#

if [ -f /etc/opt/exp/profile.central ]
then
  . /etc/opt/exp/profile.central
fi

So I looked under etc/opt/exp/
in the profile.central file I also adapted the PATH, but no luck....

I'm clueless what I can do next...
Thanks
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Adam314Commented:
Those files are normally where the global path would be set.  Maybe HP, or your specific setup, is using something else.  To search for all files that might set the path, run this:
    find /etc -type f -exec grep -H PATH {} \;

Then look in all of those files to see which are setting the path.
To see your current path, use:
    echo ${PATH}
0
 
pliniusAuthor Commented:
Apparently the -H switch is invalid for my version of HP-UX.
So I ran
 find /etc -type f -exec grep -e PATH {} \; > aa.txt
Which resulted in this file


aa.txt
0
 
Adam314Commented:
The -H option causes grep to include the name of the file.  From your aa.txt file, I can see several places where the PATH is set, but can't tell which files it is.  Try this command instead, which will print the name of the file also:

    find /etc -type f -print -exec grep PATH {} \; > list-2.txt
0
 
Adam314Commented:
Small change... the -print option needs to come after the -exec option:
    find /etc -type f -exec grep PATH {} \; -print > list-2.txt
0
 
pliniusAuthor Commented:
OK. Here is the output.

list-2.txt
0
 
Adam314Commented:
What are the locations of your v4 perl and your v5.8 perl?
0
 
pliniusAuthor Commented:
Hi:

Perl 5.8-> /opt/perl_32/bin
perl 4 ->
./opt/perl
./opt/perl/bin/perl

Thanks
0
 
yuzhCommented:
You need to make sure /opt/perl_32/bin is in front of opt/perl/bin/perl to use perl 5.8.
for ksh/sh users, check /etc/opt/exp/profile.central to make sure your PATH is defined correct.
put the statements in http:#23595975
FYI, sh/ksh also use /etc/profile, chs/tcsh use /etc/csh.login file.

PATH=/opt/perl_32/bin:$PATH
export PATH
will lead to use perl 5.8 first, but you need to make sure everyone have permission to access to /opt/perl_32/bin.
0
 
pliniusAuthor Commented:
Thanks, but I already changed he locations you spoke of(/etc/profile and /etc/opt/exp/profile.central )
So it has to be something else...

0
 
yuzhCommented:
>>Thanks, but I already changed he locations you spoke of(/etc/profile and /etc/opt/exp/profile.central )
If someone re-defined PATH/path in their .profile/.cshrc, eg,
PATH=/use/bin:/other/bin
export PATH
or other application ENV setting re-defined the PATH, they will NOT use the PATH defined in (/etc/profile and /etc/opt/exp/profile.central !
 
0
 
Adam314Commented:
Both /etc/csh.login (used by csh/tcsh) and /etc/profile (used by sh/ksh) use /etc/PATH to set the path. In /etc/profile, I see that /opt/perl_32/bin is initially set as the first directory in the PATH, but then later on, the contents from /etc/PATH are used to overwrite it.  Does /ect/PATH exist?  If so, make sure /opt/perl_32/bin comes before /opt/perl and /opt/perl/bin.  You can post it here for more help.
0
 
pliniusAuthor Commented:
Hi Adam314.
Yes, the etc/PATH exists but I already added the /perl_32 location to it...
This is the content:

/opt/perl_32/bin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/fc/bin:/opt/fcms/bin:/opt/upgrade/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/hparray/bin:/opt/graphics/common/bin:/opt/gnome/bin:/opt/ignite/bin:/opt/hpnpl//bin
0
 
Adam314Commented:
Try logging in as one of the users that uses the old perl by default, and run this at a prompt:
    echo ${PATH}
0
 
pliniusAuthor Commented:
This gives
/bin:/usr/bin:.:/usr/bin/X11:.:/usr/local/bin:.:/usr/sbin:.:/usr/contrib/bin:/op
t/expert/exp/bin:/opt/netscape6
0
 
Adam314Commented:
According to that, neither perl version should be found.  When you are that user, what is the output from this:
    which perl
and this:
    perl -v

and what is the current directory when you run those?
0
 
pliniusAuthor Commented:
which perl gives this:
/usr/contrib/bin/perl

perl -v gives this:

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36

Copyright (c) 1989, 1990, 1991, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 4.0 source kit.

I ran those from my homedir
0
 
yuzhCommented:
Why not modify the user's login script as already suggested.
0
 
pliniusAuthor Commented:
I did...
I did all the changes suggested here, but nothing seems to work...
0
 
Adam314Commented:
And what shell is being used?
0
 
Adam314Commented:
Also, in the users home dir, post the .cshrc and .profile (or the relavant portions).
0
 
pliniusAuthor Commented:
Here are the files from the homedir as well as the files they point to....

/***********************
/*  BEGIN .profile
/***********************

#
# default login behaviour
#
# Take all environment settings from the central source.
#

if [ -f /etc/opt/expert/profile.central ]
then
  . /etc/opt/expert/profile.central
fi


/***********************
/*  END .profile
/***********************
/***********************
/*  BEGIN .cshrc
/***********************
#
# default csh initialization
#

if ( -f /etc/opt/expert/cshrc.central ) then
  source /etc/opt/expert/cshrc.central
endif

alias cdk 'cd $NMkb'
alias cdn 'cd $NMex'
alias cdd 'cd $NMkb/debug'
alias cdp 'cd $NMkb/patches'
alias cdl 'cd $NMex/log'
alias cdm 'cd $NMkb/conf/meta'
alias cdg 'cd $NMkb/conf/global'
alias cdi 'cd $NMkb/conf/instance'

/***********************
/*  END .cshrc
/***********************

/***********************
/*  BEGIN profile.central
/***********************
# Set Prompt
export HOSTNAME=`hostname`
export PS1='$LOGNAME@$HOSTNAME:$PWD> '
# Amith Ninan , AAFac05348
export SHLIB_PATH=/opt/almap/fwk/runtime/comet/shlib/:/opt/OV/lib:/opt/almap/amv/tva/shlib/ovwwrap:/usr/lib:/opt/ilog/views31/lib/hp_10_1.0/shared:/opt/ilog/rules611/lib/hp_10_1.0/static_pic

export PATH=/opt/perl_32/bin:$PATH:/opt/OV/bin:/opt/netscape6


 # set erase to ^H, if ERASE is not set
      if [ "$ERASE" = "" ]
      then
            ERASE="^H"
            export ERASE
      fi

   #Jayannah, Added for stty error AAFac04478
        if tty -s
        then
          stty erase $ERASE
        fi

   # Set up shell environment:

     #Jayannah, Added for AAFac04478
        if tty -s
        then
               trap "echo logout" 0
        fi

   # This is to meet legal requirements...

     #Jayannah, Added for AAFac04478
        if tty -s
        then
         cat /etc/copyright
        fi

/***********************
/*  END profile.central
/***********************

/***********************
/*  BEGIN cshrc.central
/***********************
#
# cshrc.central
#
#
# load this file in .cshrc with
#
setenv uname `uname`
set username=`whoami`
export PATH="/opt/perl_32/bin:${PATH}"
if ($?prompt == 0) then
    exit
else if ( $username == root ) then
    set prompt = `hostname`'# '
else
    set prompt = "$username@`hostname`:${cwd}% "
endif
set history=100
set filec=1

alias cd     'cd \!* ; set prompt="`whoami`@`hostname`:${cwd}% "'
alias h history
alias j jobs
if ($username != root) then
    alias rm rm -i
    alias ls /bin/ls -C
else
    alias ls ls -C
endif

unset username

/***********************
/*  END cshrc.central
/***********************



0
 
Adam314Commented:
In csh,  you set environment variables with the setenv command, not with export.  So in your cshrc.central, this line:
    export PATH="/opt/perl_32/bin:${PATH}"
should be:
    setenv PATH "/opt/perl_32/bin:${PATH}"
0
 
pliniusAuthor Commented:
Thanks a lot.
This is what happens now:
When I do a telnet session and perl -v it gives version 4.
When I type csh and then do a telnet -v it gives v5.8
So does this mean that the "startup-shell" is no csh (i supposed it was because it is the same form then when I type csh - also username@`hostname`)?
If so, where should I adapt the perl version for this shell?

Thanks
0
 
pliniusAuthor Commented:
    When I type csh and then do a telnet -v it gives v5.8
-> I mean perl -v of course
0
 
Adam314Commented:
After logging in, if you type "ps"  (minus the double-quotes), it'll list running processes, which should be only your shell.  That will tell you which shell you are running.


Do you always log in with telnet, or do you ever log in any other way?

Try this, and post all of the output here:
    log in
    ps
    echo ${PATH}
    which perl
    perl -v
    csh
    echo ${PATH}
    which perl
    perl -v
0
 
pliniusAuthor Commented:
Hi,

99% of the time I log in using telnet, but sometimes I login in the CDE....

Here is the output...

BD88@HPse_1:/home/BD88% log in
log: Command not found.
BD88@HPse_1:/home/BD88% psw
psw: Command not found.
BD88@HPse_1:/home/BD88% ps
   PID TTY       TIME COMMAND
  6228 pts/ta    0:00 ps
  6208 pts/ta    0:00 csh
  6207 pts/ta    0:00 telnetd
BD88@HPse_1:/home/BD88% echo ${PATH}
/bin:/usr/bin:.:/usr/bin/X11:.:/usr/local/bin:.:/usr/sbin:.:/usr/contrib/bin:/op
t/expert/ex/bin:/opt/netscape6
BD88@HPse_1:/home/BD88% which perl
/opt/perl_32/bin/perl
BD88@HPse_1:/home/BD88% perl -v
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
Copyright (c) 1989, 1990, 1991, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 4.0 source kit.
BD88@HPse_1:/home/BD88% csh
BD88@HPse_1:/home/BD88% echo ${PATH}
/opt/perl_32/bin:/bin:/usr/bin:.:/usr/bin/X11:.:/usr/local/bin:.:/usr/sbin:.:/us
r/contrib/bin:/opt/expert/ex/bin:/opt/netscape6
BD88@HPse_1:/home/BD88% which perl
/opt/perl_32/bin/perl
BD88@HPse_1:/home/BD88% perl -v
This is perl, v5.8.8 built for PA-RISC1.1-thread-multi
(with 26 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 817 [257965] provided by ActiveState http://www.ActiveState.com
Built Mar 20 2006 19:44:08
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
BD88@HPse_1:/home/BD88% exit


Thanks
0
 
yuzhCommented:
You need to find out what  is your default login SHELL, after you login type in:
echo $SHELL
then have a look at my comment in http:#23595975 to modify your login script for your default login shell.
If you maunually swith shell in command line, you need to "source" your" login script for the new shell,
eg:
your default login shell is ksh, youtype in "csh" to change to csh, you need to do:
source /path-to/.cshrc
or
if your default login shell is csh, you type in "ksh" to use ksh, you need to do:
. /path-to/.profile     (a DOT following by a SPACE)
assume you have setup the PATH/path correctly in the .profile/.cshrc file.
 
0
 
Adam314Commented:
These lines here:
    BD88@HPse_1:/home/BD88% which perl
    /opt/perl_32/bin/perl
    BD88@HPse_1:/home/BD88% perl -v
    This is perl, version 4.0
Make it appear that the /opt/perl_32/bin/perl is perl v 4.0.

But then these lines:
    BD88@HPse_1:/home/BD88% which perl
    /opt/perl_32/bin/perl
    BD88@HPse_1:/home/BD88% perl -v
    This is perl, v5.8.8 built for PA-RISC1.1-thread-multi
Make it appear that /opt/perl_32/bin/perl is perl v 5.8.8.

A few more things to try... do this using the same user and log-in method as before
    log in
    type:
        /opt/perl_32/bin/perl -v
    type:
        perl -e 'print "$^X\n"'
0
 
Adam314Commented:
Also, after logging in, type this:
    alias
It might be there is an alias for perl defined causing the behavior.
0
 
pliniusAuthor Commented:
       /opt/perl_32/bin/perl -v
gives 5.8
 perl -e 'print "$^X\n"'
gives the text "perl/n"
AFTER I start the csh, it just gives the text "perl"
There is no alias defined regarding to perl.
0
 
simon3270Commented:
You can do what I do with old Perls on HPUX and rename the binary.  We have a load of 11iv1 machines which have Perl 5.0 installed.  Our app requires Perl 5.8.8, so to avoid the 5.0 one being used, I rename /usr/bin/perl to /usr/bin/perl5_0.  Nothing seems to require this, as long as there is another Perl available, so it works for us.  YMMV.
0
 
pliniusAuthor Commented:
OK.... sorry for forgetting about this question.
I'll split the points between yuzh and adam314. OK?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.