DStaal has asked for the wisdom of the Perl Monks concerning the following question:

Obviously you can get the current version of your installed perl with 'perl -v' - but is there a site/URL that can be scraped to find what the most recent release is? (I can obviously manually check perl.org, but we want something we can put into a dashboard for some non-Perl users to see along with a dozen other checks per box.)

Replies are listed 'Best First'.
Re: Machine-readable Current Version
by hippo (Archbishop) on May 04, 2017 at 18:07 UTC

    Using MetaCPAN::Client:

    #!/usr/bin/env perl use strict; use warnings; use MetaCPAN::Client; my $mcpan = MetaCPAN::Client->new (); my $perl = $mcpan->module ('perl'); print "Latest stable perl version is " . $perl->version() . "\n";

    Not so tricky, really.

      I wanted to try the MetaCPAN::Client module so I ran cpanm and installed it. That was when I realized how many dependencies it has! This module and its dependencies consumed over 16MB of disk space and took over an hour to install. Please understand I have nothing against this module. I know it has many useful features and I realize these dependencies are needed for it to do all the things it does, but in my opinion it is a bit of overkill just to see the version number. You may want to consider using the $^V system variable to get the current version:
      #!/usr/bin/perl use strict; use warnings; my $version = $^V; print "$version\n";
      Produces the following output: v5.24.1

      "Its not how hard you work, its how much you get done."

        You may want to consider using the $^V system variable to get the current version

        Um, yes, but ...

        ... it returns the version of perl you are currently running, which might be very different from the most recently released Perl. Quoting the original posting:

        is there a site/URL that can be scraped to find what the most recent release is?

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Perfect, thanks. (I was sure it wasn't tricky - I just wasn't sure where to start looking.

      (And sorry for the late reply - I forgot this site has a two-step 'preview, save' for posting

Re: Machine-readable Current Version
by Anonymous Monk on May 04, 2017 at 18:08 UTC
    Are your users building from source, or using Strawberry Perl, ActivePerl, etc.?

      We're doing a from source build - as a parallel to the build from the system pkg manager, so we can manage the Perl modules ourselves without interfering.

Re: Machine-readable Current Version
by shmem (Chancellor) on May 15, 2017 at 10:20 UTC
    I can obviously manually check perl.org

    If you can do it manually, you can tell perl to do it. TIMTOWTDI als always:

    • Perl Download:
      perl -MLWP::Simple -le 'get("https://www.perl.org/get.html") =~ /lates +t stable version, currently ([\d\.]+)\./ and print $1' 5.24.1
    • Perl Source:
      perl -MLWP::Simple -le 'get("http://www.cpan.org/src") =~ /([\d\.]+)\s ++<td>Maint/ and print $1' 5.24.1

    at the time of writing this node.

    Index of /src/5.0 on The Comprehensive Perl Archive Network is outdated at the moment, since it tells latest_maint_is_5.14.1. The links haven't been adjusted for a long time...

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
      > The links haven't been adjusted for a long time...

      Any idea whom to report the problem to?

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Done. For future reference, https://noc.perl.org/ list where you should report issues for various parts of the perl infrastructure.

        It has already been reported. Thank you.

        perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'