Skip to content

Instantly share code, notes, and snippets.

@gugod
Created March 16, 2023 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gugod/494a91342bb880a62439960cc476536b to your computer and use it in GitHub Desktop.
Save gugod/494a91342bb880a62439960cc476536b to your computer and use it in GitHub Desktop.
# Original version: https://github.com/gugod/App-perlbrew/blob/915e60b80d669c46aa77b78ccf01c3d37a3ec41d/lib/App/perlbrew.pm#L604
sub comparable_perl_version {
my ($self, $pv) = @_;
my ($mc, $mi, $mp) = $pv =~ /^(?:(c?perl)-?)?(\d)\.(\d+).(\d+)|^(?:(c?perl)-?)?-?blead$/
? ($1 && $1 eq 'cperl' ? -1 : 1) * sprintf('%02d%02d%02d%s', $2 + ($1 && $1 eq 'cperl' ? 6 : 0), $3, $4, $5 || '')
: (0,0,0);
return $mc . $mi . $mp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment