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

Jifty commits jifty-commit at lists.jifty.org
Fri Jan 23 16:04:41 EST 2009


Author: alexmv
Date: Fri Jan 23 16:04:41 2009
New Revision: 6265

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

Log:
 r41141 at kohr-ah:  chmrr | 2009-01-23 16:04:28 -0500
 Overload stringify on ClassLoader, so warning messages with @INC are a bit more educational


Modified: jifty/trunk/lib/Jifty/ClassLoader.pm
==============================================================================
--- jifty/trunk/lib/Jifty/ClassLoader.pm	(original)
+++ jifty/trunk/lib/Jifty/ClassLoader.pm	Fri Jan 23 16:04:41 2009
@@ -5,6 +5,8 @@
 
 our %AUTOGENERATED;
 
+use overload '""' => \&stringify;
+
 =head1 NAME
 
 Jifty::ClassLoader - Loads the application classes
@@ -459,6 +461,11 @@
     wantarray ? @{ $self->{models} ||= [] } : $self->{models};
 }
 
+sub stringify {
+    my $self = shift;
+    return "Jifty::ClassLoader(@{[$self->{base}]})";
+}
+
 =head2 DESTROY
 
 When the ClassLoader gets garbage-collected, its entry in @INC needs
@@ -480,7 +487,7 @@
 
 sub DESTROY {
     my $self = shift;
-    @INC = grep {defined $_ and $_ ne $self} @INC;
+    @INC = grep {defined $_ and not (ref $_ and Scalar::Util::refaddr($_) ne Scalar::Util::refaddr($self))} @INC;
 }
 
 =head2 autogenerated PACKAGE


More information about the Jifty-commit mailing list