[Bps-public-commit] r12434 - in Prophet/trunk: .

jesse at bestpractical.com jesse at bestpractical.com
Sat May 17 05:29:48 EDT 2008


Author: jesse
Date: Sat May 17 05:29:45 2008
New Revision: 12434

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

Log:
 r31099 at dhcp113 (orig r12368):  sartak | 2008-05-16 18:03:47 +0900
  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/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Sat May 17 05:29:45 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