[Rt-commit] r18579 - in rt/3.999/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Tue Feb 24 21:47:53 EST 2009


Author: sartak
Date: Tue Feb 24 21:47:53 2009
New Revision: 18579

Modified:
   rt/3.999/trunk/   (props changed)
   rt/3.999/trunk/lib/RT/DateTime.pm

Log:
 r80551 at onn:  sartak | 2009-02-24 21:47:47 -0500
 Ugly hack to get our subclass of DateTime::Duration out of ->age. Rolsky is likely to accept my duration_class patch I think.. hope.. :)


Modified: rt/3.999/trunk/lib/RT/DateTime.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/DateTime.pm	(original)
+++ rt/3.999/trunk/lib/RT/DateTime.pm	Tue Feb 24 21:47:53 2009
@@ -6,11 +6,18 @@
 
 use RT::DateTime::Duration;
 
+use constant duration_class => 'RT::DateTime::Duration';
+
 sub age {
     my $self  = shift;
     my $until = shift || RT::DateTime->now;
 
-    return $until - $self;
+    # XXX: This doesn't work yet because DateTime doesn't have a duration_class
+    # method
+    # return $until - $self;
+
+    my $duration = $until - $self;
+    bless $duration, $self->duration_class;
 }
 
 1;


More information about the Rt-commit mailing list