[Bps-public-commit] r13808 - sd/trunk/lib/App/SD/Replica

clkao at bestpractical.com clkao at bestpractical.com
Fri Jul 4 10:30:16 EDT 2008


Author: clkao
Date: Fri Jul  4 10:30:13 2008
New Revision: 13808

Modified:
   sd/trunk/lib/App/SD/Replica/Hiveminder.pm

Log:
restore the setup behaviour for hm replica.


Modified: sd/trunk/lib/App/SD/Replica/Hiveminder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/Hiveminder.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/Hiveminder.pm	Fri Jul  4 10:30:13 2008
@@ -8,13 +8,23 @@
 use Prophet::ChangeSet;
 use File::Temp 'tempdir';
 
-has hm => ( isa => 'Str', is => 'rw');
+has hm => ( isa => 'Net::Jifty', is => 'rw');
 has hm_url => ( isa => 'Str', is => 'rw');
 has hm_username => ( isa => 'Str', is => 'rw');
 
 
 use constant scheme => 'hm';
 
+# XXX: this should be called from superclass, or better, have individual attributes have their own builders.
+
+around 'new' => sub {
+    my ($next, $self, @args) = @_;
+    warn "around $self $next";
+    my $ret = $self->$next(@args);
+    $ret->setup;
+    warn "==> $ret";
+    return $ret;
+};
 
 
 =head2 setup
@@ -28,8 +38,9 @@
     my $self = shift;
 
     require Net::Jifty;
-    my ($server) = $self->{url} =~ m/^(.*?)$/
+    my ($server) = $self->{url} =~ m/^hm:(.*?)$/
         or die "Can't parse hiveminder server spec";
+    $self->url($server);
     my $uri = URI->new($server);
     my ( $username, $password );
     if ( $uri->can('userinfo') && (my $auth = $uri->userinfo) ) {
@@ -51,8 +62,6 @@
     );
 
     $self->hm_username($username);
-
-    $self->SUPER::setup(@_);
 }
 
 =head2 uuid



More information about the Bps-public-commit mailing list