[Raleigh-talk] Perl Newbie question about upgrade from Perl 5.8.8 to 5.10

Mike South msouth at gmail.com
Thu Jan 15 06:31:03 PST 2009


On Wed, Jan 14, 2009 at 10:36 PM, J C <jim.x.casey at gmail.com> wrote:
> Hi,
>
> I bought the O'Reilly 5th edition Learning Perl the other day and it's
> great. I am new to programming and Perl as well. I do know my way
> around Linux but I am having problems upgrading from the version that
>
> was on my OS (Cent OS 5.2) to 5.10. I downloaded Perl 5.10 from
> http://www.cpan.org/authors/id/R/RG/RGARCIA/perl-5.10.0.tar.gz, then
>
> tar -xvzf perl-5.10.0.tar.gz the package in /usr/local/bin   I then
> followed the README guide that said to:
>
> ./Configure -des -Dprefix=$HOME/localperl
>   make test
>   make install
>
> Now, the first command was probably my mistake because I really have
>
> no idea what that would do. I figured that I could simply use the
> shebang after make test and make install was done "doing it's thing"
> and type out #!/usr/local/bin/perl-5.10.0 or  #!/usr/local/bin/
>
> perl-5.10 and everything was work just fine and I would be using Perl
> 5.10 This obviously is not the case as now it tells me I still have
> 5.8.8 installed. I know this is probably a very common problem and
> I'll try and do all the research I can when I find the time but if any
>
> of you that are a lot more experienced could help me out and "put me
> in the right direction" that would be great.
>
> Here is the code from the book (page 68) I am trying to run:
> ---------------------------------------------------------------------------------------
>
> #!/usr/local/bin/perl-5.10.0     # I've also used perl5.10 and every
> other thing I could think of...
> use 5.010;
> use strict;
>
> sub marine {
> 	$n += 1;
> 	print "Hello, sailor number $n!\n";
>
> }
>
> &marine;
> &marine;
> &marine;
> ----------------------------------------------------------------------------------------
> And here is the output I am getting when I try running it:
> Perl v.5.10.0 required --this is only v.5.8.8
>
> ----------------------------------------------------------------------------------------
>
> I've also noticed that now there's a perl5.10.0 located in the /root/
>
> localperl/bin so I am sure it has something to do with the
> above .Configure command.

You are right--what you have done is said "I want to make an
installation of perl 5.10 in /root/localperl".  The idea of that
configuration option (which would normally be done as a regular user)
is that you can experiment with the new version of perl in your own
local directory (hence the $HOME) even if you don't have root access
to the machine you are working on.

>Can anyone give me some advice on how to get
> 5.10 working? I feel like I am close, but nothing so far.

Well, one thing you can try, just to see if what you did worked, is
change the shebang line in your test script to

#!/root/localperl/bin/perl

But I'm not sure what the permissions on /root/localperl are going to
be.  So, unless you run it as root, you might just get an error that
says you don't have permission to run that.  The idea of that
configure command is that you run the configure command as the user
you are going to run perl as.

You might just want to start over and do this as a regular user.  Make
a directory called src/ in your home directory, copy
perl-5.10.0.tar.gz to that directory, and unpack it there (tar xzvf as
you did before).  Then run the configure, make, make install just like
you did before.  This time you should end up with a directory called

/home/jcasey/localperl/bin

and it will have the perl 5.10 executable in it.

So a shebang line of

#!/home/jcasey/localperl/bin/perl

should then work.

You might want to just make sure that it works and everything before
trying to overwrite the perl on your system, which the system may be
using to get things done.

[Rob's answer came in as I was writing this.]

The way Rob suggested, rerunning configure with prefix set to
/usr/local/, will put 5.10 in /usr/local/bin/perl.  I think CentOS has
perl in /usr/bin/perl.  If that's right (you can check with "which
perl"), and you do what Rob suggests, you will get 5.10 in
/usr/local/bin/perl, and the system can keep using the perl it was
already using, in /usr/bin/perl.  That should be a pretty safe option,
too, and is probably the normal way to do things.

As the other perl mongers can tell you, I never come around to the
normal way of doing things except by excessively circuitous routes.

mike

>
> thanks in advance,
>
> jim
>
> _______________________________________________
> Raleigh-talk mailing list
> Raleigh-talk at pm.org
> http://mail.pm.org/mailman/listinfo/raleigh-talk
>
>


More information about the Raleigh-talk mailing list