[Jifty-commit] r6611 - in jifty/trunk: lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Tue Mar 17 10:58:54 EDT 2009


Author: alexmv
Date: Tue Mar 17 10:58:52 2009
New Revision: 6611

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/CurrentUser.pm

Log:
 r43250 at kohr-ah:  chmrr | 2009-03-17 10:33:45 -0400
 Cheat, in Jifty::CurrentUser, and walk around Class::Accessor methods in a hotspot


Modified: jifty/trunk/lib/Jifty/CurrentUser.pm
==============================================================================
--- jifty/trunk/lib/Jifty/CurrentUser.pm	(original)
+++ jifty/trunk/lib/Jifty/CurrentUser.pm	Tue Mar 17 10:58:52 2009
@@ -138,16 +138,14 @@
 sub id {
     my $self = shift;
 
+    # This can be a hotspot, so we don't use method calls, instead
+    # directly accessing the value.
+
     # Make sure we have a user object before trying to ID it
-    if ($self->user_object) {
-        return ($self->user_object->id());
-    } 
-    
-    # No user object, return a null ID
-    else {
-        return '0';
-    }
+    return $self->{user_object}->id if $self->{user_object};
 
+    # No user object, return a null ID
+    return 0;
 }
 
 =head2 current_user


More information about the Jifty-commit mailing list