[Bps-public-commit] r16714 - in Prophet/branches/init-and-clone: .
sartak at bestpractical.com
sartak at bestpractical.com
Thu Nov 6 12:01:17 EST 2008
Author: sartak
Date: Thu Nov 6 12:01:17 2008
New Revision: 16714
Modified:
Prophet/branches/init-and-clone/ (props changed)
Prophet/branches/init-and-clone/lib/Prophet/DatabaseSetting.pm
Log:
r75125 at onn: sartak | 2008-11-06 12:01:07 -0500
use BUILDARGS and BUILD instead of new and initialize
Modified: Prophet/branches/init-and-clone/lib/Prophet/DatabaseSetting.pm
==============================================================================
--- Prophet/branches/init-and-clone/lib/Prophet/DatabaseSetting.pm (original)
+++ Prophet/branches/init-and-clone/lib/Prophet/DatabaseSetting.pm Thu Nov 6 12:01:17 2008
@@ -13,18 +13,18 @@
is => 'rw'
);
+sub BUILDARGS {
+ my $self = shift;
+ my $args = $self->SUPER::BUILDARGS(@_);
+ $args->{type} ||= '__prophet_db_settings';
+ return $args;
+}
-sub new {
- my $self = shift->SUPER::new( type => '__prophet_db_settings', @_);
-
- $self->initialize unless ($self->handle->record_exists(uuid => $self->uuid, type => $self->type) );
- return $self;
- }
-
-
-sub initialize {
+sub BUILD {
my $self = shift;
- $self->set($self->default);
+
+ $self->set($self->default)
+ unless ($self->handle->record_exists(uuid => $self->uuid, type => $self->type) );
}
sub set {
More information about the Bps-public-commit
mailing list