Permalink
Browse files

Upgraded version.pm

  • Loading branch information...
1 parent 13543e0 commit 5fc7448cfe334aa8eae731922c66ef467fbe083a @wayneeseguin wayneeseguin committed May 2, 2012
Showing with 51 additions and 3 deletions.
  1. +51 −3 core/internal/perl/version.pm
@@ -6,7 +6,7 @@ use strict;
use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv);
-$VERSION = 0.82;
+$VERSION = 0.99;
$CLASS = 'version';
@@ -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';
@@ -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'});
}
}

0 comments on commit 5fc7448

Please sign in to comment.