r13914 - in /branches/upstream/libuuid-perl: ./ current/ current/Changes current/MANIFEST current/Makefile.PL current/UUID.pm current/UUID.xs current/test.pl

schizo at users.alioth.debian.org schizo at users.alioth.debian.org
Thu Jan 31 19:11:42 UTC 2008


Author: schizo
Date: Thu Jan 31 19:11:42 2008
New Revision: 13914

URL: http://svn.debian.org/wsvn/?sc=1&rev=13914
Log:
[svn-inject] Installing original source of libuuid-perl

Added:
    branches/upstream/libuuid-perl/
    branches/upstream/libuuid-perl/current/
    branches/upstream/libuuid-perl/current/Changes
    branches/upstream/libuuid-perl/current/MANIFEST
    branches/upstream/libuuid-perl/current/Makefile.PL
    branches/upstream/libuuid-perl/current/UUID.pm
    branches/upstream/libuuid-perl/current/UUID.xs
    branches/upstream/libuuid-perl/current/test.pl

Added: branches/upstream/libuuid-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libuuid-perl/current/Changes?rev=13914&op=file
==============================================================================
--- branches/upstream/libuuid-perl/current/Changes (added)
+++ branches/upstream/libuuid-perl/current/Changes Thu Jan 31 19:11:42 2008
@@ -1,0 +1,6 @@
+Revision history for Perl extension UUID.
+
+0.01  Thu Feb  8 06:07:59 2001
+	- original version; created by h2xs 1.20 with options
+		-A -n UUID
+

Added: branches/upstream/libuuid-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libuuid-perl/current/MANIFEST?rev=13914&op=file
==============================================================================
--- branches/upstream/libuuid-perl/current/MANIFEST (added)
+++ branches/upstream/libuuid-perl/current/MANIFEST Thu Jan 31 19:11:42 2008
@@ -1,0 +1,6 @@
+Changes
+MANIFEST
+Makefile.PL
+UUID.pm
+UUID.xs
+test.pl

Added: branches/upstream/libuuid-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libuuid-perl/current/Makefile.PL?rev=13914&op=file
==============================================================================
--- branches/upstream/libuuid-perl/current/Makefile.PL (added)
+++ branches/upstream/libuuid-perl/current/Makefile.PL Thu Jan 31 19:11:42 2008
@@ -1,0 +1,11 @@
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+    'NAME'              => 'UUID',
+    'VERSION_FROM'      => 'UUID.pm', # finds $VERSION
+    'PREREQ_PM'         => {}, # e.g., Module::Name => 1.1
+    'LIBS'              => ['-luuid'], # e.g., '-lm'
+    'DEFINE'            => '', # e.g., '-DHAVE_SOMETHING'
+    'INC'               => '', # e.g., '-I/usr/include/other'
+);

Added: branches/upstream/libuuid-perl/current/UUID.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libuuid-perl/current/UUID.pm?rev=13914&op=file
==============================================================================
--- branches/upstream/libuuid-perl/current/UUID.pm (added)
+++ branches/upstream/libuuid-perl/current/UUID.pm Thu Jan 31 19:11:42 2008
@@ -1,0 +1,57 @@
+package UUID;
+
+require 5.005;
+use strict;
+#use warnings;
+
+require Exporter;
+require DynaLoader;
+
+use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK $VERSION);
+ at ISA = qw(Exporter DynaLoader);
+
+# This allows declaration       use UUID ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+
+%EXPORT_TAGS = ( 'all' => [qw(&generate &parse &unparse)] );
+
+ at EXPORT_OK = ( @{$EXPORT_TAGS{'all'}} );
+
+$VERSION = '0.02';
+
+bootstrap UUID $VERSION;
+
+# Preloaded methods go here.
+
+1;
+__END__
+
+=head1 NAME
+
+UUID - Perl extension for using UUID interfaces as defined in e2fsprogs.
+
+=head1 SYNOPSIS
+
+  use UUID;
+  UUID::generate($uuid); # generates a 128 bit uuid
+  UUID::unparse($uuid, $string); # change $uuid to 36 byte string
+  $rc = UUID::parse($string, $uuid); # map string to UUID, return -1 on error
+
+=head1 DESCRIPTION
+
+With these 3 routines UUID''s can easily be generated and parsed/un-parsed.
+
+=head2 EXPORT
+
+UUID::{generate, parse, unparse}
+
+=head1 AUTHOR
+
+Peter J. Braam <braam at mountainviewdata.com>
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut

Added: branches/upstream/libuuid-perl/current/UUID.xs
URL: http://svn.debian.org/wsvn/branches/upstream/libuuid-perl/current/UUID.xs?rev=13914&op=file
==============================================================================
--- branches/upstream/libuuid-perl/current/UUID.xs (added)
+++ branches/upstream/libuuid-perl/current/UUID.xs Thu Jan 31 19:11:42 2008
@@ -1,0 +1,69 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <uuid/uuid.h>
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(sv) SvPV(sv, na)
+#endif
+
+void do_generate(SV *str)
+{
+	uuid_t uuid;
+	uuid_generate( uuid );
+	sv_setpvn(str, uuid, sizeof(uuid));
+}
+
+void do_unparse(SV *in, SV * out) 
+{
+	uuid_t uuid;
+	char str[37];
+	
+	uuid_unparse(SvPV_nolen (in), str);
+	sv_setpvn(out, str, 36);
+}
+
+int do_parse(SV *in, SV * out) 
+{
+	uuid_t uuid;
+	char str[37];
+	int rc;
+	
+	rc = uuid_parse(SvPV_nolen(in), uuid);
+	if (!rc) { 
+	      sv_setpvn(out, uuid, sizeof(uuid));
+        }
+	return rc;
+}
+
+
+
+MODULE = UUID		PACKAGE = UUID		
+
+void
+generate(str)
+	SV * str
+	PROTOTYPE: $
+	CODE:
+	do_generate(str); 
+
+void
+unparse(in, out)
+	SV * in
+	SV * out
+	PROTOTYPE: $$
+	CODE:
+	do_unparse(in, out);
+
+int
+parse(in, out)
+	SV * in
+	SV * out
+	PROTOTYPE: $$
+	CODE: 
+	RETVAL = do_parse(in, out);
+	OUTPUT:
+	RETVAL
+
+

Added: branches/upstream/libuuid-perl/current/test.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libuuid-perl/current/test.pl?rev=13914&op=file
==============================================================================
--- branches/upstream/libuuid-perl/current/test.pl (added)
+++ branches/upstream/libuuid-perl/current/test.pl Thu Jan 31 19:11:42 2008
@@ -1,0 +1,36 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+######################### We start with some black magic to print on failure.
+
+# Change 1..1 below to 1..last_test_to_print .
+# (It may become useful if the test is moved to ./t subdirectory.)
+
+BEGIN { $| = 1; print "1..5\n"; }
+END {print "not ok 1\n" unless $loaded;}
+use UUID;
+$loaded = 1;
+print "ok 1\n";
+
+######################### End of black magic.
+
+# Insert your test code below (better if it prints "ok 13"
+# (correspondingly "not ok 13") depending on the success of chunk 13
+# of the test code):
+
+
+UUID::generate($var);
+print (length $var == 0 ? 'not ' : '', "ok 2\n");
+UUID::unparse($var, $out);
+
+# Try to parse the UUID we got.
+$rc = UUID::parse($out, $var2);
+print ($rc ? 'not ' : '', "ok 3\n");
+
+# Check that the unparsed version matches the parsed version.
+print ($var eq $var2 ? '' : 'not ', "ok 4\n");
+
+$rc = UUID::parse("Peter is a moose", $var2);
+print ($rc ? '' : 'not ', "ok 5\n");
+
+exit (0);




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