[Catalyst-commits] r10373 - Catalyst-Runtime/5.80/branches/component-tweaks/lib/Catalyst

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Fri May 29 22:25:35 GMT 2009


Author: caelum
Date: 2009-05-29 22:25:35 +0000 (Fri, 29 May 2009)
New Revision: 10373

Modified:
   Catalyst-Runtime/5.80/branches/component-tweaks/lib/Catalyst/Component.pm
Log:
minor Component::BUILDARGS improvements

Modified: Catalyst-Runtime/5.80/branches/component-tweaks/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/component-tweaks/lib/Catalyst/Component.pm	2009-05-29 19:25:54 UTC (rev 10372)
+++ Catalyst-Runtime/5.80/branches/component-tweaks/lib/Catalyst/Component.pm	2009-05-29 22:25:35 UTC (rev 10373)
@@ -64,8 +64,11 @@
 sub BUILDARGS {
     my $class = shift;
 
-    if (@_ == 1 && ref($_[0]) eq 'HASH') {
-        return $_[0];
+    if (@_ == 1) {
+        if (ref($_[0]) eq 'HASH') {
+            return $_[0];
+        }
+        return {};
     } elsif (@_ == 2) { # is it ($app, $args) or foo => 'bar' ?
         if (blessed($_[0]) ||
            (Class::MOP::is_class_loaded($_[0]) && $_[0]->isa('Catalyst'))) {
@@ -77,7 +80,7 @@
         return +{ @_ };
     }
 
-    croak "invalid parameters";
+    return {};
 }
 
 sub COMPONENT {




More information about the Catalyst-commits mailing list