2

On a CentOS 6.5 machine, I have two versions of perl installed through plenv.

When I am running perl 5.8.8, I can run any perl command fine in the shell such as

plenv local 5.8.8
perl -e "print 'hello';"
hello

But When I switch to alias "system"

plenv local system
perl -e "print 'hello';"

The command doesn't execute and feeds into a new line as if the perl command is waiting for input. Ctrl-D doesn't end input, either.

So my questions are,

  • is this an old perl behavior?
  • How do I check the version of an alias perl? (typing perl -v doesn't execute, as I described above)

update: Results to commands requested in comments

$: plenv version 
system (set by /home/myuser/.perl-version) 
$: type perl 
perl is hashed (/opt/plenv/shims/perl) 
$: plenv local 5.8.8 
$: plenv version 
5.8.8 (set by /home/myuser/.perl-version) 
$: type perl 
perl is hashed (/opt/plenv/shims/perl)
dorachan2010
  • 981
  • 3
  • 12
  • 21
  • 5
    If `perl -v` doesn't work, then there is something wrong with that perl. – redneb Sep 21 '16 at 15:33
  • 1
    No, this command would have worked at least back to early Perl 4, and probably much longer. What's the output of `type perl`? – tripleee Sep 21 '16 at 15:34
  • Also interested in `type perl`'s output – ikegami Sep 21 '16 at 15:35
  • Sorry, I'm new to this website and can't figure out the formatting in the comment section – dorachan2010 Sep 21 '16 at 15:42
  • Adding to the question is the right thing to do. /// Oh, `plenv` doesn't work through PATH manipulations? I guess the next thing to do is study `/opt/plenv/shims/perl` /// Tag users e.g. using `@ikegami` so they notified of the comment. – ikegami Sep 21 '16 at 16:38
  • plenv is better than perlbrew in that sense (no path mangling). – mpapec Sep 21 '16 at 16:43
  • @Сухой27, I don't see how avoid PATH manipulations is better (or worse) – ikegami Sep 21 '16 at 17:48
  • So the concensus is that the perl is corrupt? Or as @ikegami mentioned, I'm missing something about /opt/plenv/shims/perl? – dorachan2010 Sep 21 '16 at 20:05
  • Re "*So the concensus is that the perl is corrupt?*", Hell no. If a Perl interpreter is being run at all, it's likely being run with no arguments. Determining which of these is true requires finding out what `/opt/plenv/shims/perl` executes and how. – ikegami Sep 21 '16 at 22:29
  • Actually, you could just use `echo 'print "hello";' | perl`. If it works, a Perl interpreter is being called, but no arguments were passed to it. – ikegami Sep 21 '16 at 22:31
  • With plenv you can define perl version per project directory, and not to worry about manual version switching. – mpapec Sep 22 '16 at 10:50

0 Answers0