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

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 17 17:32:21 EDT 2008


Author: sartak
Date: Thu Jul 17 17:32:21 2008
New Revision: 14238

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

Log:
 r64522 at onn:  sartak | 2008-07-17 17:25:54 -0400
 Refactor REPLICA_TYPE_MAP handling so we can extend it to support more options


Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Thu Jul 17 17:32:21 2008
@@ -49,7 +49,10 @@
 
  # register some aliases
 for my $scheme (qw/http file/) {
-   __PACKAGE__->register_replica_scheme(scheme => $scheme, class => $REPLICA_TYPE_MAP->{prophet});
+   __PACKAGE__->register_replica_scheme(
+       %{ $REPLICA_TYPE_MAP->{prophet} },
+       scheme => $scheme,
+   );
 }
 
 =head1 NAME
@@ -99,10 +102,9 @@
     my $class = shift;
     my %args = validate(@_, { class => 1, scheme => 1});
 
-    $Prophet::Replica::REPLICA_TYPE_MAP->{$args{'scheme'}} = $args{'class'};
-
-
-
+    $Prophet::Replica::REPLICA_TYPE_MAP->{$args{'scheme'}} = {
+        class => $args{'class'},
+    };
 }
 
 =head2 _url_to_replica_class
@@ -116,7 +118,8 @@
     my $url  = shift;
 
     my ($scheme, $real_url) = split /:/, $url;
-    return ($Prophet::Replica::REPLICA_TYPE_MAP->{$scheme}, $scheme, $real_url);
+    my $type_map = $Prophet::Replica::REPLICA_TYPE_MAP->{$scheme};
+    return ($type_map->{class}, $scheme, $real_url);
 }
 
 sub import_changesets {



More information about the Bps-public-commit mailing list