Skip to content

Commit

Permalink
Upgraded version.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed May 2, 2012
1 parent 13543e0 commit 5fc7448
Showing 1 changed file with 51 additions and 3 deletions.
54 changes: 51 additions & 3 deletions core/internal/perl/version.pm
Expand Up @@ -6,7 +6,7 @@ use strict;

use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv);

$VERSION = 0.82;
$VERSION = 0.99;

$CLASS = 'version';

Expand Down Expand Up @@ -114,6 +114,46 @@ $LAX =

#--------------------------------------------------------------------------#

{
local $SIG{'__DIE__'};
eval "use version::vxs $VERSION";
if ( $@ ) { # don't have the XS version installed
eval "use version::vpp $VERSION"; # don't tempt fate
die "$@" if ( $@ );
push @ISA, "version::vpp";
local $^W;
*version::qv = \&version::vpp::qv;
*version::declare = \&version::vpp::declare;
*version::_VERSION = \&version::vpp::_VERSION;
*version::vcmp = \&version::vpp::vcmp;
if ($] >= 5.009000) {
no strict 'refs';
*version::stringify = \&version::vpp::stringify;
*{'version::(""'} = \&version::vpp::stringify;
*{'version::(<=>'} = \&version::vpp::vcmp;
*version::new = \&version::vpp::new;
*version::parse = \&version::vpp::parse;
}
}
else { # use XS module
push @ISA, "version::vxs";
local $^W;
*version::declare = \&version::vxs::declare;
*version::qv = \&version::vxs::qv;
*version::_VERSION = \&version::vxs::_VERSION;
*version::vcmp = \&version::vxs::VCMP;
if ($] >= 5.009000) {
no strict 'refs';
*version::stringify = \&version::vxs::stringify;
*{'version::(""'} = \&version::vxs::stringify;
*{'version::(<=>'} = \&version::vxs::VCMP;
*version::new = \&version::vxs::new;
*version::parse = \&version::vxs::parse;
}

}
}

# Preloaded methods go here.
sub import {
no strict 'refs';
Expand Down Expand Up @@ -152,16 +192,24 @@ sub import {
unless defined(&{$callpkg.'::qv'});
}

if (exists($args{'UNIVERSAL::VERSION'})) {
local $^W;
*UNIVERSAL::VERSION
= \&version::_VERSION;
}

if (exists($args{'VERSION'})) {
*{$callpkg.'::VERSION'} = \&version::_VERSION;
}

if (exists($args{'is_strict'})) {
*{$callpkg.'::is_strict'} = \&version::is_strict;
*{$callpkg.'::is_strict'} = \&version::is_strict
unless defined(&{$callpkg.'::is_strict'});
}

if (exists($args{'is_lax'})) {
*{$callpkg.'::is_lax'} = \&version::is_lax;
*{$callpkg.'::is_lax'} = \&version::is_lax
unless defined(&{$callpkg.'::is_lax'});
}
}

Expand Down

0 comments on commit 5fc7448

Please sign in to comment.