From: Dave Rolsky <autarch@urth.org>
Date: Tue, 21 Oct 2008 19:40:22 +0000 (+0000)
Subject: More code cleanup for load_first_existing_class()
X-Git-Tag: 0.68~7
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f280f05c6aad8a20f4e70869d497149632b91f53;p=gitmo%2FClass-MOP.git

More code cleanup for load_first_existing_class()

If we didn't find a class, an exception was thrown.
---

diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm
index 5f9be08..5ed98a6 100644
--- a/lib/Class/MOP.pm
+++ b/lib/Class/MOP.pm
@@ -101,7 +101,8 @@ sub _load_pure_perl {
 }
 
 sub load_first_existing_class {
-    my @classes = @_;
+    my @classes = @_
+        or return;
 
     foreach my $class (@classes) {
         unless ( _is_valid_class_name($class) ) {
@@ -124,9 +125,8 @@ sub load_first_existing_class {
         }
     }
 
-    if ($found) {
-        return get_metaclass_by_name($found) || $found;
-    }
+    return get_metaclass_by_name($found) || $found
+        if $found;
 
     confess join(
         "\n",
@@ -136,7 +136,7 @@ sub load_first_existing_class {
                 $exceptions{$_}
                 )
             } @classes
-    ) if keys %exceptions;
+    );
 }
 
 sub _try_load_one_class {