Revision: 75
Author:   matt
Date:     2006-08-11 20:40:00 +0000 (Fri, 11 Aug 2006)

Log Message:
-----------
Fix a memory leak caused by using List::Util::first.

Modified Paths:
--------------
    trunk/lib/AxKit2/Config/Server.pm

Modified: trunk/lib/AxKit2/Config/Server.pm
===================================================================
--- trunk/lib/AxKit2/Config/Server.pm   2006-08-09 22:27:54 UTC (rev 74)
+++ trunk/lib/AxKit2/Config/Server.pm   2006-08-11 20:40:00 UTC (rev 75)
@@ -81,18 +81,17 @@
     push @{$self->{Locations}}, shift;
 }
 
-use List::Util qw(first);
 # given a path, find the config related to it
 # sometimes this is a Location config, sometimes Server (i.e. $self)
 sub get_config {
     my $self = shift;
     my $path = shift;
     
-    # note using first() with reverse() implies last(),
-    # but List::Util has no last() function
-    my $ret = first { $_->matches($path) } reverse @{$self->{Locations}};
+    for my $loc (reverse @{$self->{Locations}}) {
+        return $loc if $loc->matches($path);
+    }
     
-    return $ret || $self;
+    return $self;
 }
 
 sub notes {
@@ -105,4 +104,4 @@
                    $self->global->notes($key);
 }
 
-1;
\ No newline at end of file
+1;


Reply via email to