简体   繁体   中英

Perlbrew version number of latest stable version

I see perlbrew install can take a stable argument to install the latest, but I would like to get the latest stable version number to check against before installing.

How can I get the version number of the latest stable perl using perlbrew?

perlbrew available | perl -e'
   my @available_perls = <>;
   s/^\s+|\s+\z//g for @available_perls;

   my ($latest_ver, $latest_minor);
   for my $cand (@available_perls) {
      my ($ver, $minor) = $cand =~ m/^perl-(5\.(6|8|[0-9]+[02468])\.[0-9]+)$/
         or next;

      ($latest_ver, $latest_minor) = ($ver, $minor)
         if !defined $latest_minor
         || $latest_minor < $minor;
   }

   die "Can\x27t determine latest stable Perl release\n"
      if !defined $latest_ver;

   print "$latest_ver\n";
'

Effectively lifted straight out of App::perlbrew.


If you had App::perlbrew installed, you could use the following:

/path/to/perl/with/module/perl -MApp::perlbrew -e'
   my $latest_ver = App::perlbrew->new->resolve_stable_version;
   print "$latest_ver\n";
'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM