Perlbrew list and wrong version number - perl

I installed two version of Perl using --as (naming the version with the major number only)
5.20.0 installed as 5.20 and
5.20.0 with threading installed as 5.20t
This is the output of perlbrew list
* 5.20 (5.20.0)
5.20t (5.20.0)
I then upgraded Perl to 5.20.1 using
$ perlbrew upgrade-perl
Upgrading 5.20 to 5.20.1
Installing /Users/corti/perl5/perlbrew/build/perl-5.20.1 into ~/perl5/perlbrew/perls/5.20
This could take a while. You can run the following command on another shell to track the status:
tail -f ~/perl5/perlbrew/build.perl-5.20.1.log
5.20 is successfully installed.
Perl seems to be correctly upgraded (v5.20.1):
$ perl -version
This is perl 5, version 20, subversion 1 (v5.20.1) built for darwin-2level
Copyright 1987-2014, 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 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.
But perlbrew list does not recognise the new version and calling perlbrew upgrade-perl does the upgrade again
$ perlbrew list
* 5.20 (5.20.0)
5.20t (5.20.0)
Why does perlbrew not recognise the update?

Because perlbrew checks for the existence of a file called
perls/*/.version
and uses its contents to determine which version of Perl is installed. If it doesn't find the file, it falls back to running the perl executable
perls/*/bin/perl
to determine the installed version and the creates the .version file.
The upgrade-perl command fails to update the file, so subsequent runs don't properly detect the installed version. I have filed a bug report

Related

Install Raku (Perl 6) in Ubuntu along with Perl 5.26

I am eager to learn Raku(Perl 6) and its syntax.
I already have Perl 5 installed in my Ubuntu machine.
vinod#ubuntu-s-1vcpu-1gb-nyc1-01:~$ perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)
Copyright 1987-2017, 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 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.
I want to install Raku in the same Ubuntu system. I have couple of questions:
How can I install Raku ?
If I install Raku, will Perl 5.26 will be get wipedout/updated? I want Perl 5.26 in my system because couple of scripts are running in Perl 5.
Can I have 2 versions of Perl in single server ?
Once if I install Raku, how can I run the Raku/Perl 5 code in Ubuntu server? Is it like I should mention use Perl 5.26; at the beginning? By default which version of Perl it will take?
How can I run Raku code?
$ sudo apt-get install rakudo
[ ... stuff happens ... ]
$ perl6 -v
This is Rakudo version 2018.03 built on MoarVM version 2018.03
implementing Perl 6.c.
$ perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 67 registered patches, see perl -V for more detail)
The Raku compiler is in a package called rakudo. That package includes a program called perl6 which is the actual Raku compiler. The Perl compiler and the Raku compiler are two completely separate programs, so there is no problem having them both installed and running code using either of them. They are as separate as Perl and PHP.
Update: In a (now, bizarrely, deleted) comment, you asked
What was the way to open a vi editor and write a code in that
You do it in exactly the same way as you would do it for any programming language where the code is compiled or interpreted on each execution - Perl, Python, Ruby, bash, they all work the same way.
You can write a text file containing Raku code and run it with perl6 your_file_name.
Or you can put the correct shebang line (which is #!/usr/bin/perl6) at the top of the file and make the file executable with chmod +x your_file_name.
There is a community maintained Repository of the most recent build of Rakudo available here : https://nxadm.github.io/rakudo-pkg/
This is generally updated a few days after each official release and is currently on 2019.07.1

Perlbrew doesn't list installed versions of Perl

I've a problem with the original Perl version in Ubuntu 16.04 and i wanted to compile and install a new one.
I've used Perlbrew to create a new Perl 5.18.2 with threads available and another one 5.18.8 for testing purposes.
I can see the directory containing all the downloaded and compiled files in '/home/my_name/perl5/perlbrew' but i
cannot lists the versions available with the 'Perlbrew list' command and consequently i cannot switch to any new version of Perl.
If there's anybody out there who can help me it would be much appreciated.
This issue is driving me crazy
You can try:
perlbrew available --all | grep i
or built-in command to list perl installations
perlbrew list

CPAN 1.61 has issue with embedded space in path within Cygwin on Win7

I’m a mere mortal using Cygwin on Win7 and wanting to develop perl scripts using SOAP::lite. Installation instructions I found at soaplite.com directed me to start with perl –MCPAN –e shell before attempting an > install SOAP::lite
The newb in me didn’t appreciate that my windows user profile has a space character in it and the CPAN set-up seemed to go all horribly wrong around the point where the script was writing make files for local::lib, MYMETA.yml and MYYMETA.json. I got “no such file or directory” messages quoting only the portion of the path that followed the space in my user profile.
$ uname -a
CYGWIN_NT-6.1 UKLHRL00020 2.0.4(0.287/5/3) 2015-06-09 12:22 x86_64 Cygwin
$ cpan --version
Loading internal null logger. Install Log::Log4perl for logging messages
/usr/bin/cpan version 1.61 calling Getopt::Std::getopts (version 1.06 [paranoid]),
running under Perl version 5.14.4.
[Now continuing due to backward compatibility and excessive paranoia.
See ``perldoc Getopt::Std'' about $Getopt::Std::STANDARD_HELP_VERSION.]
Nothing to install!
When I ran perl –MCPAN –e shell for the first time, it did report “Warning: You do not have write permission for Perl library directories.” and I elected for the default option [local::lib] for the approach to be taken.
So what can I do next?
Looking closer at the Cygwin’s setup-x86_64.exe, a search for “cpan” lists eight packages under the perl category for perl-CPAN-* and perl-Parse-CPAN*, which are all set to “Skip”. The package perl-CPANMeta: Perl distribution CPAN-Meta is version 2.150001-1 from cygwin.mirrors.pair.com. Since this is not installed yet, but the installed Perl5 has some knowledge of an old CPAN, I need to know if it is safe to install the latest and will it work with a space in my profile? Do I need to remove the old CPAN, and how?
You probably want to update to the latest version of ExtUtils::MakeMaker, recent versions contain various fixes for paths containing spaces. This should fix these issues.

Can I have the newest version of perl together with olde

I have on UNIX SunOS 5.9 Generic_122300-61 sun4u sparc SUNW,Sun-Fire-V240 perl v5.6.1, but I want to install the newest version.
Can I install the newest version and have it together with oldest but on different directories?
But my questions is :
now I have perl home on /bin/perl.
The newest perl version will be on different home directory? And also cpan and modules, are they going to be installed?
Since you are on Solaris, don't mess with the Perl that comes with the operating system. It's used by the OS itself, and if you change it things can get weird.
That said, you can absolutely install other Perl versions in parallel with it. If you're compiling manually, all you need to do is to give the flag -Dprefix=/some/nice/directory to the Configure script. Once it's compiled and installed, you only need to put /some/nice/directory/bin earlier in your PATH than /usr/bin.
If you want a system-wide installation of a newer Perl, I'd suggest picking the latest version (currently 5.20.0, but 5.20.1 is at RC2 so it should be out soon) and installing it in /usr/local. If you want a newer Perl for your own personal use, I'd strongly suggest making sure you have enough of an environment that Perl can be compiled, and then install and use perlbrew (http://perlbrew.pl/).

Isn't List::Util part of Standard Perl Distribution?

On a certain system, I am running a perl script and it's failing by saying
Can't locate List/Util.pm in #INC (#INC contains: <Some-Path>/ActiveState/perl/lib <Some-Path>/ActiveState/perl/site/lib .) at <Some-Other-Path>\searchCobolPgms.ps line 7.
Now the strange part is that before deploying the code into the failing system, I ran it on my laptop and it just ran fine. The difference in both the system is, in my laptop I am using Cygwin and perl is bundled with it and the said failing system has ActiveState perl.
<Some-Path>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 635 provided by ActiveState Corp. http://www.ActiveState.com
Built 15:34:21 Feb 4 2003
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.com/, the Perl Home Page.
I then searched for Util under the lib of cygwin and it was present under i686-cygwin
c:\cygwin\lib\perl5\5.10>find . -name Util.pm
./CGI/Util.pm
./i686-cygwin/Hash/Util.pm
./i686-cygwin/List/Util.pm
./i686-cygwin/Scalar/Util.pm
So now I am confused. Isn;t List::Util part of the standard perl distribution?
The Reason for my confusion
List/Util.pm is present under i686-cygwin
ActiveSync Installation was not having List/Util.pm
List::Util was only added to core in 5.7 (a development version) and the first stable release of perl containing List::Util was 5.8.0. So, while it is in the perl 5.10 distro you have installed under cygwin, the perl 5.6.1 ActiveState executable you called does not have it. You should update the ActiveState perl to at least 5.8.0, and then it will have the module you need.
Here is a link to find all versions of perl that contain a core module: http://perlpunks.de/corelist/version?module=List%3A%3AUtil
When I check corelist I get:
corelist List::Util
List::Util was first released with perl v5.7.3
Your perl version seems to be 5.6.1, in which case List::Util would not be part of the core installation.
Judging by the path c:\cygwin\lib\perl5\5.10, it seems your cygwin version is at least 5.10, but as you will note, the cygwin path is not in the #INC of your other perl version. They are most likely separate installations, and therefore they do not share libraries.
Update your ActiveState perl, and all should be well.