r1882 - in packages: . libversion-perl libversion-perl/branches libversion-perl/branches/upstream libversion-perl/branches/upstream/current libversion-perl/branches/upstream/current/lib libversion-perl/branches/upstream/current/lib/version libversion-perl/branches/upstream/current/t libversion-perl/branches/upstream/current/vutil

Krzysztof Krzyzaniak eloy at costa.debian.org
Tue Jan 10 10:59:07 UTC 2006


Author: eloy
Date: 2006-01-10 10:58:36 +0000 (Tue, 10 Jan 2006)
New Revision: 1882

Added:
   packages/libversion-perl/
   packages/libversion-perl/branches/
   packages/libversion-perl/branches/upstream/
   packages/libversion-perl/branches/upstream/current/
   packages/libversion-perl/branches/upstream/current/Build.PL
   packages/libversion-perl/branches/upstream/current/Changes
   packages/libversion-perl/branches/upstream/current/MANIFEST
   packages/libversion-perl/branches/upstream/current/META.yml
   packages/libversion-perl/branches/upstream/current/Makefile.PL
   packages/libversion-perl/branches/upstream/current/README
   packages/libversion-perl/branches/upstream/current/lib/
   packages/libversion-perl/branches/upstream/current/lib/version.pm
   packages/libversion-perl/branches/upstream/current/lib/version.pod
   packages/libversion-perl/branches/upstream/current/lib/version/
   packages/libversion-perl/branches/upstream/current/lib/version/typemap
   packages/libversion-perl/branches/upstream/current/lib/version/vxs.pm
   packages/libversion-perl/branches/upstream/current/lib/version/vxs.xs
   packages/libversion-perl/branches/upstream/current/t/
   packages/libversion-perl/branches/upstream/current/t/01base.t
   packages/libversion-perl/branches/upstream/current/t/02derived.t
   packages/libversion-perl/branches/upstream/current/t/coretests.pm
   packages/libversion-perl/branches/upstream/current/vutil/
   packages/libversion-perl/branches/upstream/current/vutil/ppport.h
   packages/libversion-perl/branches/upstream/current/vutil/vutil.c
   packages/libversion-perl/branches/upstream/current/vutil/vutil.h
   packages/libversion-perl/tags/
Log:
[svn-inject] Installing original source of libversion-perl

Added: packages/libversion-perl/branches/upstream/current/Build.PL
===================================================================
--- packages/libversion-perl/branches/upstream/current/Build.PL	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/Build.PL	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use Module::Build;
+my $class = Module::Build->subclass
+(
+    class => 'version::Builder',
+    code => q{
+    sub ACTION_dist{
+        my $self = shift;
+    	$self->do_system('svk log -x | gnuify-changelog.pl > Changes');
+	$self->SUPER::ACTION_dist();
+	}
+    },
+);
+
+my $m = $class->new(
+    module_name     => 'version::vxs',
+    dist_name       => 'version',
+    license         => 'perl',
+    c_source        => './vutil',
+    requires        => {
+	'perl'		=> '> 5.005, !=5.9.1, !=5.9.2',
+	'Module::Build'	=> '0.2611',
+    },
+);
+$m->create_build_script;

Added: packages/libversion-perl/branches/upstream/current/Changes
===================================================================
--- packages/libversion-perl/branches/upstream/current/Changes	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/Changes	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,657 @@
+2005-12-02  John Peacock <jpeacock at cpan.org>
+
+	* version/vxs.pm
+	    Forgot to bump this.  When am I going to have inherited props?
+
+2005-12-02  John Peacock <jpeacock at cpan.org>
+
+	* Build.PL
+	    Explicit minimum version of Module::Build.  Fixes
+	    <https://rt.cpan.org/Ticket/Display.html?id=16249>
+
+	* README
+	    Whoo-hoo!  Remember to update this the first time.
+
+	* lib/version.pm
+	    Make sure that there is no possible way that Perl will
+	    try to include the non-existant pure Perl vpp.pm
+
+	* lib/version.pod
+	    Complete rewrite that is hopefully easier to understand.
+
+2005-11-01  John Peacock <jpeacock at cpan.org>
+
+	* vutil/vutil.c
+	    Use trinary operator to choose power of 10, rather than pow(),
+	    which caused some problem with AIX 5.1.  Resolves:
+
+	      <https://rt.cpan.org/NoAuth/Bug.html?id=15254>
+
+	* t/02derived.t
+	    Suppress unnecessary warning when overriding qv() sub.
+
+2005-10-10  John Peacock <jpeacock at cpan.org>
+
+	* version/README
+	    Remember to update this for 0.49 release.
+
+2005-10-08  John Peacock <jpeacock at cpan.org>
+
+	Fix Build.PL so Win32 will compile properly
+
+2005-10-06  John Peacock <jpeacock at cpan.org>
+
+	* version/Build.PL
+	    Explicit call to dist_name to help Windows DTRT.  Resolves
+	    ticket:
+
+	      <https://rt.cpan.org/Ticket/Display.html?id=14743>
+
+	* lib/version/vxs.pm
+	  lib/version.pm
+	  lib/version.pod
+	  t/01base.t
+	  t/02derived.t
+	  t/coretests.pm
+	  vutil/vutil.c
+	    Change implementation to return version objects instead of
+	    version::vxs object.  Document that qv() isn't inherited and
+	    give work around.  Update tests to no longer test version::vxs
+	    class directly (since it doesn't work).  Resolves ticket:
+
+	      <https://rt.cpan.org/Ticket/Display.html?id=14958>
+
+2005-09-26  John Peacock <jpeacock at cpan.org>
+
+	Start POD rewrite.
+
+2005-09-14  John Peacock <jpeacock at cpan.org>
+
+	Significant archectectural change (object hash has to contain
+	reference to array not the array itself); see
+
+	    <https://rt.cpan.org/Ticket/Display.html?id=14439>
+
+	for details.  Initial changes to support pure Perl variant
+	(not included yet), see
+
+	    <https://rt.cpan.org/Ticket/Display.html?id=14417>
+
+	for more details.  All POD moved to seperate file.  Tests
+	abstracted out for reuse by different classes.
+
+2005-09-07  John Peacock <jpeacock at cpan.org>
+
+	"version" element of hash must be a reference, see:
+	   <https://rt.cpan.org/Ticket/Display.html?id=14439>
+	for details.
+
+	Also, function name changes backported from bleadperl version.
+
+2005-08-23  John Peacock <jpeacock at cpan.org>
+
+	Badly written subclasses could SEGV (reported by Andreas Koenig).
+	Now all version objects are validated before use.
+
+	Add vverify() function to validate version objects and include
+	it before each use of a version object.  Add tests for poorly
+	written subclass that tickle the above function.
+
+	Apply const'ifying from bleadperl and reformat calls to
+	sv_[cat|set]pvf to be consistent with bleadperl source.
+
+2005-08-22  John Peacock <jpeacock at cpan.org>
+
+	Leading whitespace or lack of leading zero caused the the object
+	to be initialized incorrectly (reported by Andreas Koenig).
+
+	Added POD for subclassing.  Removed cruft from README file.
+
+2005-08-03  John Peacock <jpeacock at cpan.org>
+
+	Don't strip trailing zeros unneccesarily
+
+2005-08-02  John Peacock <jpeacock at cpan.org>
+
+	Spelling fixes from "Piotr Fusik" <pfusik at op.pl>
+
+2005-07-23  John Peacock <jpeacock at cpan.org>
+
+	Complete rename of files to prevent GCC 4.0 bug
+
+2005-07-23  John Peacock <jpeacock at cpan.org>
+
+	Preliminary commit for rename of util.[ch]
+
+2005-06-06  John Peacock <jpeacock at cpan.org>
+
+	Final changes to release 0.43 to CPAN
+
+	*   README, lib/version.pm
+	    Bump $VERSION number
+
+	*   t/01base.t
+	    Test that single term version expands to triplet for
+	    $v->normal.  Eliminate "Exporter" from derived class.
+
+	*   util/util.c
+	    Various const'ifying to match Perl's own changes.
+	    Handle short and really short array outputs in vnormal().
+
+	*   util/util.h
+	    const'ify Perl_scan_version().
+
+2005-05-23  John Peacock <jpeacock at cpan.org>
+
+	Complete rewrite of parser to handle CPAN-style (two significant
+	decimal) versions, as well as finish documenting the changes.
+
+	*   util/util.c
+	    Simplify parser to just count digits when parsing numeric
+	    versions.
+
+	*   lib/version.pm
+	    Rewrite documentation on Numeric Alpha Versions and make all
+	    examples consistent.
+
+	*   t/01base.t
+	    Add additional tests for CPAN-style alphas as well as
+	    object->new().
+
+2005-05-20  John Peacock <jpeacock at cpan.org>
+
+	*   lib/version.pm
+	    Revised POD to correspond to new behavior with regards to both
+	    Quoted Versions and Alpha Versions.
+
+	*   lib/version.xs
+	    Extend new() to be callable as an object method.
+	    Copy existing object if called as object method with no
+	    parameter.
+
+2005-05-17  John Peacock <jpeacock at cpan.org>
+
+	Working towards a release to CPAN.
+
+	*   README
+	    lib/version.pm
+	    First pass at documenting the external changes.
+
+	*   t/01base.t
+	    Since vcmp() is working again, can restore the minimum to the
+	    use line.
+
+	*   util/util.c
+	    Finish up handling for vcmp to deal with alpha versions.
+
+2005-05-17  John Peacock <jpeacock at cpan.org>
+
+	Almost completely working; only the comparison tests with
+	non-objects is still failing.
+
+	*   lib/version.xs
+	    Simplify is_alpha() now that it is just as hash flag.
+
+	*   util/util.c
+	    Manually create and copy the hash elements when creating new
+	    object from old object.
+	    Forgot to make sure to display all subversion from short
+	    numeric versions.
+
+2005-05-15  John Peacock <jpeacock at cpan.org>
+
+	Completed (?) to move to Module::Build
+
+	*   lib/typemap
+	    lib/version.xs
+	    Move XS and support files to lib/
+
+	*   util/ppport.h
+	    util/util.c
+	    util/util.h
+	    Move utility functions in their own directory (c_source)
+
+	*   MANIFEST
+	    Updated to reflect new file locations
+	    Add additional files that were originally left out of file
+	    Alphabetize this listing (for compulsiveness)
+
+2005-05-15  John Peacock <jpeacock at cpan.org>
+
+	Intermediate commit to facilitate move to Module::Build as well as
+	work on new hash-based object (all tests do not suceed)
+
+	*   Makefile.PL
+	    Replace ExtUtils::MakeMaker with Module::Build wrapper
+
+	*   Build.PL
+	    New M::B file
+
+	*   version.xs
+	    Try and deal with case where no parameter was passed to new()
+
+	*   util.c
+	    Changes to access hash-based object (vcmp still busted)
+
+	*   t/01base.t
+	    Changed to prevent core dump (temporarily)
+
+2005-05-08  John Peacock <jpeacock at cpan.org>
+
+	Implement alpha versions using secret array zero slot to
+	differentiate between two place alphas (1.02_03) and three place
+	alphas (1.002_03) so that versions which only use two significant
+	places normally will still sort correctly with their alpha
+	versions.
+
+	*  util.c
+	   (Perl_scan_version): Somehow manage to both simplify and
+	   complicate the code at the same time.
+	   (Perl_vnumify): use the new zero'th array element to distinguish
+	   between 2 and 3 significant decimal places for printing.
+
+2005-04-21  John Peacock <jpeacock at cpan.org>
+
+	*  util.c
+	   Handle two digit alpha versions
+	   Once a v-style or FP, always a v-style or FP
+
+	*  t/01base.t
+	   Altered tests to match new expectations
+
+2005-02-06  John Peacock <jpeacock at cpan.org>
+
+	*   Makefile.PL
+	    Windows doesn't understand the braces for shell expansion
+
+	*   README, lib/version.pm
+	    Change $VERSION string
+
+	*   t/01base.t
+	    Correctly compare to numified version (instead of stringified)
+
+	*   util.c
+	    Use same code as bleadperl
+	    AvReal_on required to fix problems under threaded Perl
+	    Slight rewrite of loop code to fix compiler bug on OS X
+	    Display alpha versions properly
+
+	*   version.xs
+	    new() returns void since it actual returns on the stack
+
+2004-07-12  John Peacock <jpeacock at cpan.org>
+
+	*    util.c
+	     Fix infinite loop for CVS-style versions of more than 3
+	     decimal places.
+	     Thanks to Richard Evans <richard_david_evans at yahoo.co.uk>
+
+	*    t/01base.t
+	     Test to make sure above doesn't happen again.
+
+	*    lib/version.pm
+	     Increment the $VERSION again.
+
+	*    README
+	     Remember to update this before releasing (for a change).
+
+2004-07-11  John Peacock <jpeacock at cpan.org>
+
+	*    lib/version.pm
+	     Increment $VERSION number; have to quote to get the tgz file
+	     named correctly (isn't that what this module is supposed to
+	     fix?)
+
+	*    version.xs:UNIVERSAL_VERSION()
+	     Check for null sv before attempting sv_derived_from()
+	     Thanks to Marcus Holland-Moritz <mhx-perl at gmx.net> for finding
+	     this.
+
+2004-04-14  John Peacock <jpeacock at cpan.org>
+
+	Merge changes from version-0.39 back to trunk
+
+2004-01-06  John Peacock <jpeacock at cpan.org>
+
+	*    t/02AlphaBeta.t
+	*    t/01base.t
+	     Update tests to require newer version.
+	     Change test for CPAN-Style version behavior.
+
+	*    MANIFEST
+	     Delete 'Changes' from repository since it will now be
+	     autogenerated.
+
+	*    lib/version.pm
+	     Clean up POD to reflect actual behavior of code.
+
+	*    Makefile.PL
+	     Add new target to automatically generate the 'Changes' file.
+
+	*    util.c
+	     (Perl_scan_version): rewrite code to use AV * instead of SV *
+	     for internal representation; trigger CPAN-style only for
+	     second term.
+
+2004-01-03  John Peacock <jpeacock at cpan.org>
+
+	Ignore MakeMaker-generated files in svn status
+
+2004-01-03  John Peacock <jpeacock at cpan.org>
+
+	Ignore MakeMaker-generated files in svn status
+
+2004-01-03  John Peacock <jpeacock at cpan.org>
+
+	Ignore MakeMaker-generated files in svn status
+
+2004-01-01  John Peacock <jpeacock at cpan.org>
+
+	*    lib/version.pm
+	     (POD): Initial documentation of CPAN-Style versions.
+
+	*    util.c
+	     (Perl_scan_version): Try and handle CPAN versions (two
+	     decimal places) differently from Perl-style (three or more
+	     decimal places).
+
+2003-12-29  John Peacock <jpeacock at cpan.org>
+
+	*    typemap
+	     Stop automatically dereferencing input variable
+	*    lib/version.pm
+	     Update $VERSION for a change
+	*    README
+	     Include warning on memory leaks
+	*    util.c
+	     (new_version): use upg_version exclusively
+	     (upg_version): move code from new_version here
+	*    version.xs
+	     Stop dereferencing input variables
+	     Stop assuming that the PV has a value
+
+2003-12-28  John Peacock <jpeacock at cpan.org>
+
+	*    t/01base.t
+	     Replace postfix increment with prefix increment to prevent erroneous
+	     "Attempt to free..." errors
+	     Add test of CVS $Revision: $ style versions
+
+	*    util.c
+	     Rewrite new_version to free temporary string variable
+
+	*    version.xs
+	     Rewrite version->new() to eliminate temp string for CVS $Revision: $
+	     Rewrite version->qv() to use scan_version instead of new_version
+
+2003-12-21  John Peacock <jpeacock at cpan.org>
+
+	M    version.xs
+	     Go through code to ensure that there are no leaking scalars
+	     Sadly, there are still leaks from version::VERSION of unknown origins
+
+2003-12-20  John Peacock <jpeacock at cpan.org>
+
+	M    t/02AlphaBeta.t
+	M    lib/version/AlphaBeta.pm
+	     Implement an alternate object representation
+	     Overload stringify() with custom function
+
+2003-10-25  John Peacock <jpeacock at cpan.org>
+
+	M    t/02AlphaBeta.t
+	     Add empty derived class and modify tests to run
+	M    t/01base.t
+	     Work around bug with postfix increment under all Perl < bleadperl
+
+2003-09-10  John Peacock <jpeacock at cpan.org>
+
+	Fix for Ticket #3764 - need to strip final term before chop()
+	Implement qv() function and document/test
+
+2003-09-10  John Peacock <jpeacock at cpan.org>
+
+	Remove the changes file from the repository.
+	Generate it before release:
+
+		svn log file:///var/svn/modules/version/trunk
+
+	and eventually by 'release.pl --changes'
+
+2003-09-10  John Peacock <jpeacock at cpan.org>
+
+	Finish backporting bleadperl changes
+	Special case test for 5.005_03
+	Patch ppport.h to support IVSIZE for 5.005_03
+
+2003-09-10  John Peacock <jpeacock at cpan.org>
+
+	No, really delete the lines from MANIFEST
+	Last bit of clean up in the POD
+
+2003-09-10  John Peacock <jpeacock at cpan.org>
+
+	Delete version::Empty module and include in t/01base.t instead
+	Correct MANIFEST (delete missing files and add ppport.h)
+	Make version::stringify() return at least three subversions
+
+2003-09-09  John Peacock <jpeacock at cpan.org>
+
+	Integrate changes from bleadperl
+	Combine emptyclass.t test into 01base.t
+	Use ppport.h instead of homebrewed #define's
+
+2003-09-07  John Peacock <jpeacock at cpan.org>
+
+	Extend version::new() to handle derived classes
+	Abstract t/01base.t into external file
+	Create and test empty derived class
+
+	FIX: "attempt to free unreferenced scalar" during testing
+
+2003-07-09  John Peacock <jpeacock at cpan.org>
+
+	Merge changes made accidently on branch back to head
+
+2003-06-13  John Peacock <jpeacock at cpan.org>
+
+	Forgot to commit this before releasing.
+
+2003-06-13  John Peacock <jpeacock at cpan.org>
+
+	Correct the example code (again) to correct for CVS update problems
+
+2003-06-13  John Peacock <jpeacock at cpan.org>
+
+	Reformatted POD's from <Matthew.Persico at Lazard.com>
+
+2003-06-13  John Peacock <jpeacock at cpan.org>
+
+	Change reference from "beta" to "alpha" to follow PAUSE convention
+	Add new function ->is_alpha() to test for alpha versions
+	Add docs for all logical operations on version objects
+	Fix example to have matching versions (old CVS issue)
+
+2003-06-13  John Peacock <jpeacock at cpan.org>
+
+	Implement version::AlphaBeta module
+	Copy repository history from CVS into subversion
+
+2003-06-13  John Peacock <jpeacock at cpan.org>
+
+	To prepare to load /home/jpeacock/tmp/version-0.28 into version/trunk,
+	perform 2 renames.
+
+	* version/trunk/t/1.t: Renamed from version/trunk/t/version.t.
+	* version/trunk/lib/version.pm: Renamed from version/trunk/version.pm.
+
+2003-01-05  John Peacock <jpeacock at cpan.org>
+
+	Extract most recent log messages for main file
+
+2003-01-05  John Peacock <jpeacock at cpan.org>
+
+	Rewrite POD to call a v-string a v-string
+	Reformat POD to look nicer
+
+2003-01-05  John Peacock <jpeacock at cpan.org>
+
+	Make vnumify return an actual NV (instead of an SV which looks like one)
+
+2003-01-05  John Peacock <jpeacock at cpan.org>
+
+	Make warnings even more dire
+
+2003-01-05  John Peacock <jpeacock at cpan.org>
+
+	change comment message to more accurately reflect the test
+
+2002-12-27  John Peacock <jpeacock at cpan.org>
+
+	Rewrite to support new model of "Numeric Versions" and "String Versions"
+
+2002-12-17  John Peacock <jpeacock at cpan.org>
+
+	New version to cope with GSAR's vision of bare number versions
+
+2002-12-05  John Peacock <jpeacock at cpan.org>
+
+	Make -w clean tests
+
+2002-12-05  John Peacock <jpeacock at cpan.org>
+
+	Bring into sync with perl-current
+
+2002-11-18  John Peacock <jpeacock at cpan.org>
+
+	Bring current with repository version
+
+2002-11-18  John Peacock <jpeacock at cpan.org>
+
+	Fix compile errors under threaded Perl's
+	Supress {Unquoted string version} warnings
+
+2002-11-18  John Peacock <jpeacock at cpan.org>
+
+	Fix compile errors under threaded Perls
+
+2002-11-18  John Peacock <jpeacock at cpan.org>
+
+	Fix compile errors under threaded Perl's
+	Supress {Unquoted string "version"} warnings
+
+2002-10-14  John Peacock <jpeacock at cpan.org>
+
+	Fix typos
+	Fix handling of null versions
+
+2002-10-10  John Peacock <jpeacock at cpan.org>
+
+	use Perl_croak from C code
+
+2002-10-08  John Peacock <jpeacock at cpan.org>
+
+	Recover gracefully to null versions (rather than core)
+
+2002-10-08  John Peacock <jpeacock at cpan.org>
+
+	Recover gracefully to null versions (rather than core)
+
+2002-10-04  John Peacock <jpeacock at cpan.org>
+
+	Document extended decimal version parsing
+
+2002-10-04  John Peacock <jpeacock at cpan.org>
+
+	Force all files to next major revision (so the version works)
+
+2002-10-04  John Peacock <jpeacock at cpan.org>
+
+	Add tests for 1.002003 => 1.2.3
+
+2002-10-04  John Peacock <jpeacock at cpan.org>
+
+	Add support for 1.002003 => 1.2.3
+
+2002-10-04  John Peacock <jpeacock at cpan.org>
+
+	Remove dependency on Exporter.pm
+
+2002-09-29  John Peacock <jpeacock at cpan.org>
+
+	Update with version from perl-current
+
+2002-09-29  John Peacock <jpeacock at cpan.org>
+
+	Change vstringify and vnumify
+	Reword main POD slightly
+
+2002-09-28  John Peacock <jpeacock at cpan.org>
+
+	Final changes to release to CPAN
+	Merged code into perl-current
+
+2002-09-28  John Peacock <jpeacock at cpan.org>
+
+	Ready to release to CPAN
+
+2002-09-28  John Peacock <jpeacock at cpan.org>
+
+	POD changes
+
+2002-09-28  John Peacock <jpeacock at cpan.org>
+
+	Cannot use SvPV_nolen in 5.005_03
+
+2002-09-22  John Peacock <jpeacock at cpan.org>
+
+	Document the UNIVERSAL::VERSION replacement
+
+2002-09-22  John Peacock <jpeacock at cpan.org>
+
+	Successfully create and test my own UNIVERSAL::VERSION replacement
+
+2002-09-16  John Peacock <jpeacock at cpan.org>
+
+	Improve the testing of beta versions
+
+2002-09-16  John Peacock <jpeacock at cpan.org>
+
+	More POD changes
+
+2002-09-16  John Peacock <jpeacock at cpan.org>
+
+	Add additional testing
+	Add POD
+
+2002-09-16  John Peacock <jpeacock at cpan.org>
+
+	Finally works in 5.005_03, 5.6.1, and 5.8.0
+
+2002-09-15  John Peacock <jpeacock at cpan.org>
+
+	Doesn't work any more?
+
+2002-09-14  John Peacock <jpeacock at cpan.org>
+
+	working AV objects in 5.6.x only
+
+2002-09-14  John Peacock <jpeacock at cpan.org>
+
+	*** empty log message ***
+
+2002-09-13  John Peacock <jpeacock at cpan.org>
+
+	Finished for the night
+
+2002-09-13  John Peacock <jpeacock at cpan.org>
+
+	almost working AV style version objects
+
+2002-09-13  John Peacock <jpeacock at cpan.org>
+
+	Initial revision
+
+;; Local Variables:
+;; coding: utf-8
+;; End:

Added: packages/libversion-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libversion-perl/branches/upstream/current/MANIFEST	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/MANIFEST	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,17 @@
+Build.PL
+Changes
+lib/version.pm
+lib/version.pod
+lib/version/typemap
+lib/version/vxs.pm
+lib/version/vxs.xs
+Makefile.PL
+MANIFEST
+META.yml
+README
+t/01base.t
+t/02derived.t
+t/coretests.pm
+vutil/vutil.c
+vutil/vutil.h
+vutil/ppport.h

Added: packages/libversion-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libversion-perl/branches/upstream/current/META.yml	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/META.yml	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,17 @@
+---
+name: version
+version: 0.50
+author: ~
+abstract: ~
+license: perl
+requires:
+  Module::Build: 0.2611
+  perl: '> 5.005, !=5.9.1, !=5.9.2'
+provides:
+  version:
+    file: lib/version.pm
+    version: 0.50
+  version::vxs:
+    file: lib/version/vxs.pm
+    version: 0.50
+generated_by: Module::Build version 0.2611

Added: packages/libversion-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libversion-perl/branches/upstream/current/Makefile.PL	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/Makefile.PL	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,27 @@
+unless (eval "use Module::Build::Compat 0.02; 1" ) {
+  print "This module requires Module::Build to install itself.\n";
+
+  require ExtUtils::MakeMaker;
+  my $yn = ExtUtils::MakeMaker::prompt
+    ('  Install Module::Build from CPAN?', 'y');
+
+  if ($yn =~ /^y/i) {
+    require Cwd;
+    require File::Spec;
+    require CPAN;
+
+    # Save this 'cause CPAN will chdir all over the place.
+    my $cwd = Cwd::cwd();
+    my $makefile = File::Spec->rel2abs($0);
+
+    CPAN::Shell->install('Module::Build::Compat');
+
+    chdir $cwd or die "Cannot chdir() back to $cwd: $!";
+    exec $^X, $makefile, @ARGV;  # Redo now that we have Module::Build
+  } else {
+    warn " *** Cannot install without Module::Build.  Exiting ...\n";
+    exit 1;
+  }
+}
+Module::Build::Compat->run_build_pl(args => \@ARGV);
+Module::Build::Compat->write_makefile();

Added: packages/libversion-perl/branches/upstream/current/README
===================================================================
--- packages/libversion-perl/branches/upstream/current/README	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/README	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,73 @@
+version 0.50
+==================================
+
+Provides the same version objects as included in Perl v5.9.x (and hopefully in
+the 5.10.0 release).  In fact, if you attempt to use this module with a version
+of Perl >= v5.9.0, this module will not do anything, since the code already
+exists in the Perl core.  Note that the CPAN release cannot be installed
+with the interim 5.9.0, 5.9.1, and 5.9.2 releases (since it duplicates code
+in the core).  If you are testing bleadperl, you will need to check out the
+latest release of 5.9.x to get the changes included in 0.50.
+
+
+Major changes in this release:
+==================================
+Completely rewritten POD to hopefully make it clear what is the recommended
+Best Practices (to go along with Damien's book).  I also hid the forthcoming
+pure Perl module better (you cannot accidently use it, in other words,
+since it only exists on my hard-drive for now).  I also dealt with the
+following bugs:
+
+	fails tests on AIX 5.1
+	<https://rt.cpan.org/Ticket/Display.html?id=15254>
+
+	Missing vpp.pm
+	<https://rt.cpan.org/Ticket/Display.html?id=16249>
+
+
+Major changes in 0.49
+==================================
+Changes in 0.48 accidently broke modules depending on qv() returning an 
+object derived from 'version'.  Tests were simplified since the
+implementation class 'version::vxs' is no longer independent of the main
+class.
+
+
+Major changes in 0.48
+==================================
+Significant archectectural change (object hash has to contain reference to
+array not the array itself); see
+
+    <https://rt.cpan.org/Ticket/Display.html?id=14439>
+
+for details.  Initial changes to support pure Perl variant (not
+included yet), see
+
+    <https://rt.cpan.org/Ticket/Display.html?id=14417>
+
+for more details.  All POD moved to seperate file.  Tests
+abstracted out for reuse by different classes.
+
+
+Please read the POD documentation for usage/details.  See the CHANGES file
+for full details of all changes to the module behavior.
+
+INSTALLATION
+
+To install this module type the following:
+
+   $ perl Build.PL
+   $ ./Build
+   $ ./Build test
+   # ./Build install
+
+DEPENDENCIES
+
+the same C compiler used to build Perl
+
+COPYRIGHT AND LICENCE
+
+This module can be distributed under the same terms as Perl.
+
+Copyright (C) 2004,2005 John Peacock
+

Added: packages/libversion-perl/branches/upstream/current/lib/version/typemap
===================================================================
--- packages/libversion-perl/branches/upstream/current/lib/version/typemap	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/lib/version/typemap	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,29 @@
+###############################################################################
+##                                                                           ##
+##    Typemap for module "Universal::Version"                                ##
+##                                                                           ##
+##    Copyright (c) 2001 by John Peacock.                                    ##
+##    All rights reserved.                                                   ##
+##                                                                           ##
+##    This package is free software; you can redistribute it                 ##
+##    and/or modify it under the same terms as Perl itself.                  ##
+##                                                                           ##
+###############################################################################
+
+TYPEMAP
+
+N_int	T_IV
+N_long	T_IV
+Z_int	T_IV
+Z_long	T_IV
+boolean	T_IV
+version_vxs T_PTROBJ_SPECIAL
+
+INPUT
+
+T_PTROBJ_SPECIAL
+        if (sv_derived_from($arg, \"${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")) {
+	    $var = $arg;
+        }
+        else
+            Perl_croak(aTHX_ \"$var is not of type ${(my $ntt=$ntype)=~s/_/::/g;\$ntt}\")

Added: packages/libversion-perl/branches/upstream/current/lib/version/vxs.pm
===================================================================
--- packages/libversion-perl/branches/upstream/current/lib/version/vxs.pm	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/lib/version/vxs.pm	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,24 @@
+#!perl -w
+package version::vxs;
+
+use 5.005_03;
+use strict;
+
+require Exporter;
+require DynaLoader;
+use vars qw(@ISA $VERSION $CLASS @EXPORT);
+
+ at ISA = qw(Exporter DynaLoader);
+
+ at EXPORT = qw(qv);
+
+$VERSION = "0.50"; 
+
+$CLASS = 'version::vxs';
+
+local $^W; # shut up the 'redefined' warning for UNIVERSAL::VERSION
+bootstrap version::vxs if $] < 5.009;
+
+# Preloaded methods go here.
+
+1;

Added: packages/libversion-perl/branches/upstream/current/lib/version/vxs.xs
===================================================================
--- packages/libversion-perl/branches/upstream/current/lib/version/vxs.xs	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/lib/version/vxs.xs	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,257 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "vutil.h"
+
+/* --------------------------------------------------
+ * $Revision: 2.5 $
+ * --------------------------------------------------*/
+
+typedef     SV *version_vxs;
+
+MODULE = version::vxs	PACKAGE = version::vxs
+
+PROTOTYPES: DISABLE
+VERSIONCHECK: DISABLE
+
+BOOT:
+	/* register the overloading (type 'A') magic */
+	PL_amagic_generation++;
+	newXS("version::vxs::()", XS_version__vxs_noop, file);
+	newXS("version::vxs::(\"\"", XS_version__vxs_stringify, file);
+	newXS("version::vxs::(0+", XS_version__vxs_numify, file);
+	newXS("version::vxs::(cmp", XS_version__vxs_vcmp, file);
+	newXS("version::vxs::(<=>", XS_version__vxs_vcmp, file);
+	newXS("version::vxs::(bool", XS_version__vxs_boolean, file);
+	newXS("version::vxs::(nomethod", XS_version__vxs_noop, file);
+	newXS("UNIVERSAL::VERSION", XS_version__vxs_VERSION, file);
+
+void
+new(...)
+PPCODE:
+{
+    SV *vs = ST(1);
+    SV *rv;
+    char *class;
+
+    /* get the class if called as an object method */
+    if ( sv_isobject(ST(0)) ) {
+	class = HvNAME(SvSTASH(SvRV(ST(0))));
+    }
+    else {
+	class = (char *)SvPV_nolen(ST(0));
+    }
+
+    if (items == 3 )
+    {
+	STRLEN n_a;
+	vs = sv_newmortal();
+	sv_setpvf(vs,"v%s",SvPV(ST(2),n_a));
+    }
+    if ( items == 1 )
+    {
+	/* no parameter provided */
+	if ( sv_isobject(ST(0)) )
+	{
+	    /* copy existing object */
+	    vs = ST(0);
+	}
+	else
+	{
+	    /* create empty object */
+	    vs = sv_newmortal();
+	    sv_setpv(vs,"");
+	}
+    }
+
+    rv = new_version(vs);
+    if ( strcmp(class,"version::vxs") != 0 ) /* inherited new() */
+	sv_bless(rv, gv_stashpv(class,TRUE));
+
+    PUSHs(sv_2mortal(rv));
+}
+
+void
+stringify (lobj,...)
+    version_vxs	lobj
+PPCODE:
+{
+    PUSHs(sv_2mortal(vstringify(lobj)));
+}
+
+void
+numify (lobj,...)
+    version_vxs	lobj
+PPCODE:
+{
+    PUSHs(sv_2mortal(vnumify(lobj)));
+}
+
+void
+vcmp (lobj,...)
+    version_vxs	lobj
+PPCODE:
+{
+    SV	*rs;
+    SV * robj = ST(1);
+    IV	 swap = (IV)SvIV(ST(2));
+
+    if ( ! sv_derived_from(robj, "version::vxs") )
+    {
+	robj = sv_2mortal(new_version(robj));
+    }
+
+    if ( swap )
+    {
+        rs = newSViv(vcmp(robj,lobj));
+    }
+    else
+    {
+        rs = newSViv(vcmp(lobj,robj));
+    }
+
+    PUSHs(sv_2mortal(rs));
+}
+
+void
+boolean(lobj,...)
+    version_vxs	lobj
+PPCODE:
+{
+    SV	*rs;
+    rs = newSViv( vcmp(lobj,new_version(newSVpvn("0",1))) );
+    PUSHs(sv_2mortal(rs));
+}
+
+void
+noop(lobj,...)
+    version_vxs	lobj
+CODE:
+{
+    Perl_croak(aTHX_ "operation not supported with version object");
+}
+
+void
+is_alpha(lobj)
+    version_vxs	lobj	
+PPCODE:
+{
+    if ( hv_exists((HV*)SvRV(lobj), "alpha", 5 ) )
+	XSRETURN_YES;
+    else
+	XSRETURN_NO;
+}
+
+void
+qv(ver)
+    SV *ver
+PPCODE:
+{
+#ifdef SvVOK
+    if ( !SvVOK(ver) ) { /* not already a v-string */
+#endif
+	SV *vs = sv_newmortal();
+	char *version;
+	if ( SvNOK(ver) ) /* may get too much accuracy */
+	{
+	    char tbuf[64];
+	    sprintf(tbuf,"%.9"NVgf, SvNVX(ver));
+	    version = savepv(tbuf);
+	}
+	else
+	{
+	    STRLEN n_a;
+	    version = savepv(SvPV(ver,n_a));
+	}
+	(void)scan_version(version,vs,TRUE);
+	Safefree(version);
+
+	PUSHs(vs);
+#ifdef SvVOK
+    }
+    else
+    {
+	PUSHs(sv_2mortal(new_version(ver)));
+    }
+#endif
+}
+
+void
+normal(ver)
+    SV *ver
+PPCODE:
+{
+    PUSHs(sv_2mortal(vnormal(ver)));
+}
+
+void
+VERSION(sv,...)
+    SV *sv
+PPCODE:
+{
+    HV *pkg;
+    GV **gvp;
+    GV *gv;
+    char *undef;
+
+    if (SvROK(sv)) {
+        sv = (SV*)SvRV(sv);
+        if (!SvOBJECT(sv))
+            Perl_croak(aTHX_ "Cannot find version of an unblessed reference");
+        pkg = SvSTASH(sv);
+    }
+    else {
+        pkg = gv_stashsv(sv, FALSE);
+    }
+
+    gvp = pkg ? (GV**)hv_fetch(pkg,"VERSION",7,FALSE) : Null(GV**);
+
+    if (gvp && isGV(gv = *gvp) && SvOK(sv = GvSV(gv))) {
+        SV *nsv = sv_newmortal();
+        sv_setsv(nsv, sv);
+        sv = nsv;
+	if ( !sv_derived_from(sv, "version::vxs"))
+	    upg_version(sv);
+        undef = Nullch;
+    }
+    else {
+        sv = (SV*)&PL_sv_undef;
+        undef = "(undef)";
+    }
+
+    if (items > 1) {
+	SV *req = ST(1);
+	STRLEN len;
+
+	if (undef) {
+	     if (pkg)
+		  Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed",
+			     HvNAME(pkg), HvNAME(pkg));
+	     else {
+		  char *str = SvPVx(ST(0), len);
+
+		  Perl_croak(aTHX_ "%s defines neither package nor VERSION--version check failed", str);
+	     }
+	}
+
+        if ( !sv_derived_from(req, "version::vxs")) {
+	    /* req may very well be R/O, so create a new object */
+	    SV *nsv = sv_newmortal();
+	    sv_setsv(nsv, req);
+	    req = nsv;
+	    upg_version(req);
+	}
+
+	if ( vcmp( req, sv ) > 0 )
+	    Perl_croak(aTHX_ "%s version %"SVf" (%"SVf") required--"
+		    "this is only version %"SVf" (%"SVf")", HvNAME(pkg),
+		    vnumify(req),vnormal(req),vnumify(sv),vnormal(sv));
+    }
+
+    if ( SvOK(sv) && sv_derived_from(sv, "version::vxs") )
+	PUSHs(vnumify(sv));
+    else
+	PUSHs(sv);
+
+    XSRETURN(1);
+}

Added: packages/libversion-perl/branches/upstream/current/lib/version.pm
===================================================================
--- packages/libversion-perl/branches/upstream/current/lib/version.pm	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/lib/version.pm	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,35 @@
+#!perl -w
+package version;
+
+use 5.005_03;
+use strict;
+
+require Exporter;
+use vars qw(@ISA $VERSION $CLASS @EXPORT);
+
+ at ISA = qw(Exporter);
+
+ at EXPORT = qw(qv);
+
+$VERSION = "0.50"; 
+
+$CLASS = 'version';
+
+eval { require version::vxs; };
+
+if ( $@ ) # don't have the XS version installed
+{
+#    eval { require version::vpp }; # don't tempt fate
+    die "$@" if ( $@ );
+#    push @ISA, "version::PP";
+#    *qv = \&version::vpp::qv;
+}
+else # use XS module
+{
+    push @ISA, "version::vxs";
+    *qv = \&version::vxs::qv;
+}
+
+# Preloaded methods go here.
+
+1;

Added: packages/libversion-perl/branches/upstream/current/lib/version.pod
===================================================================
--- packages/libversion-perl/branches/upstream/current/lib/version.pod	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/lib/version.pod	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,583 @@
+=head1 NAME
+
+version - Perl extension for Version Objects
+
+=head1 SYNOPSIS
+
+  use version;
+  $version = version->new("12.2.1"); # must be quoted for Perl < 5.8.1
+  print $version; 		# v12.2.1
+  print $version->numify; 	# 12.002001
+  if ( $version gt "12.2" )	# true
+
+  $alphaver = version->new("1.02_03"); # must be quoted!
+  print $alphaver;		# 1.02_0300
+  print $alphaver->is_alpha();  # true
+  
+  $ver = qv("1.2.0");           # v1.2.0
+
+  $perlver = version->new(5.005_03); # must not be quoted!
+  print $perlver;		# 5.005030
+
+=head1 DESCRIPTION
+
+Overloaded version objects for all versions of Perl.  This module
+implements all of the features of version objects which will be part
+of Perl 5.10.0.
+
+=head2 BEST PRACTICES
+
+If you intend for your module to be used by different releases of Perl,
+and/or for your $VERSION scalar to mean what you think it means, there 
+are a few simple rules to follow:
+
+=over 4
+
+=item * Be consistent
+
+Whichever of the two types of version objects that you choose to employ, 
+you should stick to either L<Numeric Versions> or L<Extended Versions>
+and not mix them together.  While this is I<possible>, it is very 
+confusing to the average user.
+
+If you intend to use L<Extended Versions>, you are strongly encouraged 
+to use the L<qv()> operator with a quoted term, e.g.:
+
+  use version; our $VERSION = qv("1.2.3");
+
+on a single line as above. 
+
+At the very least, decide on which of the several ways to initialize 
+your version objects you prefer and stick with it.  It is also best to 
+be explicit about what value you intend to assign your version object 
+and to not rely on hidden behavior of the parser. 
+
+=item * Be careful
+
+If you are using Module::Build or ExtUtils::MakeMaker, so that you can
+release your module to CPAN, you have to recognize that none of those
+programs currently handles version objects natively (yet).  That also
+goes for the CPAN indexer (PAUSE).  Although there are modules on CPAN
+that employ the version module internally, the support for assigning a
+module $VERSION scalar is still lacking.  Both Module::Build and the 
+PAUSE indexer will [hopefully soon] include support for version 
+objects.
+
+=head2 What IS a version
+
+For the purposes of this module, a version "number" is a sequence of
+positive integer values separated by one or more decimal points and 
+optionally a single underscore.  This corresponds to what Perl itself 
+uses for a version, as well as extending the "version as number" that 
+is discussed in the various editions of the Camel book.
+
+There are actually two distinct kinds of version objects:
+
+=over 4
+
+=item * Numeric Versions
+
+Any initial parameter which "looks like a number", see L<Numeric
+Versions>.  This also covers versions with a single decimal point and
+a single embedded underscore, see L<Numeric Alpha Versions>, even though
+these must be quoted to preserve the underscore formatting.
+
+=item * Extended Versions
+
+Any initial parameter which contains more than one decimal point
+and an optional embedded underscore, see L<Extended Versions>.  This 
+is what is commonly used in most open source software as the "external"
+version (the one used as part of the tag or tarfile name).  The use
+of the exported L<qv()> function also produces this kind of version
+object.
+
+=back
+
+Both of these methods will produce similar version objects, in that
+the default stringification will yield the version L<Normal Form> only 
+if required:
+
+  $v  = version->new(1.002);     # 1.002, but compares like 1.2.0
+  $v  = version->new(1.002003);  # 1.002003
+  $v2 = version->new( "1.2.3");  # v1.2.3
+
+In specific, version numbers initialized as L<Numeric Versions> will
+stringify in Numeric form.  Version numbers initialized as L<Extended Versions>
+will be stringified as L<Normal Form>.
+
+=head2 Numeric Versions
+
+These correspond to historical versions of Perl itself prior to 5.6.0,
+as well as all other modules which follow the Camel rules for the
+$VERSION scalar.  A numeric version is initialized with what looks like
+a floating point number.  Leading zeros B<are> significant and trailing
+zeros are implied so that a minimum of three places is maintained
+between subversions.  What this means is that any subversion (digits
+to the right of the decimal place) that contains less than three digits
+will have trailing zeros added to make up the difference, but only for
+purposes of comparison with other version objects.  For example:
+
+                                   # Prints     Equivalent to  
+  $v = version->new(      1.2);    # 1.200      v1.200.0
+  $v = version->new(     1.02);    # 1.020      v1.20.0
+  $v = version->new(    1.002);    # 1.002      v1.2.0
+  $v = version->new(   1.0023);    # 1.002300   v1.2.300
+  $v = version->new(  1.00203);    # 1.002030   v1.2.30
+  $v = version->new( 1.002003);    # 1.002003   v1.2.3
+
+All of the preceding examples are true whether or not the input value is 
+quoted.  The important feature is that the input value contains only a 
+single decimal.  See also L<Alpha Versions> for how to handle 
+
+IMPORTANT NOTE: As shown above, if your numeric version contains more 
+than 3 significant digits after the decimal place, it will be split on 
+each multiple of 3, so 1.0003 is equivalent to v1.0.300, due to the need 
+to remain compatible with Perl's own 5.005_03 == 5.5.30 interpretation.  
+Any trailing zeros are ignored for mathematical comparison purposes.
+
+=head2 Extended Versions
+
+These are the newest form of versions, and correspond to Perl's own
+version style beginning with 5.6.0.  Starting with Perl 5.10.0,
+and most likely Perl 6, this is likely to be the preferred form.  This
+method normally requires that the input parameter be quoted, although 
+Perl's after 5.8.1 can use v-strings as a special form of quoting, but
+this is highly discouraged.
+
+Unlike L<Numeric Versions>, Extended Versions have more than
+a single decimal point, e.g.:
+
+                                   # Prints
+  $v = version->new( "v1.200");    # v1.200.0
+  $v = version->new("v1.20.0");    # v1.20.0
+  $v = qv("v1.2.3);                # v1.2.3
+  $v = qv("1.2.3");                # v1.2.3
+  $v = qv("1.20");                 # v1.20.0
+
+In general, Extended Versions permit the greatest amount of freedom
+to specify a version, whereas Numeric Versions enforce a certain
+uniformity.  See also L<New Operator> for an additional method of
+initializing version objects.
+
+Just like L<Numeric Versions>, Extended Versions can be used as 
+L<Alpha Versions>.
+
+=head2 Numeric Alpha Versions
+
+The one time that a numeric version must be quoted is when a alpha form is
+used with an otherwise numeric version (i.e. a single decimal point).  This
+is commonly used for CPAN releases, where CPAN or CPANPLUS will ignore alpha
+versions for automatic updating purposes.  Since some developers have used
+only two significant decimal places for their non-alpha releases, the
+version object will automatically take that into account if the initializer
+is quoted.  For example Module::Example was released to CPAN with the
+following sequence of $VERSION's:
+
+  # $VERSION    Stringified
+  0.01          0.010
+  0.02          0.020
+  0.02_01       0.02_0100
+  0.02_02       0.02_0200
+  0.03          0.030
+  etc.
+
+As you can see, the version object created from the values in the first
+column may contain a trailing 0, but will otherwise be both mathematically
+equivalent and sorts alpha-numerically as would be expected.
+
+=head2 Object Methods
+
+Overloading has been used with version objects to provide a natural
+interface for their use.  All mathematical operations are forbidden,
+since they don't make any sense for base version objects.
+
+=over 4
+
+=item * New Operator
+
+Like all OO interfaces, the new() operator is used to initialize
+version objects.  One way to increment versions when programming is to
+use the CVS variable $Revision, which is automatically incremented by
+CVS every time the file is committed to the repository.
+
+In order to facilitate this feature, the following
+code can be employed:
+
+  $VERSION = version->new(qw$Revision: 2.7 $);
+
+and the version object will be created as if the following code
+were used:
+
+  $VERSION = version->new("v2.7");
+
+In other words, the version will be automatically parsed out of the
+string, and it will be quoted to preserve the meaning CVS normally
+carries for versions.  The CVS $Revision$ increments differently from
+numeric versions (i.e. 1.10 follows 1.9), so it must be handled as if
+it were a L<Extended Version>.
+
+A new version object can be created as a copy of an existing version
+object, either as a class method:
+
+  $v1 = version->new(12.3);
+  $v2 = version->new($v1);
+
+or as an object method:
+
+  $v1 = version->new(12.3);
+  $v2 = $v1->new();
+
+and in each case, $v1 and $v2 will be identical.
+
+=back
+
+=over 4
+
+=item * qv()
+
+An alternate way to create a new version object is through the exported
+qv() sub.  This is not strictly like other q? operators (like qq, qw),
+in that the only delimiters supported are parentheses (or spaces).  It is
+the best way to initialize a short version without triggering the floating
+point interpretation.  For example:
+
+  $v1 = qv(1.2);         # 1.2.0
+  $v2 = qv("1.2");       # also 1.2.0
+
+As you can see, either a bare number or a quoted string can usually 
+be used interchangably, except in the case of a trailing zero, which
+must be quoted to be converted properly.  For this reason, it is strongly
+recommended that all initializers to qv() be quoted strings instead of
+bare numbers.
+
+=back
+
+For the subsequent examples, the following three objects will be used:
+
+  $ver   = version->new("1.2.3.4"); # see "Quoting" below
+  $alpha = version->new("1.2.3_4"); # see "Alpha versions" below
+  $nver  = version->new(1.002);     # see "Numeric Versions" above
+
+=over 4
+
+=item * Normal Form
+
+For any version object which is initialized with multiple decimal
+places (either quoted or if possible v-string), or initialized using
+the L<qv()> operator, the stringified representation is returned in
+a normalized or reduced form (no extraneous zeros), and with a leading 'v':
+
+  print $ver->normal;         # prints as v1.2.3.4
+  print $ver->stringify;      # ditto
+  print $ver;                 # ditto
+  print $nver->normal;        # prints as v1.2.0
+  print $nver->stringify;     # prints as 1.002, see "Stringification" 
+
+In order to preserve the meaning of the processed version, the 
+normalized representation will always contain at least three sub terms.
+In other words, the following is guaranteed to always be true:
+
+  my $newver = version->new($ver->stringify);
+  if ($newver eq $ver ) # always true
+    {...}
+
+=back
+
+=over 4
+
+=item * Numification
+
+Although all mathematical operations on version objects are forbidden
+by default, it is possible to retrieve a number which corresponds 
+to the version object through the use of the $obj->numify
+method.  For formatting purposes, when displaying a number which
+corresponds a version object, all sub versions are assumed to have
+three decimal places.  So for example:
+
+  print $ver->numify;         # prints 1.002003004
+  print $nver->numify;        # prints 1.002
+
+Unlike the stringification operator, there is never any need to append
+trailing zeros to preserve the correct version value.
+
+=back
+
+=over 4
+
+=item * Stringification
+
+In order to mirror as much as possible the existing behavior of ordinary
+$VERSION scalars, the stringification operation will display differently,
+depending on whether the version was initialized as a L<Numeric Version>
+or L<Extended Version>.
+
+What this means in practice is that if the normal CPAN and Camel rules are
+followed ($VERSION is a floating point number with no more than 3 decimal
+points), the stringified output will be exactly the same as the numified
+output.  There will be no visible difference, although the internal 
+representation will be different, and the L<Comparison operators> will 
+function using the internal coding.
+
+If a version object is initialized using a L<Extended Version> form, then
+the stringified form will be the L<Normal Form>.  The $obj->normal
+operation can always be used to produce the L<Normal Form>, even if the
+version was originally a L<Numeric Version>.
+
+  print $ver->stringify;    # prints v1.2.3.4
+  print $nver->stringify;   # prints 1.002
+
+=back
+
+=over 4
+
+=item * Comparison operators
+
+Both C<cmp> and C<E<lt>=E<gt>> operators perform the same comparison between
+terms (upgrading to a version object automatically).  Perl automatically
+generates all of the other comparison operators based on those two.
+In addition to the obvious equalities listed below, appending a single
+trailing 0 term does not change the value of a version for comparison
+purposes.  In other words "v1.2" and "1.2.0" will compare as identical.
+
+For example, the following relations hold:
+
+  As Number        As String           Truth Value
+  -------------    ----------------    -----------
+  $ver >  1.0      $ver gt "1.0"       true
+  $ver <  2.5      $ver lt             true
+  $ver != 1.3      $ver ne "1.3"       true
+  $ver == 1.2      $ver eq "1.2"       false
+  $ver == 1.2.3.4  $ver eq "1.2.3.4"   see discussion below
+
+It is probably best to chose either the numeric notation or the string
+notation and stick with it, to reduce confusion.  Perl6 version objects
+B<may> only support numeric comparisons.  See also L<Quoting>.
+
+WARNING: Comparing version with unequal numbers of decimal points (whether
+explicitly or implicitly initialized), may yield unexpected results at
+first glance.  For example, the following inequalities hold:
+
+  version->new(0.96)     > version->new(0.95); # 0.960.0 > 0.950.0
+  version->new("0.96.1") < version->new(0.95); # 0.096.1 < 0.950.0
+
+For this reason, it is best to use either exclusively L<Numeric Versions> or
+L<Extended Versions> with multiple decimal points.
+
+=back
+
+=over 4
+
+=item * Logical Operators 
+
+If you need to test whether a version object
+has been initialized, you can simply test it directly:
+
+  $vobj = version->new($something);
+  if ( $vobj )   # true only if $something was non-blank
+
+You can also test whether a version object is an L<Alpha version>, for
+example to prevent the use of some feature not present in the main
+release:
+
+  $vobj = version->new("1.2_3"); # MUST QUOTE
+  ...later...
+  if ( $vobj->is_alpha )       # True
+
+=back
+
+=head2 Quoting
+
+Because of the nature of the Perl parsing and tokenizing routines,
+certain initialization values B<must> be quoted in order to correctly
+parse as the intended version, especially when using the L<qv()> operator.
+In all cases, a floating point number passed to version->new() will be
+identically converted whether or not the value itself is quoted.  This is
+not true for L<qv()>, however, when trailing zeros would be stripped on
+an unquoted input, which would result in a very different version object.
+
+In addition, in order to be compatible with earlier Perl version styles,
+any use of versions of the form 5.006001 will be translated as v5.6.1.  
+In other words, a version with a single decimal point will be parsed as
+implicitly having three digits between subversions, but only for internal
+comparison purposes.
+
+The complicating factor is that in bare numbers (i.e. unquoted), the
+underscore is a legal numeric character and is automatically stripped
+by the Perl tokenizer before the version code is called.  However, if
+a number containing one or more decimals and an underscore is quoted, i.e.
+not bare, that is considered a L<Alpha Version> and the underscore is
+significant.
+
+If you use a mathematic formula that resolves to a floating point number,
+you are dependent on Perl's conversion routines to yield the version you
+expect.  You are pretty safe by dividing by a power of 10, for example,
+but other operations are not likely to be what you intend.  For example:
+
+  $VERSION = version->new((qw$Revision: 1.4)[1]/10);
+  print $VERSION;          # yields 0.14
+  $V2 = version->new(100/9); # Integer overflow in decimal number
+  print $V2;               # yields something like 11.111.111.100
+
+Perl 5.8.1 and beyond will be able to automatically quote v-strings but
+that is not possible in earlier versions of Perl.  In other words:
+
+  $version = version->new("v2.5.4");  # legal in all versions of Perl
+  $newvers = version->new(v2.5.4);    # legal only in Perl >= 5.8.1
+
+=head2 What about v-strings?
+
+Beginning with Perl 5.6.0, an alternate method to code arbitrary strings
+of bytes was introduced, called v-strings.  They were intended to be an
+easy way to enter, for example, Unicode strings (which contain two bytes
+per character).  Some programs have used them to encode printer control
+characters (e.g. CRLF).  They were also intended to be used for $VERSION,
+but their use as such has been problematic from the start.
+
+There are two ways to enter v-strings: a bare number with two or more
+decimal points, or a bare number with one or more decimal points and a 
+leading 'v' character (also bare).  For example:
+
+  $vs1 = 1.2.3; # encoded as \1\2\3
+  $vs2 = v1.2;  # encoded as \1\2 
+
+However, the use of v-strings to initialize version objects with this 
+module is only possible with Perl 5.8.1 or better (which contain special
+code to enable it).  Their use is B<strongly> discouraged in all 
+circumstances (especially the leading 'v' style), since the meaning will
+change depending on which Perl you are running.  It is better to directly 
+use L<"Extended Versions"> to ensure the proper interpretation.
+
+
+=head2 Types of Versions Objects
+
+There are two types of Version Objects:
+
+=over 4
+
+=item * Ordinary versions
+
+These are the versions that normal modules will use.  Can contain as
+many subversions as required.  In particular, those using RCS/CVS can
+use the following:
+
+  $VERSION = version->new(qw$Revision: 2.7 $);
+
+and the current RCS Revision for that file will be inserted
+automatically.  If the file has been moved to a branch, the Revision
+will have three or more elements; otherwise, it will have only two.
+This allows you to automatically increment your module version by
+using the Revision number from the primary file in a distribution, see
+L<ExtUtils::MakeMaker/"VERSION_FROM">.
+
+=item * Alpha Versions
+
+For module authors using CPAN, the convention has been to note
+unstable releases with an underscore in the version string, see
+L<CPAN>.  Alpha releases will test as being newer than the more recent
+stable release, and less than the next stable release.  For example:
+
+  $alphaver = version->new("12.03_01"); # must be quoted
+
+obeys the relationship
+
+  12.03 < $alphaver < 12.04
+
+Alpha versions with a single decimal point will be treated exactly as if
+they were L<Numeric Versions>, for parsing purposes.  The stringification for
+alpha versions with a single decimal point may seem surprising, since any
+trailing zeros will visible.  For example, the above $alphaver will print as
+
+  12.03_0100
+
+which is mathematically equivalent and ASCII sorts exactly the same as
+without the trailing zeros.
+
+Alpha versions with more than a single decimal point will be treated 
+exactly as if they were L<Extended Versions>, and will display without any
+trailing (or leading) zeros, in the L<Version Normal> form.  For example,
+
+  $newver = version->new("12.3.1_1");
+  print $newver; # v12.3.1_1
+
+=head2 Replacement UNIVERSAL::VERSION
+
+In addition to the version objects, this modules also replaces the core
+UNIVERSAL::VERSION function with one that uses version objects for its
+comparisons.  The return from this operator is always the numified form,
+and the warning message generated includes both the numified and normal
+forms (for clarity).
+
+For example:
+
+  package Foo;
+  $VERSION = 1.2;
+
+  package Bar;
+  $VERSION = "1.3.5"; # works with all Perl's (since it is quoted)
+
+  package main;
+  use version;
+
+  print $Foo::VERSION; # prints 1.2
+
+  print $Bar::VERSION; # prints 1.003005
+
+  eval "use CGI 10"; # some far future release
+  print $@; # prints "CGI version 10 (10.0.0) required..."
+
+IMPORTANT NOTE: This may mean that code which searches for a specific
+string (to determine whether a given module is available) may need to be
+changed.
+
+The replacement UNIVERSAL::VERSION, when used as a function, like this:
+
+  print $module->VERSION;
+
+will also exclusively return the numified form.  Technically, the 
+$module->VERSION function returns a string (PV) that can be converted to a 
+number following the normal Perl rules, when used in a numeric context.
+
+=head1 SUBCLASSING
+
+This module is specifically designed and tested to be easily subclassed.
+In practice, you only need to override the methods you want to change, but
+you have to take some care when overriding new() (since that is where all
+of the parsing takes place).  For example, this is a perfect acceptable
+derived class:
+
+  package myversion;
+  use base version;
+  sub new { 
+      my($self,$n)=@_;
+      my $obj;
+      # perform any special input handling here
+      $obj = $self->SUPER::new($n);
+      # and/or add additional hash elements here
+      return $obj;
+  }
+
+See also L<version::AlphaBeta> on CPAN for an alternate representation of
+version strings.
+
+B<NOTE:> the L<qv> operator is not a class method and will not be inherited
+in the same way as the other methods.  L<qv> will always return an object of
+type L<version> and not an object in the derived class.  If you need to
+have L<qv> return an object in your derived class, add something like this:
+
+  *::qv = sub { return bless version::qv(shift), __PACKAGE__ };
+
+as seen in the test file F<t/02derived.t>.
+
+=head1 EXPORT
+
+qv - Extended Version initialization operator
+
+=head1 AUTHOR
+
+John Peacock E<lt>jpeacock at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+L<perl>.
+
+=cut

Added: packages/libversion-perl/branches/upstream/current/t/01base.t
===================================================================
--- packages/libversion-perl/branches/upstream/current/t/01base.t	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/t/01base.t	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,16 @@
+#! /usr/local/perl -w
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+#########################
+
+use Test::More tests => 96;
+require "t/coretests.pm";
+
+diag "Tests with base class" unless $ENV{PERL_CORE};
+
+BEGIN {
+    use_ok("version", 0.49); # If we made it this far, we are ok.
+}
+
+BaseTests("version");

Added: packages/libversion-perl/branches/upstream/current/t/02derived.t
===================================================================
--- packages/libversion-perl/branches/upstream/current/t/02derived.t	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/t/02derived.t	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,51 @@
+#! /usr/local/perl -w
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+#########################
+
+use Test::More tests => 107;
+BEGIN {
+    use_ok("version", 0.49); # If we made it this far, we are ok.
+}
+require "t/coretests.pm";
+
+diag "Tests with empty derived class" unless $ENV{PERL_CORE};
+
+package version::Empty;
+use base version;
+$VERSION = 0.01;
+no warnings 'redefine';
+*::qv = sub { return bless version::qv(shift), __PACKAGE__; };
+
+package version::Bad;
+use base version;
+sub new { my($self,$n)=@_;  bless \$n, $self }
+
+package main;
+my $testobj = version::Empty->new(1.002_003);
+isa_ok( $testobj, "version::Empty" );
+ok( $testobj->numify == 1.002003, "Numified correctly" );
+ok( $testobj->stringify eq "1.002003", "Stringified correctly" );
+ok( $testobj->normal eq "v1.2.3", "Normalified correctly" );
+
+my $verobj = version->new("1.2.4");
+ok( $verobj > $testobj, "Comparison vs parent class" );
+ok( $verobj gt $testobj, "Comparison vs parent class" );
+BaseTests("version::Empty");
+
+diag "tests with bad subclass" unless $ENV{PERL_CORE};
+$testobj = version::Bad->new(1.002_003);
+isa_ok( $testobj, "version::Bad" );
+eval { my $string = $testobj->numify };
+like($@, qr/Invalid version object/,
+    "Bad subclass numify");
+eval { my $string = $testobj->normal };
+like($@, qr/Invalid version object/,
+    "Bad subclass normal");
+eval { my $string = $testobj->stringify };
+like($@, qr/Invalid version object/,
+    "Bad subclass stringify");
+eval { my $test = $testobj > 1.0 };
+like($@, qr/Invalid version object/,
+    "Bad subclass vcmp");

Added: packages/libversion-perl/branches/upstream/current/t/coretests.pm
===================================================================
--- packages/libversion-perl/branches/upstream/current/t/coretests.pm	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/t/coretests.pm	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,272 @@
+#! /usr/local/perl -w
+package main;
+
+sub BaseTests {
+
+	my $CLASS = shift;
+	
+	# Insert your test code below, the Test module is use()ed here so read
+	# its man page ( perldoc Test ) for help writing this test script.
+	
+	# Test bare number processing
+	diag "tests with bare numbers" unless $ENV{PERL_CORE};
+	$version = $CLASS->new(5.005_03);
+	is ( "$version" , "5.005030" , '5.005_03 eq 5.5.30' );
+	$version = $CLASS->new(1.23);
+	is ( "$version" , "1.230" , '1.23 eq "1.230"' );
+	
+	# Test quoted number processing
+	diag "tests with quoted numbers" unless $ENV{PERL_CORE};
+	$version = $CLASS->new("5.005_03");
+	is ( "$version" , "5.005_030" , '"5.005_03" eq "5.005_030"' );
+	$version = $CLASS->new("v1.23");
+	is ( "$version" , "v1.23.0" , '"v1.23" eq "v1.23.0"' );
+	
+	# Test stringify operator
+	diag "tests with stringify" unless $ENV{PERL_CORE};
+	$version = $CLASS->new("5.005");
+	is ( "$version" , "5.005" , '5.005 eq "5.005"' );
+	$version = $CLASS->new("5.006.001");
+	is ( "$version" , "v5.6.1" , '5.006.001 eq v5.6.1' );
+	$version = $CLASS->new("1.2.3_4");
+	is ( "$version" , "v1.2.3_4" , 'alpha version 1.2.3_4 eq v1.2.3_4' );
+	
+	# test illegal formats
+	diag "test illegal formats" unless $ENV{PERL_CORE};
+	eval {my $version = $CLASS->new("1.2_3_4")};
+	like($@, qr/multiple underscores/,
+	    "Invalid version format (multiple underscores)");
+	
+	eval {my $version = $CLASS->new("1.2_3.4")};
+	like($@, qr/underscores before decimal/,
+	    "Invalid version format (underscores before decimal)");
+	
+	$version = $CLASS->new("99 and 44/100 pure");
+	ok ("$version" eq "99.000", '$version eq "99.000"');
+	ok ($version->numify == 99.0, '$version->numify == 99.0');
+	ok ($version->normal eq "v99.0.0", '$version->normal eq v99.0.0');
+	
+	$version = $CLASS->new("something");
+	ok (defined $version, 'defined $version');
+	
+	# reset the test object to something reasonable
+	$version = $CLASS->new("1.2.3");
+	
+	# Test boolean operator
+	ok ($version, 'boolean');
+	
+	# Test class membership
+	isa_ok ( $version, $CLASS );
+	
+	# Test comparison operators with self
+	diag "tests with self" unless $ENV{PERL_CORE};
+	ok ( $version eq $version, '$version eq $version' );
+	is ( $version cmp $version, 0, '$version cmp $version == 0' );
+	ok ( $version == $version, '$version == $version' );
+	
+	# test first with non-object
+	$version = $CLASS->new("5.006.001");
+	$new_version = "5.8.0";
+	diag "tests with non-objects" unless $ENV{PERL_CORE};
+	ok ( $version ne $new_version, '$version ne $new_version' );
+	ok ( $version lt $new_version, '$version lt $new_version' );
+	ok ( $new_version gt $version, '$new_version gt $version' );
+	ok ( ref(\$new_version) eq 'SCALAR', 'no auto-upgrade');
+	$new_version = "$version";
+	ok ( $version eq $new_version, '$version eq $new_version' );
+	ok ( $new_version eq $version, '$new_version eq $version' );
+	
+	# now test with existing object
+	$new_version = $CLASS->new("5.8.0");
+	diag "tests with objects" unless $ENV{PERL_CORE};
+	ok ( $version ne $new_version, '$version ne $new_version' );
+	ok ( $version lt $new_version, '$version lt $new_version' );
+	ok ( $new_version gt $version, '$new_version gt $version' );
+	$new_version = $CLASS->new("$version");
+	ok ( $version eq $new_version, '$version eq $new_version' );
+	
+	# Test Numeric Comparison operators
+	# test first with non-object
+	$new_version = "5.8.0";
+	diag "numeric tests with non-objects" unless $ENV{PERL_CORE};
+	ok ( $version == $version, '$version == $version' );
+	ok ( $version < $new_version, '$version < $new_version' );
+	ok ( $new_version > $version, '$new_version > $version' );
+	ok ( $version != $new_version, '$version != $new_version' );
+	
+	# now test with existing object
+	$new_version = $CLASS->new($new_version);
+	diag "numeric tests with objects" unless $ENV{PERL_CORE};
+	ok ( $version < $new_version, '$version < $new_version' );
+	ok ( $new_version > $version, '$new_version > $version' );
+	ok ( $version != $new_version, '$version != $new_version' );
+	
+	# now test with actual numbers
+	diag "numeric tests with numbers" unless $ENV{PERL_CORE};
+	ok ( $version->numify() == 5.006001, '$version->numify() == 5.006001' );
+	ok ( $version->numify() <= 5.006001, '$version->numify() <= 5.006001' );
+	ok ( $version->numify() < 5.008, '$version->numify() < 5.008' );
+	#ok ( $version->numify() > v5.005_02, '$version->numify() > 5.005_02' );
+	
+	# test with long decimals
+	diag "Tests with extended decimal versions" unless $ENV{PERL_CORE};
+	$version = $CLASS->new(1.002003);
+	ok ( $version eq "1.2.3", '$version eq "1.2.3"');
+	ok ( $version->numify == 1.002003, '$version->numify == 1.002003');
+	$version = $CLASS->new("2002.09.30.1");
+	ok ( $version eq "2002.9.30.1",'$version eq 2002.9.30.1');
+	ok ( $version->numify == 2002.009030001,
+	    '$version->numify == 2002.009030001');
+	
+	# now test with alpha version form with string
+	$version = $CLASS->new("1.2.3");
+	$new_version = "1.2.3_4";
+	diag "tests with alpha-style non-objects" unless $ENV{PERL_CORE};
+	ok ( $version lt $new_version, '$version lt $new_version' );
+	ok ( $new_version gt $version, '$new_version gt $version' );
+	ok ( $version ne $new_version, '$version ne $new_version' );
+	
+	$version = $CLASS->new("1.2.4");
+	diag "numeric tests with alpha-style non-objects" unless $ENV{PERL_CORE};
+	ok ( $version > $new_version, '$version > $new_version' );
+	ok ( $new_version < $version, '$new_version < $version' );
+	ok ( $version != $new_version, '$version != $new_version' );
+	
+	# now test with alpha version form with object
+	$version = $CLASS->new("1.2.3");
+	$new_version = $CLASS->new("1.2.3_4");
+	diag "tests with alpha-style objects" unless $ENV{PERL_CORE};
+	ok ( $version < $new_version, '$version < $new_version' );
+	ok ( $new_version > $version, '$new_version > $version' );
+	ok ( $version != $new_version, '$version != $new_version' );
+	ok ( !$version->is_alpha, '!$version->is_alpha');
+	ok ( $new_version->is_alpha, '$new_version->is_alpha');
+	
+	$version = $CLASS->new("1.2.4");
+	diag "tests with alpha-style objects" unless $ENV{PERL_CORE};
+	ok ( $version > $new_version, '$version > $new_version' );
+	ok ( $new_version < $version, '$new_version < $version' );
+	ok ( $version != $new_version, '$version != $new_version' );
+	
+	$version = $CLASS->new("1.2.3.4");
+	$new_version = $CLASS->new("1.2.3_4");
+	diag "tests with alpha-style objects with same subversion" unless $ENV{PERL_CORE};
+	ok ( $version > $new_version, '$version > $new_version' );
+	ok ( $new_version < $version, '$new_version < $version' );
+	ok ( $version != $new_version, '$version != $new_version' );
+	
+	diag "test implicit [in]equality" unless $ENV{PERL_CORE};
+	$version = $CLASS->new("v1.2.3");
+	$new_version = $CLASS->new("1.2.3.0");
+	ok ( $version == $new_version, '$version == $new_version' );
+	$new_version = $CLASS->new("1.2.3_0");
+	ok ( $version == $new_version, '$version == $new_version' );
+	$new_version = $CLASS->new("1.2.3.1");
+	ok ( $version < $new_version, '$version < $new_version' );
+	$new_version = $CLASS->new("1.2.3_1");
+	ok ( $version < $new_version, '$version < $new_version' );
+	$new_version = $CLASS->new("1.1.999");
+	ok ( $version > $new_version, '$version > $new_version' );
+	
+	# that which is not expressly permitted is forbidden
+	diag "forbidden operations" unless $ENV{PERL_CORE};
+	ok ( !eval { ++$version }, "noop ++" );
+	ok ( !eval { --$version }, "noop --" );
+	ok ( !eval { $version/1 }, "noop /" );
+	ok ( !eval { $version*3 }, "noop *" );
+	ok ( !eval { abs($version) }, "noop abs" );
+
+	# test the qv() sub
+	diag "testing qv" unless $ENV{PERL_CORE};
+	$version = qv("1.2");
+	ok ( $version eq "1.2.0", 'qv("1.2") eq "1.2.0"' );
+	$version = qv(1.2);
+	ok ( $version eq "1.2.0", 'qv(1.2) eq "1.2.0"' );
+	isa_ok( qv('5.008'), $CLASS );
+
+	# test creation from existing version object
+	diag "create new from existing version" unless $ENV{PERL_CORE};
+	ok (eval {$new_version = $CLASS->new($version)},
+		"new from existing object");
+	ok ($new_version == $version, "class->new($version) identical");
+	$new_version = $version->new();
+	ok ($new_version == $version, "$version->new() also identical");
+	$new_version = $version->new("1.2.3");
+	is ($new_version, "v1.2.3" , '$version->new("1.2.3") works too');
+
+	# test the CVS revision mode
+	diag "testing CVS Revision" unless $ENV{PERL_CORE};
+	$version = new $CLASS qw$Revision: 1.2$;
+	ok ( $version eq "1.2.0", 'qw$Revision: 1.2$ eq 1.2.0' );
+	$version = new $CLASS qw$Revision: 1.2.3.4$;
+	ok ( $version eq "1.2.3.4", 'qw$Revision: 1.2.3.4$ eq 1.2.3.4' );
+	
+	# test the CPAN style reduced significant digit form
+	diag "testing CPAN-style versions" unless $ENV{PERL_CORE};
+	$version = $CLASS->new("1.23_01");
+	is ( "$version" , "1.23_0100", "CPAN-style alpha version" );
+	ok ( $version > 1.23, "1.23_01 > 1.23");
+	ok ( $version < 1.24, "1.23_01 < 1.24");
+
+	# test reformed UNIVERSAL::VERSION
+	diag "Replacement UNIVERSAL::VERSION tests" unless $ENV{PERL_CORE};
+	
+	# we know this file is here since we require it ourselves
+	$version = $Test::More::VERSION;
+	eval "use Test::More $version";
+	unlike($@, qr/Test::More version $version/,
+		'Replacement eval works with exact version');
+	
+	$version = $Test::More::VERSION+0.01; # this should fail even with old UNIVERSAL::VERSION
+	eval "use Test::More $version";
+	like($@, qr/Test::More version $version/,
+		'Replacement eval works with incremented version');
+	
+	$version =~ s/\.0$//; #convert to string and remove trailing '.0'
+	chop($version);	# shorten by 1 digit, should still succeed
+	eval "use Test::More $version";
+	unlike($@, qr/Test::More version $version/,
+		'Replacement eval works with single digit');
+	
+	$version += 0.1; # this would fail with old UNIVERSAL::VERSION
+	eval "use Test::More $version";
+	like($@, qr/Test::More version $version/,
+		'Replacement eval works with incremented digit');
+	
+SKIP: 	{
+	    skip 'Cannot test v-strings with Perl < 5.8.1', 4
+		    if $] < 5.008_001; 
+	    diag "Tests with v-strings" unless $ENV{PERL_CORE};
+	    $version = $CLASS->new(1.2.3);
+	    ok("$version" eq "v1.2.3", '"$version" eq 1.2.3');
+	    $version = $CLASS->new(1.0.0);
+	    $new_version = $CLASS->new(1);
+	    ok($version == $new_version, '$version == $new_version');
+	    ok($version eq $new_version, '$version eq $new_version');
+	    $version = qv(1.2.3);
+	    ok("$version" eq "v1.2.3", 'v-string initialized qv()');
+	}
+
+	diag "Tests with real-world (malformed) data" unless $ENV{PERL_CORE};
+
+	# trailing zero testing (reported by Andreas Koenig).
+	$version = $CLASS->new("1");
+	ok($version->numify eq "1.000", "trailing zeros preserved");
+	$version = $CLASS->new("1.0");
+	ok($version->numify eq "1.000", "trailing zeros preserved");
+	$version = $CLASS->new("1.0.0");
+	ok($version->numify eq "1.000000", "trailing zeros preserved");
+	$version = $CLASS->new("1.0.0.0");
+	ok($version->numify eq "1.000000000", "trailing zeros preserved");
+	
+	# leading zero testing (reported by Andreas Koenig).
+	$version = $CLASS->new(".7");
+	ok($version->numify eq "0.700", "leading zero inferred");
+
+	# leading space testing (reported by Andreas Koenig).
+	$version = $CLASS->new(" 1.7");
+	ok($version->numify eq "1.700", "leading space ignored");
+
+}
+
+1;

Added: packages/libversion-perl/branches/upstream/current/vutil/ppport.h
===================================================================
--- packages/libversion-perl/branches/upstream/current/vutil/ppport.h	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/vutil/ppport.h	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,1098 @@
+
+/* ppport.h -- Perl/Pollution/Portability Version 2.011_02 
+ *
+ * Automatically Created by Devel::PPPort on Tue Mar 23 21:50:21 2004 
+ *
+ * Do NOT edit this file directly! -- Edit PPPort.pm instead.
+ *
+ * Version 2.x, Copyright (C) 2001, Paul Marquess.
+ * Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
+ * This code may be used and distributed under the same license as any
+ * version of Perl.
+ * 
+ * This version of ppport.h is designed to support operation with Perl
+ * installations back to 5.004, and has been tested up to 5.8.1.
+ *
+ * If this version of ppport.h is failing during the compilation of this
+ * module, please check if a newer version of Devel::PPPort is available
+ * on CPAN before sending a bug report.
+ *
+ * If you are using the latest version of Devel::PPPort and it is failing
+ * during compilation of this module, please send a report to perlbug at perl.com
+ *
+ * Include all following information:
+ *
+ *  1. The complete output from running "perl -V"
+ *
+ *  2. This file.
+ *
+ *  3. The name & version of the module you were trying to build.
+ *
+ *  4. A full log of the build that failed.
+ *
+ *  5. Any other information that you think could be relevant.
+ *
+ *
+ * For the latest version of this code, please retreive the Devel::PPPort
+ * module from CPAN.
+ * 
+ */
+
+/*
+ * In order for a Perl extension module to be as portable as possible
+ * across differing versions of Perl itself, certain steps need to be taken.
+ * Including this header is the first major one, then using dTHR is all the
+ * appropriate places and using a PL_ prefix to refer to global Perl
+ * variables is the second.
+ *
+ */
+
+
+/* If you use one of a few functions that were not present in earlier
+ * versions of Perl, please add a define before the inclusion of ppport.h
+ * for a static include, or use the GLOBAL request in a single module to
+ * produce a global definition that can be referenced from the other
+ * modules.
+ * 
+ * Function:            Static define:           Extern define:
+ * newCONSTSUB()        NEED_newCONSTSUB         NEED_newCONSTSUB_GLOBAL
+ *
+ */
+ 
+
+/* To verify whether ppport.h is needed for your module, and whether any
+ * special defines should be used, ppport.h can be run through Perl to check
+ * your source code. Simply say:
+ * 
+ * 	perl -x ppport.h *.c *.h *.xs foo/bar*.c [etc]
+ * 
+ * The result will be a list of patches suggesting changes that should at
+ * least be acceptable, if not necessarily the most efficient solution, or a
+ * fix for all possible problems. It won't catch where dTHR is needed, and
+ * doesn't attempt to account for global macro or function definitions,
+ * nested includes, typemaps, etc.
+ * 
+ * In order to test for the need of dTHR, please try your module under a
+ * recent version of Perl that has threading compiled-in.
+ *
+ */ 
+
+
+/*
+#!/usr/bin/perl
+ at ARGV = ("*.xs") if !@ARGV;
+%badmacros = %funcs = %macros = (); $replace = 0;
+foreach (<DATA>) {
+	$funcs{$1} = 1 if /Provide:\s+(\S+)/;
+	$macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;
+	$replace = $1 if /Replace:\s+(\d+)/;
+	$badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;
+	$badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;
+}
+foreach $filename (map(glob($_), at ARGV)) {
+	unless (open(IN, "<$filename")) {
+		warn "Unable to read from $file: $!\n";
+		next;
+	}
+	print "Scanning $filename...\n";
+	$c = ""; while (<IN>) { $c .= $_; } close(IN);
+	$need_include = 0; %add_func = (); $changes = 0;
+	$has_include = ($c =~ /#.*include.*ppport/m);
+
+	foreach $func (keys %funcs) {
+		if ($c =~ /#.*define.*\bNEED_$func(_GLOBAL)?\b/m) {
+			if ($c !~ /\b$func\b/m) {
+				print "If $func isn't needed, you don't need to request it.\n" if
+				$changes += ($c =~ s/^.*#.*define.*\bNEED_$func\b.*\n//m);
+			} else {
+				print "Uses $func\n";
+				$need_include = 1;
+			}
+		} else {
+			if ($c =~ /\b$func\b/m) {
+				$add_func{$func} =1 ;
+				print "Uses $func\n";
+				$need_include = 1;
+			}
+		}
+	}
+
+	if (not $need_include) {
+		foreach $macro (keys %macros) {
+			if ($c =~ /\b$macro\b/m) {
+				print "Uses $macro\n";
+				$need_include = 1;
+			}
+		}
+	}
+
+	foreach $badmacro (keys %badmacros) {
+		if ($c =~ /\b$badmacro\b/m) {
+			$changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);
+			print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";
+			$need_include = 1;
+		}
+	}
+	
+	if (scalar(keys %add_func) or $need_include != $has_include) {
+		if (!$has_include) {
+			$inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
+			       "#include \"ppport.h\"\n";
+			$c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
+		} elsif (keys %add_func) {
+			$inc = join('',map("#define NEED_$_\n", sort keys %add_func));
+			$c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;
+		}
+		if (!$need_include) {
+			print "Doesn't seem to need ppport.h.\n";
+			$c =~ s/^.*#.*include.*ppport.*\n//m;
+		}
+		$changes++;
+	}
+	
+	if ($changes) {
+		open(OUT,"ppport.h.$$");
+		print OUT $c;
+		close(OUT);
+		open(DIFF, "diff -u $filename ppport.h.$$|");
+		while (<DIFF>) { s!ppport\.h\.$$!$filename.patched!; print STDOUT; }
+		close(DIFF);
+		unlink("ppport.h.$$");
+	} else {
+		print "Looks OK\n";
+	}
+}
+__DATA__
+*/
+
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
+#ifndef PERL_REVISION
+#   ifndef __PATCHLEVEL_H_INCLUDED__
+#       define PERL_PATCHLEVEL_H_IMPLICIT
+#       include <patchlevel.h>
+#   endif
+#   if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#       include <could_not_find_Perl_patchlevel.h>
+#   endif
+#   ifndef PERL_REVISION
+#	define PERL_REVISION	(5)
+        /* Replace: 1 */
+#       define PERL_VERSION	PATCHLEVEL
+#       define PERL_SUBVERSION	SUBVERSION
+        /* Replace PERL_PATCHLEVEL with PERL_VERSION */
+        /* Replace: 0 */
+#   endif
+#endif
+
+#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
+
+/* It is very unlikely that anyone will try to use this with Perl 6 
+   (or greater), but who knows.
+ */
+#if PERL_REVISION != 5
+#	error ppport.h only works with Perl version 5
+#endif /* PERL_REVISION != 5 */
+
+#ifndef ERRSV
+#	define ERRSV perl_get_sv("@",FALSE)
+#endif
+
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5))
+/* Replace: 1 */
+#	define PL_Sv		Sv
+#	define PL_compiling	compiling
+#	define PL_copline	copline
+#	define PL_curcop	curcop
+#	define PL_curstash	curstash
+#	define PL_defgv		defgv
+#	define PL_dirty		dirty
+#	define PL_dowarn	dowarn
+#	define PL_hints		hints
+#	define PL_na		na
+#	define PL_perldb	perldb
+#	define PL_rsfp_filters	rsfp_filters
+#	define PL_rsfpv		rsfp
+#	define PL_stdingv	stdingv
+#	define PL_sv_no		sv_no
+#	define PL_sv_undef	sv_undef
+#	define PL_sv_yes	sv_yes
+/* Replace: 0 */
+#endif
+
+#ifdef HASATTRIBUTE
+#  if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
+#    define PERL_UNUSED_DECL
+#  else
+#    define PERL_UNUSED_DECL __attribute__((unused))
+#  endif
+#else
+#  define PERL_UNUSED_DECL
+#endif
+
+#ifndef dNOOP
+#  define NOOP (void)0
+#  define dNOOP extern int Perl___notused PERL_UNUSED_DECL
+#endif
+
+#ifndef dTHR
+#  define dTHR          dNOOP
+#endif
+
+#ifndef dTHX
+#  define dTHX          dNOOP
+#  define dTHXa(x)      dNOOP
+#  define dTHXoa(x)     dNOOP
+#endif
+
+#ifndef pTHX
+#    define pTHX	void
+#    define pTHX_
+#    define aTHX
+#    define aTHX_
+#endif         
+
+#ifndef dAX
+#   define dAX I32 ax = MARK - PL_stack_base + 1
+#endif
+#ifndef dITEMS
+#   define dITEMS I32 items = SP - MARK
+#endif
+
+/* IV could also be a quad (say, a long long), but Perls
+ * capable of those should have IVSIZE already. */
+#if !defined(IVSIZE) && defined(LONGSIZE)
+#   define IVSIZE LONGSIZE
+#endif
+#ifndef IVSIZE
+#   define IVSIZE 4 /* A bold guess, but the best we can make. */
+#endif
+
+#ifndef UVSIZE
+#   define UVSIZE IVSIZE
+#endif
+
+#ifndef NVTYPE
+#   if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
+#       define NVTYPE long double
+#   else
+#       define NVTYPE double
+#   endif
+typedef NVTYPE NV;
+#endif
+
+#ifndef INT2PTR
+
+#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#  define PTRV                  UV
+#  define INT2PTR(any,d)        (any)(d)
+#else
+#  if PTRSIZE == LONGSIZE
+#    define PTRV                unsigned long
+#  else
+#    define PTRV                unsigned
+#  endif
+#  define INT2PTR(any,d)        (any)(PTRV)(d)
+#endif
+#define NUM2PTR(any,d)  (any)(PTRV)(d)
+#define PTR2IV(p)       INT2PTR(IV,p)
+#define PTR2UV(p)       INT2PTR(UV,p)
+#define PTR2NV(p)       NUM2PTR(NV,p)
+#if PTRSIZE == LONGSIZE
+#  define PTR2ul(p)     (unsigned long)(p)
+#else
+#  define PTR2ul(p)     INT2PTR(unsigned long,p)        
+#endif
+
+#endif /* !INT2PTR */
+
+#ifndef boolSV
+#	define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
+#endif
+
+#ifndef gv_stashpvn
+#	define gv_stashpvn(str,len,flags) gv_stashpv(str,flags)
+#endif
+
+#ifndef newSVpvn
+#	define newSVpvn(data,len) ((len) ? newSVpv ((data), (len)) : newSVpv ("", 0))
+#endif
+
+#ifndef newRV_inc
+/* Replace: 1 */
+#	define newRV_inc(sv) newRV(sv)
+/* Replace: 0 */
+#endif
+
+/* DEFSV appears first in 5.004_56 */
+#ifndef DEFSV
+#  define DEFSV	GvSV(PL_defgv)
+#endif
+
+#ifndef SAVE_DEFSV
+#    define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
+#endif
+
+#ifndef newRV_noinc
+#  ifdef __GNUC__
+#    define newRV_noinc(sv)               \
+      ({                                  \
+          SV *nsv = (SV*)newRV(sv);       \
+          SvREFCNT_dec(sv);               \
+          nsv;                            \
+      })
+#  else
+#    if defined(USE_THREADS)
+static SV * newRV_noinc (SV * sv)
+{
+          SV *nsv = (SV*)newRV(sv);       
+          SvREFCNT_dec(sv);               
+          return nsv;                     
+}
+#    else
+#      define newRV_noinc(sv)    \
+        (PL_Sv=(SV*)newRV(sv), SvREFCNT_dec(sv), (SV*)PL_Sv)
+#    endif
+#  endif
+#endif
+
+/* Provide: newCONSTSUB */
+
+/* newCONSTSUB from IO.xs is in the core starting with 5.004_63 */
+#if (PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION < 63))
+
+#if defined(NEED_newCONSTSUB)
+static
+#else
+extern void newCONSTSUB(HV * stash, char * name, SV *sv);
+#endif
+
+#if defined(NEED_newCONSTSUB) || defined(NEED_newCONSTSUB_GLOBAL)
+void
+newCONSTSUB(stash,name,sv)
+HV *stash;
+char *name;
+SV *sv;
+{
+	U32 oldhints = PL_hints;
+	HV *old_cop_stash = PL_curcop->cop_stash;
+	HV *old_curstash = PL_curstash;
+	line_t oldline = PL_curcop->cop_line;
+	PL_curcop->cop_line = PL_copline;
+
+	PL_hints &= ~HINT_BLOCK_SCOPE;
+	if (stash)
+		PL_curstash = PL_curcop->cop_stash = stash;
+
+	newSUB(
+
+#if (PERL_VERSION < 3) || ((PERL_VERSION == 3) && (PERL_SUBVERSION < 22))
+     /* before 5.003_22 */
+		start_subparse(),
+#else
+#  if (PERL_VERSION == 3) && (PERL_SUBVERSION == 22)
+     /* 5.003_22 */
+     		start_subparse(0),
+#  else
+     /* 5.003_23  onwards */
+     		start_subparse(FALSE, 0),
+#  endif
+#endif
+
+		newSVOP(OP_CONST, 0, newSVpv(name,0)),
+		newSVOP(OP_CONST, 0, &PL_sv_no),   /* SvPV(&PL_sv_no) == "" -- GMB */
+		newSTATEOP(0, Nullch, newSVOP(OP_CONST, 0, sv))
+	);
+
+	PL_hints = oldhints;
+	PL_curcop->cop_stash = old_cop_stash;
+	PL_curstash = old_curstash;
+	PL_curcop->cop_line = oldline;
+}
+#endif
+
+#endif /* newCONSTSUB */
+
+#ifndef START_MY_CXT
+
+/*
+ * Boilerplate macros for initializing and accessing interpreter-local
+ * data from C.  All statics in extensions should be reworked to use
+ * this, if you want to make the extension thread-safe.  See ext/re/re.xs
+ * for an example of the use of these macros.
+ *
+ * Code that uses these macros is responsible for the following:
+ * 1. #define MY_CXT_KEY to a unique string, e.g. "DynaLoader_guts"
+ * 2. Declare a typedef named my_cxt_t that is a structure that contains
+ *    all the data that needs to be interpreter-local.
+ * 3. Use the START_MY_CXT macro after the declaration of my_cxt_t.
+ * 4. Use the MY_CXT_INIT macro such that it is called exactly once
+ *    (typically put in the BOOT: section).
+ * 5. Use the members of the my_cxt_t structure everywhere as
+ *    MY_CXT.member.
+ * 6. Use the dMY_CXT macro (a declaration) in all the functions that
+ *    access MY_CXT.
+ */
+
+#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || \
+    defined(PERL_CAPI)    || defined(PERL_IMPLICIT_CONTEXT)
+
+/* This must appear in all extensions that define a my_cxt_t structure,
+ * right after the definition (i.e. at file scope).  The non-threads
+ * case below uses it to declare the data as static. */
+#define START_MY_CXT
+
+#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
+/* Fetches the SV that keeps the per-interpreter data. */
+#define dMY_CXT_SV \
+	SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)
+#else /* >= perl5.004_68 */
+#define dMY_CXT_SV \
+	SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY,		\
+				  sizeof(MY_CXT_KEY)-1, TRUE)
+#endif /* < perl5.004_68 */
+
+/* This declaration should be used within all functions that use the
+ * interpreter-local data. */
+#define dMY_CXT	\
+	dMY_CXT_SV;							\
+	my_cxt_t *my_cxtp = INT2PTR(my_cxt_t*,SvUV(my_cxt_sv))
+
+/* Creates and zeroes the per-interpreter data.
+ * (We allocate my_cxtp in a Perl SV so that it will be released when
+ * the interpreter goes away.) */
+#define MY_CXT_INIT \
+	dMY_CXT_SV;							\
+	/* newSV() allocates one more than needed */			\
+	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
+	Zero(my_cxtp, 1, my_cxt_t);					\
+	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+
+/* This macro must be used to access members of the my_cxt_t structure.
+ * e.g. MYCXT.some_data */
+#define MY_CXT		(*my_cxtp)
+
+/* Judicious use of these macros can reduce the number of times dMY_CXT
+ * is used.  Use is similar to pTHX, aTHX etc. */
+#define pMY_CXT		my_cxt_t *my_cxtp
+#define pMY_CXT_	pMY_CXT,
+#define _pMY_CXT	,pMY_CXT
+#define aMY_CXT		my_cxtp
+#define aMY_CXT_	aMY_CXT,
+#define _aMY_CXT	,aMY_CXT
+
+#else /* single interpreter */
+
+#define START_MY_CXT	static my_cxt_t my_cxt;
+#define dMY_CXT_SV	dNOOP
+#define dMY_CXT		dNOOP
+#define MY_CXT_INIT	NOOP
+#define MY_CXT		my_cxt
+
+#define pMY_CXT		void
+#define pMY_CXT_
+#define _pMY_CXT
+#define aMY_CXT
+#define aMY_CXT_
+#define _aMY_CXT
+
+#endif 
+
+#endif /* START_MY_CXT */
+
+#ifndef IVdf
+#  if IVSIZE == LONGSIZE
+#       define	IVdf		"ld"
+#       define	UVuf		"lu"
+#       define	UVof		"lo"
+#       define	UVxf		"lx"
+#       define	UVXf		"lX"
+#   else
+#       if IVSIZE == INTSIZE
+#           define	IVdf	"d"
+#           define	UVuf	"u"
+#           define	UVof	"o"
+#           define	UVxf	"x"
+#           define	UVXf	"X"
+#       endif
+#   endif
+#endif
+
+#ifndef NVef
+#   if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
+	defined(PERL_PRIfldbl) /* Not very likely, but let's try anyway. */ 
+#       define NVef		PERL_PRIeldbl
+#       define NVff		PERL_PRIfldbl
+#       define NVgf		PERL_PRIgldbl
+#   else
+#       define NVef		"e"
+#       define NVff		"f"
+#       define NVgf		"g"
+#   endif
+#endif
+
+#ifndef AvFILLp			/* Older perls (<=5.003) lack AvFILLp */
+#   define AvFILLp AvFILL
+#endif
+
+#ifdef SvPVbyte
+#   if PERL_REVISION == 5 && PERL_VERSION < 7
+       /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */
+#       undef SvPVbyte
+#       define SvPVbyte(sv, lp) \
+          ((SvFLAGS(sv) & (SVf_POK|SVf_UTF8)) == (SVf_POK) \
+           ? ((lp = SvCUR(sv)), SvPVX(sv)) : my_sv_2pvbyte(aTHX_ sv, &lp))
+       static char *
+       my_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp)
+       {   
+           sv_utf8_downgrade(sv,0);
+           return SvPV(sv,*lp);
+       }
+#   endif
+#else
+#   define SvPVbyte SvPV
+#endif
+
+#ifndef SvPV_nolen
+#   define SvPV_nolen(sv) \
+        ((SvFLAGS(sv) & (SVf_POK)) == SVf_POK \
+         ? SvPVX(sv) : sv_2pv_nolen(sv))
+    static char *
+    sv_2pv_nolen(pTHX_ register SV *sv)
+    {   
+        STRLEN n_a;
+        return sv_2pv(sv, &n_a);
+    }
+#endif
+
+#ifndef get_cv
+#   define get_cv(name,create) perl_get_cv(name,create)
+#endif
+
+#ifndef get_sv
+#   define get_sv(name,create) perl_get_sv(name,create)
+#endif
+
+#ifndef get_av
+#   define get_av(name,create) perl_get_av(name,create)
+#endif
+
+#ifndef get_hv
+#   define get_hv(name,create) perl_get_hv(name,create)
+#endif
+
+#ifndef call_argv
+#   define call_argv perl_call_argv
+#endif
+
+#ifndef call_method
+#   define call_method perl_call_method
+#endif
+
+#ifndef call_pv
+#   define call_pv perl_call_pv
+#endif
+
+#ifndef call_sv
+#   define call_sv perl_call_sv
+#endif
+
+#ifndef eval_pv
+#   define eval_pv perl_eval_pv
+#endif
+
+#ifndef eval_sv
+#   define eval_sv perl_eval_sv
+#endif
+
+#ifndef PERL_SCAN_GREATER_THAN_UV_MAX
+#   define PERL_SCAN_GREATER_THAN_UV_MAX 0x02
+#endif
+
+#ifndef PERL_SCAN_SILENT_ILLDIGIT
+#   define PERL_SCAN_SILENT_ILLDIGIT 0x04
+#endif
+
+#ifndef PERL_SCAN_ALLOW_UNDERSCORES
+#   define PERL_SCAN_ALLOW_UNDERSCORES 0x01
+#endif
+
+#ifndef PERL_SCAN_DISALLOW_PREFIX
+#   define PERL_SCAN_DISALLOW_PREFIX 0x02
+#endif
+
+#if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1))
+#define I32_CAST
+#else
+#define I32_CAST (I32*)
+#endif
+
+#ifndef grok_hex
+static UV _grok_hex (pTHX_ char *string, STRLEN *len, I32 *flags, NV *result) {
+    NV r = scan_hex(string, *len, I32_CAST len);
+    if (r > UV_MAX) {
+        *flags |= PERL_SCAN_GREATER_THAN_UV_MAX;
+        if (result) *result = r;
+        return UV_MAX;
+    }
+    return (UV)r;
+}
+        
+#   define grok_hex(string, len, flags, result)     \
+        _grok_hex(pTHX_ (string), (len), (flags), (result))
+#endif 
+
+#ifndef grok_oct
+static UV _grok_oct (pTHX_ char *string, STRLEN *len, I32 *flags, NV *result) {
+    NV r = scan_oct(string, *len, I32_CAST len);
+    if (r > UV_MAX) {
+        *flags |= PERL_SCAN_GREATER_THAN_UV_MAX;
+        if (result) *result = r;
+        return UV_MAX;
+    }
+    return (UV)r;
+}
+
+#   define grok_oct(string, len, flags, result)     \
+        _grok_oct(pTHX_ (string), (len), (flags), (result))
+#endif
+
+#if !defined(grok_bin) && defined(scan_bin)
+static UV _grok_bin (pTHX_ char *string, STRLEN *len, I32 *flags, NV *result) {
+    NV r = scan_bin(string, *len, I32_CAST len);
+    if (r > UV_MAX) {
+        *flags |= PERL_SCAN_GREATER_THAN_UV_MAX;
+        if (result) *result = r;
+        return UV_MAX;
+    }
+    return (UV)r;
+}
+
+#   define grok_bin(string, len, flags, result)     \
+        _grok_bin(pTHX_ (string), (len), (flags), (result))
+#endif
+
+#ifndef IN_LOCALE
+#   define IN_LOCALE \
+	(PL_curcop == &PL_compiling ? IN_LOCALE_COMPILETIME : IN_LOCALE_RUNTIME)
+#endif
+
+#ifndef IN_LOCALE_RUNTIME
+#   define IN_LOCALE_RUNTIME   (PL_curcop->op_private & HINT_LOCALE)
+#endif
+
+#ifndef IN_LOCALE_COMPILETIME
+#   define IN_LOCALE_COMPILETIME   (PL_hints & HINT_LOCALE)
+#endif
+
+
+#ifndef IS_NUMBER_IN_UV
+#   define IS_NUMBER_IN_UV		            0x01   
+#   define IS_NUMBER_GREATER_THAN_UV_MAX    0x02
+#   define IS_NUMBER_NOT_INT	            0x04
+#   define IS_NUMBER_NEG		            0x08
+#   define IS_NUMBER_INFINITY	            0x10 
+#   define IS_NUMBER_NAN                    0x20  
+#endif
+   
+#ifndef grok_numeric_radix
+#   define GROK_NUMERIC_RADIX(sp, send) grok_numeric_radix(aTHX_ sp, send)
+
+#define grok_numeric_radix Perl_grok_numeric_radix
+    
+static
+bool
+Perl_grok_numeric_radix(pTHX_ const char **sp, const char *send)
+{
+#ifdef USE_LOCALE_NUMERIC
+#if (PERL_VERSION > 6) || ((PERL_VERSION == 6) && (PERL_SUBVERSION >= 1))
+    if (PL_numeric_radix_sv && IN_LOCALE) { 
+        STRLEN len;
+        char* radix = SvPV(PL_numeric_radix_sv, len);
+        if (*sp + len <= send && memEQ(*sp, radix, len)) {
+            *sp += len;
+            return TRUE; 
+        }
+    }
+#else
+    /* pre5.6.0 perls don't have PL_numeric_radix_sv so the radix
+     * must manually be requested from locale.h */
+#include <locale.h>
+    struct lconv *lc = localeconv();
+    char *radix = lc->decimal_point;
+    if (radix && IN_LOCALE) { 
+        STRLEN len = strlen(radix);
+        if (*sp + len <= send && memEQ(*sp, radix, len)) {
+            *sp += len;
+            return TRUE; 
+        }
+    }
+#endif /* PERL_VERSION */
+#endif /* USE_LOCALE_NUMERIC */
+    /* always try "." if numeric radix didn't match because
+     * we may have data from different locales mixed */
+    if (*sp < send && **sp == '.') {
+        ++*sp;
+        return TRUE;
+    }
+    return FALSE;
+}
+#endif /* grok_numeric_radix */
+
+#ifndef grok_number
+
+#define grok_number Perl_grok_number
+
+static
+int
+Perl_grok_number(pTHX_ const char *pv, STRLEN len, UV *valuep)
+{
+  const char *s = pv;
+  const char *send = pv + len;
+  const UV max_div_10 = UV_MAX / 10;
+  const char max_mod_10 = UV_MAX % 10;
+  int numtype = 0;
+  int sawinf = 0;
+  int sawnan = 0;
+
+  while (s < send && isSPACE(*s))
+    s++;
+  if (s == send) {
+    return 0;
+  } else if (*s == '-') {
+    s++;
+    numtype = IS_NUMBER_NEG;
+  }
+  else if (*s == '+')
+  s++;
+
+  if (s == send)
+    return 0;
+
+  /* next must be digit or the radix separator or beginning of infinity */
+  if (isDIGIT(*s)) {
+    /* UVs are at least 32 bits, so the first 9 decimal digits cannot
+       overflow.  */
+    UV value = *s - '0';
+    /* This construction seems to be more optimiser friendly.
+       (without it gcc does the isDIGIT test and the *s - '0' separately)
+       With it gcc on arm is managing 6 instructions (6 cycles) per digit.
+       In theory the optimiser could deduce how far to unroll the loop
+       before checking for overflow.  */
+    if (++s < send) {
+      int digit = *s - '0';
+      if (digit >= 0 && digit <= 9) {
+        value = value * 10 + digit;
+        if (++s < send) {
+          digit = *s - '0';
+          if (digit >= 0 && digit <= 9) {
+            value = value * 10 + digit;
+            if (++s < send) {
+              digit = *s - '0';
+              if (digit >= 0 && digit <= 9) {
+                value = value * 10 + digit;
+		        if (++s < send) {
+                  digit = *s - '0';
+                  if (digit >= 0 && digit <= 9) {
+                    value = value * 10 + digit;
+                    if (++s < send) {
+                      digit = *s - '0';
+                      if (digit >= 0 && digit <= 9) {
+                        value = value * 10 + digit;
+                        if (++s < send) {
+                          digit = *s - '0';
+                          if (digit >= 0 && digit <= 9) {
+                            value = value * 10 + digit;
+                            if (++s < send) {
+                              digit = *s - '0';
+                              if (digit >= 0 && digit <= 9) {
+                                value = value * 10 + digit;
+                                if (++s < send) {
+                                  digit = *s - '0';
+                                  if (digit >= 0 && digit <= 9) {
+                                    value = value * 10 + digit;
+                                    if (++s < send) {
+                                      /* Now got 9 digits, so need to check
+                                         each time for overflow.  */
+                                      digit = *s - '0';
+                                      while (digit >= 0 && digit <= 9
+                                             && (value < max_div_10
+                                                 || (value == max_div_10
+                                                     && digit <= max_mod_10))) {
+                                        value = value * 10 + digit;
+                                        if (++s < send)
+                                          digit = *s - '0';
+                                        else
+                                          break;
+                                      }
+                                      if (digit >= 0 && digit <= 9
+                                          && (s < send)) {
+                                        /* value overflowed.
+                                           skip the remaining digits, don't
+                                           worry about setting *valuep.  */
+                                        do {
+                                          s++;
+                                        } while (s < send && isDIGIT(*s));
+                                        numtype |=
+                                          IS_NUMBER_GREATER_THAN_UV_MAX;
+                                        goto skip_value;
+                                      }
+                                    }
+                                  }
+				                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+	    }
+      }
+    }
+    numtype |= IS_NUMBER_IN_UV;
+    if (valuep)
+      *valuep = value;
+
+  skip_value:
+    if (GROK_NUMERIC_RADIX(&s, send)) {
+      numtype |= IS_NUMBER_NOT_INT;
+      while (s < send && isDIGIT(*s))  /* optional digits after the radix */
+        s++;
+    }
+  }
+  else if (GROK_NUMERIC_RADIX(&s, send)) {
+    numtype |= IS_NUMBER_NOT_INT | IS_NUMBER_IN_UV; /* valuep assigned below */
+    /* no digits before the radix means we need digits after it */
+    if (s < send && isDIGIT(*s)) {
+      do {
+        s++;
+      } while (s < send && isDIGIT(*s));
+      if (valuep) {
+        /* integer approximation is valid - it's 0.  */
+        *valuep = 0;
+      }
+    }
+    else
+      return 0;
+  } else if (*s == 'I' || *s == 'i') {
+    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
+    s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
+    s++; if (s < send && (*s == 'I' || *s == 'i')) {
+      s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
+      s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
+      s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
+      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
+      s++;
+    }
+    sawinf = 1;
+  } else if (*s == 'N' || *s == 'n') {
+    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
+    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
+    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
+    s++;
+    sawnan = 1;
+  } else
+    return 0;
+
+  if (sawinf) {
+    numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
+    numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;
+  } else if (sawnan) {
+    numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
+    numtype |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
+  } else if (s < send) {
+    /* we can have an optional exponent part */
+    if (*s == 'e' || *s == 'E') {
+      /* The only flag we keep is sign.  Blow away any "it's UV"  */
+      numtype &= IS_NUMBER_NEG;
+      numtype |= IS_NUMBER_NOT_INT;
+      s++;
+      if (s < send && (*s == '-' || *s == '+'))
+        s++;
+      if (s < send && isDIGIT(*s)) {
+        do {
+          s++;
+        } while (s < send && isDIGIT(*s));
+      }
+      else
+      return 0;
+    }
+  }
+  while (s < send && isSPACE(*s))
+    s++;
+  if (s >= send)
+    return numtype;
+  if (len == 10 && memEQ(pv, "0 but true", 10)) {
+    if (valuep)
+      *valuep = 0;
+    return IS_NUMBER_IN_UV;
+  }
+  return 0;
+}
+#endif /* grok_number */
+
+#ifndef PERL_MAGIC_sv
+#   define PERL_MAGIC_sv             '\0'
+#endif
+
+#ifndef PERL_MAGIC_overload
+#   define PERL_MAGIC_overload       'A'
+#endif
+
+#ifndef PERL_MAGIC_overload_elem
+#   define PERL_MAGIC_overload_elem  'a'
+#endif
+
+#ifndef PERL_MAGIC_overload_table
+#   define PERL_MAGIC_overload_table 'c'
+#endif
+
+#ifndef PERL_MAGIC_bm
+#   define PERL_MAGIC_bm             'B'
+#endif
+
+#ifndef PERL_MAGIC_regdata
+#   define PERL_MAGIC_regdata        'D'
+#endif
+
+#ifndef PERL_MAGIC_regdatum
+#   define PERL_MAGIC_regdatum       'd'
+#endif
+
+#ifndef PERL_MAGIC_env
+#   define PERL_MAGIC_env            'E'
+#endif
+
+#ifndef PERL_MAGIC_envelem
+#   define PERL_MAGIC_envelem        'e'
+#endif
+
+#ifndef PERL_MAGIC_fm
+#   define PERL_MAGIC_fm             'f'
+#endif
+
+#ifndef PERL_MAGIC_regex_global
+#   define PERL_MAGIC_regex_global   'g'
+#endif
+
+#ifndef PERL_MAGIC_isa
+#   define PERL_MAGIC_isa            'I'
+#endif
+
+#ifndef PERL_MAGIC_isaelem
+#   define PERL_MAGIC_isaelem        'i'
+#endif
+
+#ifndef PERL_MAGIC_nkeys
+#   define PERL_MAGIC_nkeys          'k'
+#endif
+
+#ifndef PERL_MAGIC_dbfile
+#   define PERL_MAGIC_dbfile         'L'
+#endif
+
+#ifndef PERL_MAGIC_dbline
+#   define PERL_MAGIC_dbline         'l'
+#endif
+
+#ifndef PERL_MAGIC_mutex
+#   define PERL_MAGIC_mutex          'm'
+#endif
+
+#ifndef PERL_MAGIC_shared
+#   define PERL_MAGIC_shared         'N'
+#endif
+
+#ifndef PERL_MAGIC_shared_scalar
+#   define PERL_MAGIC_shared_scalar  'n'
+#endif
+
+#ifndef PERL_MAGIC_collxfrm
+#   define PERL_MAGIC_collxfrm       'o'
+#endif
+
+#ifndef PERL_MAGIC_tied
+#   define PERL_MAGIC_tied           'P'
+#endif
+
+#ifndef PERL_MAGIC_tiedelem
+#   define PERL_MAGIC_tiedelem       'p'
+#endif
+
+#ifndef PERL_MAGIC_tiedscalar
+#   define PERL_MAGIC_tiedscalar     'q'
+#endif
+
+#ifndef PERL_MAGIC_qr
+#   define PERL_MAGIC_qr             'r'
+#endif
+
+#ifndef PERL_MAGIC_sig
+#   define PERL_MAGIC_sig            'S'
+#endif
+
+#ifndef PERL_MAGIC_sigelem
+#   define PERL_MAGIC_sigelem        's'
+#endif
+
+#ifndef PERL_MAGIC_taint
+#   define PERL_MAGIC_taint          't'
+#endif
+
+#ifndef PERL_MAGIC_uvar
+#   define PERL_MAGIC_uvar           'U'
+#endif
+
+#ifndef PERL_MAGIC_uvar_elem
+#   define PERL_MAGIC_uvar_elem      'u'
+#endif
+
+#ifndef PERL_MAGIC_vstring
+#   define PERL_MAGIC_vstring        'V'
+#endif
+
+#ifndef PERL_MAGIC_vec
+#   define PERL_MAGIC_vec            'v'
+#endif
+
+#ifndef PERL_MAGIC_utf8
+#   define PERL_MAGIC_utf8           'w'
+#endif
+
+#ifndef PERL_MAGIC_substr
+#   define PERL_MAGIC_substr         'x'
+#endif
+
+#ifndef PERL_MAGIC_defelem
+#   define PERL_MAGIC_defelem        'y'
+#endif
+
+#ifndef PERL_MAGIC_glob
+#   define PERL_MAGIC_glob           '*'
+#endif
+
+#ifndef PERL_MAGIC_arylen
+#   define PERL_MAGIC_arylen         '#'
+#endif
+
+#ifndef PERL_MAGIC_pos
+#   define PERL_MAGIC_pos            '.'
+#endif
+
+#ifndef PERL_MAGIC_backref
+#   define PERL_MAGIC_backref        '<'
+#endif
+
+#ifndef PERL_MAGIC_ext
+#   define PERL_MAGIC_ext            '~'
+#endif
+
+#endif /* _P_P_PORTABILITY_H_ */
+
+/* End of File ppport.h */

Added: packages/libversion-perl/branches/upstream/current/vutil/vutil.c
===================================================================
--- packages/libversion-perl/branches/upstream/current/vutil/vutil.c	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/vutil/vutil.c	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,591 @@
+#include "vutil.h"
+
+/*
+=for apidoc scan_version
+
+Returns a pointer to the next character after the parsed
+version string, as well as upgrading the passed in SV to
+an RV.
+
+Function must be called with an already existing SV like
+
+    sv = newSV(0);
+    s = scan_version(s,SV *sv, bool qv);
+
+Performs some preprocessing to the string to ensure that
+it has the correct characteristics of a version.  Flags the
+object if it contains an underscore (which denotes this
+is a alpha version).  The boolean qv denotes that the version
+should be interpreted as if it had multiple decimals, even if
+it doesn't.
+
+=cut
+*/
+
+const char *
+Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv)
+{
+    const char *start;
+    const char *pos;
+    const char *last;
+    int saw_period = 0;
+    int alpha = 0;
+    int width = 3;
+    AV *av = newAV();
+    SV *hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
+    (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */
+#if 0
+    /* upgrade the RV and tie it to the hash (the hard way) */
+    HV *hv = newHV();
+    (void)sv_upgrade(rv, SVt_RV);
+    SvRV(rv) = (SV *)hv;
+    SvROK_on(rv);
+    (void)sv_bless(rv, gv_stashpv("version", TRUE)); 
+#endif
+
+#ifndef NODEFAULT_SHAREKEYS
+    HvSHAREKEYS_on(hv);         /* key-sharing on by default */
+#endif
+
+    while (isSPACE(*s)) /* leading whitespace is OK */
+	s++;
+
+    if (*s == 'v') {
+	s++;  /* get past 'v' */
+	qv = 1; /* force quoted version processing */
+    }
+
+    start = last = pos = s;
+
+    /* pre-scan the input string to check for decimals/underbars */
+    while ( *pos == '.' || *pos == '_' || isDIGIT(*pos) )
+    {
+	if ( *pos == '.' )
+	{
+	    if ( alpha )
+		Perl_croak(aTHX_ "Invalid version format (underscores before decimal)");
+	    saw_period++ ;
+	    last = pos;
+	}
+	else if ( *pos == '_' )
+	{
+	    if ( alpha )
+		Perl_croak(aTHX_ "Invalid version format (multiple underscores)");
+	    alpha = 1;
+	    width = pos - last - 1; /* natural width of sub-version */
+	}
+	pos++;
+    }
+
+    if ( saw_period > 1 )
+	qv = 1; /* force quoted version processing */
+
+    pos = s;
+
+    if ( qv )
+	hv_store((HV *)hv, "qv", 2, newSViv(qv), 0);
+    if ( alpha )
+	hv_store((HV *)hv, "alpha", 5, newSViv(alpha), 0);
+    if ( !qv && width < 3 )
+	hv_store((HV *)hv, "width", 5, newSViv(width), 0);
+    
+    while (isDIGIT(*pos))
+	pos++;
+    if (!isALPHA(*pos)) {
+	I32 rev;
+
+	for (;;) {
+	    rev = 0;
+	    {
+  		/* this is atoi() that delimits on underscores */
+  		const char *end = pos;
+  		I32 mult = 1;
+ 		I32 orev;
+
+		/* the following if() will only be true after the decimal
+		 * point of a version originally created with a bare
+		 * floating point number, i.e. not quoted in any way
+		 */
+ 		if ( !qv && s > start && saw_period == 1 ) {
+		    mult *= 100;
+ 		    while ( s < end ) {
+ 			orev = rev;
+ 			rev += (*s - '0') * mult;
+ 			mult /= 10;
+ 			if ( PERL_ABS(orev) > PERL_ABS(rev) )
+ 			    Perl_croak(aTHX_ "Integer overflow in version");
+ 			s++;
+			if ( *s == '_' )
+			    s++;
+ 		    }
+  		}
+ 		else {
+ 		    while (--end >= s) {
+ 			orev = rev;
+ 			rev += (*end - '0') * mult;
+ 			mult *= 10;
+ 			if ( PERL_ABS(orev) > PERL_ABS(rev) )
+ 			    Perl_croak(aTHX_ "Integer overflow in version");
+ 		    }
+ 		} 
+  	    }
+
+  	    /* Append revision */
+	    av_push(av, newSViv(rev));
+	    if ( *pos == '.' && isDIGIT(pos[1]) )
+		s = ++pos;
+	    else if ( *pos == '_' && isDIGIT(pos[1]) )
+		s = ++pos;
+	    else if ( isDIGIT(*pos) )
+		s = pos;
+	    else {
+		s = pos;
+		break;
+	    }
+	    if ( qv ) {
+		while ( isDIGIT(*pos) )
+		    pos++;
+	    }
+	    else {
+		int digits = 0;
+		while ( ( isDIGIT(*pos) || *pos == '_' ) && digits < 3 ) {
+		    if ( *pos != '_' )
+			digits++;
+		    pos++;
+		}
+	    }
+	}
+    }
+    if ( qv ) { /* quoted versions always get at least three terms*/
+	I32 len = av_len(av);
+	/* This for loop appears to trigger a compiler bug on OS X, as it
+	   loops infinitely. Yes, len is negative. No, it makes no sense.
+	   Compiler in question is:
+	   gcc version 3.3 20030304 (Apple Computer, Inc. build 1640)
+	   for ( len = 2 - len; len > 0; len-- )
+	   av_push((AV *)sv, newSViv(0));
+	*/
+	len = 2 - len;
+	while (len-- > 0)
+	    av_push(av, newSViv(0));
+    }
+
+    if ( av_len(av) == -1 ) /* oops, someone forgot to pass a value */
+	av_push(av, newSViv(0));
+
+    /* And finally, store the AV in the hash */
+    hv_store((HV *)hv, "version", 7, newRV_noinc((SV *)av), 0);
+    return s;
+}
+
+/*
+=for apidoc new_version
+
+Returns a new version object based on the passed in SV:
+
+    SV *sv = new_version(SV *ver);
+
+Does not alter the passed in ver SV.  See "upg_version" if you
+want to upgrade the SV.
+
+=cut
+*/
+
+SV *
+Perl_new_version(pTHX_ SV *ver)
+{
+    SV * const rv = newSV(0);
+    if ( sv_derived_from(ver,"version") ) /* can just copy directly */
+    {
+	I32 key;
+	AV * const av = newAV();
+	AV *sav;
+	/* This will get reblessed later if a derived class*/
+	SV * const hv = newSVrv(rv, "version"); 
+	(void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */
+#ifndef NODEFAULT_SHAREKEYS
+	HvSHAREKEYS_on(hv);         /* key-sharing on by default */
+#endif
+
+	if ( SvROK(ver) )
+	    ver = SvRV(ver);
+
+	/* Begin copying all of the elements */
+	if ( hv_exists((HV *)ver, "qv", 2) )
+	    hv_store((HV *)hv, "qv", 2, &PL_sv_yes, 0);
+
+	if ( hv_exists((HV *)ver, "alpha", 5) )
+	    hv_store((HV *)hv, "alpha", 5, &PL_sv_yes, 0);
+	
+	if ( hv_exists((HV*)ver, "width", 5 ) )
+	{
+	    const I32 width = SvIV(*hv_fetch((HV*)ver, "width", 5, FALSE));
+	    hv_store((HV *)hv, "width", 5, newSViv(width), 0);
+	}
+
+	sav = (AV *)SvRV(*hv_fetch((HV*)ver, "version", 7, FALSE));
+	/* This will get reblessed later if a derived class*/
+	for ( key = 0; key <= av_len(sav); key++ )
+	{
+	    const I32 rev = SvIV(*av_fetch(sav, key, FALSE));
+	    av_push(av, newSViv(rev));
+	}
+
+	hv_store((HV *)hv, "version", 7, newRV_noinc((SV *)av), 0);
+	return rv;
+    }
+#ifdef SvVOK
+    if ( SvVOK(ver) ) { /* already a v-string */
+	const MAGIC* const mg = mg_find(ver,PERL_MAGIC_vstring);
+	const STRLEN len = mg->mg_len;
+	char * const version = savepvn( (const char*)mg->mg_ptr, len);
+	sv_setpvn(rv,version,len);
+	Safefree(version);
+    }
+    else {
+#endif
+    sv_setsv(rv,ver); /* make a duplicate */
+#ifdef SvVOK
+    }
+#endif
+    upg_version(rv);
+    return rv;
+}
+
+/*
+=for apidoc upg_version
+
+In-place upgrade of the supplied SV to a version object.
+
+    SV *sv = upg_version(SV *sv);
+
+Returns a pointer to the upgraded SV.
+
+=cut
+*/
+
+SV *
+Perl_upg_version(pTHX_ SV *ver)
+{
+    char *version;
+    bool qv = 0;
+
+    if ( SvNOK(ver) ) /* may get too much accuracy */ 
+    {
+	char tbuf[64];
+	sprintf(tbuf,"%.9"NVgf, SvNVX(ver));
+	version = savepv(tbuf);
+    }
+#ifdef SvVOK
+    else if ( SvVOK(ver) ) { /* already a v-string */
+	const MAGIC* const mg = mg_find(ver,PERL_MAGIC_vstring);
+	version = savepvn( (const char*)mg->mg_ptr,mg->mg_len );
+	qv = 1;
+    }
+#endif
+    else /* must be a string or something like a string */
+    {
+	version = savepv(SvPV_nolen(ver));
+    }
+    (void)scan_version(version, ver, qv);
+    Safefree(version);
+    return ver;
+}
+
+/*
+=for apidoc vverify
+
+Validates that the SV contains a valid version object.
+
+    bool vverify(SV *vobj);
+
+Note that it only confirms the bare minimum structure (so as not to get
+confused by derived classes which may contain additional hash entries):
+
+=over 4
+
+=item * The SV contains a [reference to a] hash
+
+=item * The hash contains a "version" key
+
+=item * The "version" key has [a reference to] an AV as its value
+
+=back
+
+=cut
+*/
+
+bool
+Perl_vverify(pTHX_ SV *vs)
+{
+    SV *sv;
+    if ( SvROK(vs) )
+	vs = SvRV(vs);
+
+    /* see if the appropriate elements exist */
+    if ( SvTYPE(vs) == SVt_PVHV
+	 && hv_exists((HV*)vs, "version", 7)
+	 && (sv = SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE)))
+	 && SvTYPE(sv) == SVt_PVAV )
+	return TRUE;
+    else
+	return FALSE;
+}
+
+/*
+=for apidoc vnumify
+
+Accepts a version object and returns the normalized floating
+point representation.  Call like:
+
+    sv = vnumify(rv);
+
+NOTE: you can pass either the object directly or the SV
+contained within the RV.
+
+=cut
+*/
+
+SV *
+Perl_vnumify(pTHX_ SV *vs)
+{
+    I32 i, len, digit;
+    int width;
+    bool alpha = FALSE;
+    SV * const sv = newSV(0);
+    AV *av;
+    if ( SvROK(vs) )
+	vs = SvRV(vs);
+
+    if ( !vverify(vs) )
+	Perl_croak(aTHX_ "Invalid version object");
+
+    /* see if various flags exist */
+    if ( hv_exists((HV*)vs, "alpha", 5 ) )
+	alpha = TRUE;
+    if ( hv_exists((HV*)vs, "width", 5 ) )
+	width = SvIV(*hv_fetch((HV*)vs, "width", 5, FALSE));
+    else
+	width = 3;
+
+
+    /* attempt to retrieve the version array */
+    if ( !(av = (AV *)SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE)) ) ) {
+	sv_catpvn(sv,"0",1);
+	return sv;
+    }
+
+    len = av_len(av);
+    if ( len == -1 )
+    {
+	sv_catpvn(sv,"0",1);
+	return sv;
+    }
+
+    digit = SvIV(*av_fetch(av, 0, 0));
+    Perl_sv_setpvf(aTHX_ sv, "%d.", (int)PERL_ABS(digit));
+    for ( i = 1 ; i < len ; i++ )
+    {
+	digit = SvIV(*av_fetch(av, i, 0));
+	if ( width < 3 ) {
+	    const int denom = (width == 2 ? 10 : 100);
+	    const div_t term = div((int)PERL_ABS(digit),denom);
+	    Perl_sv_catpvf(aTHX_ sv, "%0*d_%d", width, term.quot, term.rem);
+	}
+	else {
+	    Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit);
+	}
+    }
+
+    if ( len > 0 )
+    {
+	digit = SvIV(*av_fetch(av, len, 0));
+	if ( alpha && width == 3 ) /* alpha version */
+	    sv_catpvn(sv,"_",1);
+	Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit);
+    }
+    else /* len == 0 */
+    {
+	sv_catpvn(sv,"000",3);
+    }
+    return sv;
+}
+
+/*
+=for apidoc vnormal
+
+Accepts a version object and returns the normalized string
+representation.  Call like:
+
+    sv = vnormal(rv);
+
+NOTE: you can pass either the object directly or the SV
+contained within the RV.
+
+=cut
+*/
+
+SV *
+Perl_vnormal(pTHX_ SV *vs)
+{
+    I32 i, len, digit;
+    bool alpha = FALSE;
+    SV * const sv = newSV(0);
+    AV *av;
+    if ( SvROK(vs) )
+	vs = SvRV(vs);
+
+    if ( !vverify(vs) )
+	Perl_croak(aTHX_ "Invalid version object");
+
+    if ( hv_exists((HV*)vs, "alpha", 5 ) )
+	alpha = TRUE;
+    av = (AV *)SvRV(*hv_fetch((HV*)vs, "version", 7, FALSE));
+
+    len = av_len(av);
+    if ( len == -1 )
+    {
+	sv_catpvn(sv,"",0);
+	return sv;
+    }
+    digit = SvIV(*av_fetch(av, 0, 0));
+    Perl_sv_setpvf(aTHX_ sv, "v%"IVdf, (IV)digit);
+    for ( i = 1 ; i < len ; i++ ) {
+	digit = SvIV(*av_fetch(av, i, 0));
+	Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit);
+    }
+
+    if ( len > 0 )
+    {
+	/* handle last digit specially */
+	digit = SvIV(*av_fetch(av, len, 0));
+	if ( alpha )
+	    Perl_sv_catpvf(aTHX_ sv, "_%"IVdf, (IV)digit);
+	else
+	    Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit);
+    }
+
+    if ( len <= 2 ) { /* short version, must be at least three */
+	for ( len = 2 - len; len != 0; len-- )
+	    sv_catpvn(sv,".0",2);
+    }
+    return sv;
+}
+
+/*
+=for apidoc vstringify
+
+In order to maintain maximum compatibility with earlier versions
+of Perl, this function will return either the floating point
+notation or the multiple dotted notation, depending on whether
+the original version contained 1 or more dots, respectively
+
+=cut
+*/
+
+SV *
+Perl_vstringify(pTHX_ SV *vs)
+{
+    if ( SvROK(vs) )
+	vs = SvRV(vs);
+    
+    if ( !vverify(vs) )
+	Perl_croak(aTHX_ "Invalid version object");
+
+    if ( hv_exists((HV *)vs, "qv", 2) )
+	return vnormal(vs);
+    else
+	return vnumify(vs);
+}
+
+/*
+=for apidoc vcmp
+
+Version object aware cmp.  Both operands must already have been 
+converted into version objects.
+
+=cut
+*/
+
+int
+Perl_vcmp(pTHX_ SV *lhv, SV *rhv)
+{
+    I32 i,l,m,r,retval;
+    bool lalpha = FALSE;
+    bool ralpha = FALSE;
+    I32 left = 0;
+    I32 right = 0;
+    AV *lav, *rav;
+    if ( SvROK(lhv) )
+	lhv = SvRV(lhv);
+    if ( SvROK(rhv) )
+	rhv = SvRV(rhv);
+
+    if ( !vverify(lhv) )
+	Perl_croak(aTHX_ "Invalid version object");
+
+    if ( !vverify(rhv) )
+	Perl_croak(aTHX_ "Invalid version object");
+
+    /* get the left hand term */
+    lav = (AV *)SvRV(*hv_fetch((HV*)lhv, "version", 7, FALSE));
+    if ( hv_exists((HV*)lhv, "alpha", 5 ) )
+	lalpha = TRUE;
+
+    /* and the right hand term */
+    rav = (AV *)SvRV(*hv_fetch((HV*)rhv, "version", 7, FALSE));
+    if ( hv_exists((HV*)rhv, "alpha", 5 ) )
+	ralpha = TRUE;
+
+    l = av_len(lav);
+    r = av_len(rav);
+    m = l < r ? l : r;
+    retval = 0;
+    i = 0;
+    while ( i <= m && retval == 0 )
+    {
+	left  = SvIV(*av_fetch(lav,i,0));
+	right = SvIV(*av_fetch(rav,i,0));
+	if ( left < right  )
+	    retval = -1;
+	if ( left > right )
+	    retval = +1;
+	i++;
+    }
+
+    /* tiebreaker for alpha with identical terms */
+    if ( retval == 0 && l == r && left == right && ( lalpha || ralpha ) )
+    {
+	if ( lalpha && !ralpha )
+	{
+	    retval = -1;
+	}
+	else if ( ralpha && !lalpha)
+	{
+	    retval = +1;
+	}
+    }
+
+    if ( l != r && retval == 0 ) /* possible match except for trailing 0's */
+    {
+	if ( l < r )
+	{
+	    while ( i <= r && retval == 0 )
+	    {
+		if ( SvIV(*av_fetch(rav,i,0)) != 0 )
+		    retval = -1; /* not a match after all */
+		i++;
+	    }
+	}
+	else
+	{
+	    while ( i <= l && retval == 0 )
+	    {
+		if ( SvIV(*av_fetch(lav,i,0)) != 0 )
+		    retval = +1; /* not a match after all */
+		i++;
+	    }
+	}
+    }
+    return retval;
+}

Added: packages/libversion-perl/branches/upstream/current/vutil/vutil.h
===================================================================
--- packages/libversion-perl/branches/upstream/current/vutil/vutil.h	2006-01-09 15:54:02 UTC (rev 1881)
+++ packages/libversion-perl/branches/upstream/current/vutil/vutil.h	2006-01-10 10:58:36 UTC (rev 1882)
@@ -0,0 +1,30 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+#include "ppport.h"
+
+#ifndef PERL_ABS
+#define PERL_ABS(x) ((x) < 0 ? -(x) : (x))
+#endif
+
+#ifndef SVf
+#define SVf "_"
+#endif
+
+const char * Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv);
+SV * Perl_new_version(pTHX_ SV *ver);
+SV * Perl_upg_version(pTHX_ SV *sv);
+bool Perl_vverify(pTHX_ SV *vs);
+SV * Perl_vnumify(pTHX_ SV *vs);
+SV * Perl_vnormal(pTHX_ SV *vs);
+SV * Perl_vstringify(pTHX_ SV *vs);
+int Perl_vcmp(pTHX_ SV *lsv, SV *rsv);
+
+#define scan_version(a,b,c)	Perl_scan_version(aTHX_ a,b,c)
+#define new_version(a)		Perl_new_version(aTHX_ a)
+#define upg_version(a)		Perl_upg_version(aTHX_ a)
+#define vverify(a)		Perl_vverify(aTHX_ a)
+#define vnumify(a)		Perl_vnumify(aTHX_ a)
+#define vnormal(a)		Perl_vnormal(aTHX_ a)
+#define vstringify(a)		Perl_vstringify(aTHX_ a)
+#define vcmp(a,b)		Perl_vcmp(aTHX_ a,b)




More information about the Pkg-perl-cvs-commits mailing list