in reply to Re: Permissions for a separately installed perl
in thread Permissions for a separately installed perl

$ ls -l /opt/perl/bin/perl -rwxr-xr-x 2 john john 1169915 2010-02-28 10:30 /opt/perl/bin/perl $ which -a perl /usr/local/bin/perl /usr/bin/perl

Replies are listed 'Best First'.
Re^3: Permissions for a separately installed perl
by shmem (Chancellor) on Feb 28, 2010 at 13:44 UTC

    Ok, in that shell, what does

    perl -e 'print "$]\n";'

    yield?

    The shell hashes paths to commands, and if you add a command to a path previous in $PATH to the already hashed one, your may not see the changes:

    qwurx [shmem] ~> touch blorflydick qwurx [shmem] ~> rm blorflydick qwurx [shmem] ~> mkdir bin qwurx [shmem] ~> PATH=$HOME/bin:$PATH qwurx [shmem] ~> which rm /bin/rm qwurx [shmem] ~> echo '#!/bin/sh' > bin/rm qwurx [shmem] ~> echo 'echo no rm damnit' >> bin/rm qwurx [shmem] ~> chmod a+x bin/rm qwurx [shmem] ~> which rm ~/bin/rm qwurx [shmem] ~> rm blorflydick rm: cannot remove `bloflydick': No such file or directory qwurx [shmem] ~>

    A new shell will see the changes, however:

    qwurx [shmem] ~> echo $SHLVL 4 qwurx [shmem] ~> bash qwurx [shmem] ~> echo $SHLVL 5 qwurx [shmem] ~> rm blorflydick no rm damnit qwurx [shmem] ~>
      A new shell will see the changes

      or

      $ hash -r

      to make bash forget its cached bindings.

        Yes!
        $ perl -v This is perl, v5.10.1...
        Many thanks for your efforts.
Re^3: Permissions for a separately installed perl
by almut (Canon) on Feb 28, 2010 at 13:33 UTC

    Hm... another try:

    $ strace -f -efile /bin/bash -c 'perl -v' 2>&1 | grep perl
      $strace -f -efile /bin/bash -c 'perl -v' 2>&1 | grep perl execve("/bin/bash", ["/bin/bash", "-c", "perl -v"], [/* 17 vars */]) = + 0 stat64("/usr/local/sbin/perl", 0xbfde45f8 = -1 ENOENT (No such file or + directory) stat64("/usr/local/bin/perl", {st_mode=S_IFREG|0755, st_size=1169915, +...}) = 0 stat64("/usr/local/bin/perl", {st_mode-S_IFREG|0755, st_size=1169915, +...}) = 0 execve("/usr/local/bin/perl", ["perl", "-v"], [/* 16 vars */]) = 0 This is perl, v5.10.1 (*) built for i686-linux... etc.

        shmem's reply below is most likely correct.  With the above command you're running a new shell (with no cached name—>binary bindings), so everything works as expected...

Re^3: Permissions for a separately installed perl
by bart (Canon) on Mar 01, 2010 at 09:36 UTC
    Also try
    sudo which perl
    I think it's a matter of what's in PATH.