GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Data::GUID(3) User Contributed Perl Documentation Data::GUID(3)

Data::GUID - globally unique identifiers

version 0.050

  use Data::GUID;

  my $guid = Data::GUID->new;

  my $string = $guid->as_string; # or "$guid"

  my $other_guid = Data::GUID->from_string($string);

  if (($guid <=> $other_guid) == 0) {
    print "They're the same!\n";
  }

Data::GUID provides a simple interface for generating and using globally unique identifiers.

This module has an extremely long-term perl support period. That means it will not require a version of perl released fewer than ten years ago.

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.

  my $guid = Data::GUID->new;

This method returns a new globally unique identifier.

These method returns a new Data::GUID object for the given GUID value. In all cases, these methods throw an exception if given invalid input.

  my $guid = Data::GUID->from_string("B0470602-A64B-11DA-8632-93EBF1C0E05A");

  # note that a hex guid is a guid string without hyphens and with a leading 0x
  my $guid = Data::GUID->from_hex("0xB0470602A64B11DA863293EBF1C0E05A");

  my $guid = Data::GUID->from_base64("sEcGAqZLEdqGMpPr8cDgWg==");

This method returns a new Data::GUID object if given a Data::UUID value. Because Data::UUID values are not blessed and because Data::UUID provides no validation method, this method will only throw an exception if the given data is of the wrong size.

These methods return regex objects that match regex strings of the appropriate type.

  my $string = get_string_from_ether;

  my $guid = Data::GUID->from_any_string($string);

This method returns a Data::GUID object for the given string, trying all known string interpretations. An exception is thrown if the value is not a valid GUID string.

  my $value = get_value_from_ether;

  my $guid = Data::GUID->best_guess($value);

This method returns a Data::GUID object for the given value, trying everything it can. It works like "from_any_string", but will also accept Data::UUID values. (In effect, this means that any sixteen byte value is acceptable.)

These methods return various string representations of a GUID.

This method returns a "traditional" GUID/UUID string representation. This is five hexadecimal strings, delimited by hyphens. For example:

  B0470602-A64B-11DA-8632-93EBF1C0E05A

This method is also used to stringify Data::GUID objects.

This method returns a plain hexadecimal representation of the GUID, with a leading "0x". For example:

  0xB0470602A64B11DA863293EBF1C0E05A

This method returns a base-64 string representation of the GUID. For example:

  sEcGAqZLEdqGMpPr8cDgWg==

This method compares a GUID to another GUID and returns -1, 0, or 1, as do other comparison routines.

This method returns the packed binary representation of the GUID. At present this method relies on Data::GUID's underlying use of Data::UUID. It is not guaranteed to continue to work the same way, or at all. Caveat invocator.

Data::GUID does not export any subroutines by default, but it provides a few routines which will be imported on request. These routines may be called as class methods, or may be imported to be called as subroutines. Calling them by fully qualified name is incorrect.

  use Data::GUID qw(guid);

  my $guid = guid;             # OK
  my $guid = Data::GUID->guid; # OK
  my $guid = Data::GUID::guid; # NOT OK

This routine returns a new Data::GUID object.

This returns the string representation of a new GUID.

This returns the hex representation of a new GUID.

This returns the base64 representation of a new GUID.

This returns the result of calling the "from_any_string" method.

  • add namespace support
  • remove dependency on wretched Data::UUID
  • make it work on 5.005

Ricardo SIGNES <rjbs@semiotic.systems>

This software is copyright (c) 2006 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2021-06-21 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.