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

ruz at bestpractical.com ruz at bestpractical.com
Sat Dec 6 07:36:07 EST 2008


Author: ruz
Date: Sat Dec  6 07:36:06 2008
New Revision: 17125

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

Log:
* add _user_info lower level helper for user_info and memoize it

Modified: sd/trunk/lib/App/SD/Replica/hm.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/hm.pm	(original)
+++ sd/trunk/lib/App/SD/Replica/hm.pm	Sat Dec  6 07:36:06 2008
@@ -145,15 +145,21 @@
 sub user_info {
     my $self = shift;
     my %args = @_;
-    unless ( keys %args ) {
-        %args = (email => $self->hm_username);
-    }
+    return $self->_user_info(
+        keys %args? %args : email => $self->hm_username
+    );
+}
+
+sub _user_info {
+    my $self = shift;
+    my %args = @_;
     my $status = $self->hm->act(
         'SearchUser', %args,
     );
     die $status->{'error'} unless $status->{'success'};
     return $status->{'content'}{'search'}[0] || {};
 }
+memoize '_user_info';
 
 sub _integrate_change {
     my $self = shift;



More information about the Bps-public-commit mailing list