[Bps-public-commit] r12368 - in Prophet/branches/luid: lib/Prophet

sartak at bestpractical.com sartak at bestpractical.com
Fri May 16 05:03:55 EDT 2008


Author: sartak
Date: Fri May 16 05:03:47 2008
New Revision: 12368

Modified:
   Prophet/branches/luid/   (props changed)
   Prophet/branches/luid/lib/Prophet/Record.pm

Log:
 r55952 at onn:  sartak | 2008-05-16 04:50:16 -0400
 Record->luid, and Record->find_or_create_luid which defers to the handle


Modified: Prophet/branches/luid/lib/Prophet/Record.pm
==============================================================================
--- Prophet/branches/luid/lib/Prophet/Record.pm	(original)
+++ Prophet/branches/luid/lib/Prophet/Record.pm	Fri May 16 05:03:47 2008
@@ -15,7 +15,7 @@
 
 use base qw'Class::Accessor Class::Data::Inheritable';
 
-__PACKAGE__->mk_accessors(qw'handle uuid type');
+__PACKAGE__->mk_accessors(qw'handle uuid luid type');
 __PACKAGE__->mk_classdata( REFERENCES => {} );
 __PACKAGE__->mk_classdata( PROPERTIES => {} );
 
@@ -121,6 +121,7 @@
     $self->validate_props( $args{'props'} ) or return undef;
 
     $self->uuid($uuid);
+    $self->find_or_create_luid();
 
     $self->handle->create_record(
         props => $args{'props'},
@@ -141,6 +142,7 @@
     my $self = shift;
     my %args = validate( @_, { uuid => 1 } );
     $self->uuid( $args{uuid} );
+    $self->find_or_create_luid();
 
     return $self->handle->record_exists( uuid => $self->uuid, type => $self->type );
 }
@@ -282,4 +284,17 @@
 
 }
 
+=head2 find_or_create_luid
+
+Finds the luid for the records uuid, or creates a new one. Returns the luid.
+
+=cut
+
+sub find_or_create_luid {
+    my $self = shift;
+    my $luid = $self->handle->find_or_create_luid($self->uuid);
+    $self->luid($luid);
+    return $luid;
+}
+
 1;



More information about the Bps-public-commit mailing list