[Bps-public-commit] r12431 - in Prophet/branches/moose: .

sartak at bestpractical.com sartak at bestpractical.com
Sat May 17 05:02:36 EDT 2008


Author: sartak
Date: Sat May 17 05:02:33 2008
New Revision: 12431

Modified:
   Prophet/branches/moose/   (props changed)
   Prophet/branches/moose/lib/Prophet/ChangeSet.pm

Log:
 r56148 at onn:  sartak | 2008-05-17 05:02:23 -0400
 Turn changes into a very basic attribute, now to see what enhancement breaks it


Modified: Prophet/branches/moose/lib/Prophet/ChangeSet.pm
==============================================================================
--- Prophet/branches/moose/lib/Prophet/ChangeSet.pm	(original)
+++ Prophet/branches/moose/lib/Prophet/ChangeSet.pm	Sat May 17 05:02:33 2008
@@ -1,5 +1,7 @@
 package Prophet::ChangeSet;
 use Moose;
+use Prophet::Change;
+use Params::Validate;
 
 has sequence_no => (
     is => 'rw',
@@ -25,6 +27,13 @@
     is => 'rw',
 );
 
+has _changes => (
+    is       => 'rw',
+    isa      => 'ArrayRef[Prophet::Change]',
+    init_arg => 'changes',
+    default  => sub { [] },
+);
+
 =head1 NAME
 
 Prophet::ChangeSet
@@ -35,9 +44,6 @@
 
 =cut
 
-use Prophet::Change;
-use Params::Validate;
-
 =head1 METHODS
 
 =cut
@@ -83,7 +89,7 @@
 sub add_change {
     my $self = shift;
     my %args = validate( @_, { change => { isa => 'Prophet::Change' } } );
-    push @{ $self->{changes} }, $args{change};
+    push @{ $self->_changes }, $args{change};
 
 }
 
@@ -96,9 +102,9 @@
 sub changes {
     my $self = shift;
     if (@_) {
-        $self->{'changes'} = shift;
+        $self->_changes(shift);
     }
-    return @{ $self->{'changes'} || [] };
+    return @{ $self->_changes };
 }
 
 =head2 is_empty
@@ -109,7 +115,7 @@
 
 sub is_empty {
     my $self = shift;
-    return $self->changes ? 0 : 1;
+    return @{ $self->_changes } ? 0 : 1;
 }
 
 our @SERIALIZE_PROPS



More information about the Bps-public-commit mailing list