Tie::DataUUID - tie interface to Data::UUID;


Tie-DataUUID documentation Contained in the Tie-DataUUID distribution.

Index


Code Index:

NAME

Top

Tie::DataUUID - tie interface to Data::UUID;

SYNOPSIS

Top

  use Tie::DataUUID;
  tie my $uuid, "Tie::DataUUID";

  print "A uuid is $uuid, another is $uuid\n"

DESCRIPTION

Top

A simple tie interface to the Data::UUID module. Yes, this doesn't do much - it's just me being to lazy when I have to keep creating UUIDs from within strings.

To be really totally and utterly lazy you can use the exporting interface that exports the $uuid variable so you don't even have to tie things yourself:

  use Tie::DataUUID qw($uuid);
  print "A uuid is $uuid, another is $uuid\n"

In both cases the standard UUID string (that looks like 'E63E9204-9516-11D8-9C9F-AE87831498F6') are produced.

AUTHOR

Top

Written by Mark Fowler <mark@twoshortplanks.com>

Copyright Fotango 2004. All Rights Reserved.

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

BUGS

Top

None known.

Bugs should be reported to me via the CPAN RT system. http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Tie::DataUUID.

SEE ALSO

Top

Data::UUID, Tie::Scalar


Tie-DataUUID documentation Contained in the Tie-DataUUID distribution.
package Tie::DataUUID;

use strict;
use vars qw($VERSION $uuid @ISA);
#use warnings;

$VERSION = "1.00";

use Tie::Scalar;
@ISA = qw(Tie::StdScalar);

use Data::UUID;

my $datauuid = Data::UUID->new();

sub import
{
  my $class = shift;
  my $args = shift;

  if (defined $args && $args eq '$uuid')
  {
    my $uuid;
    tie $uuid, $class;
    no strict 'refs';   # about to export symbols
    *{ caller() . "::uuid" } = \$uuid;
  }
}

sub FETCH { $datauuid->create_str }

1;