[Rt-commit] r5269 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri May 19 18:52:42 EDT 2006


Author: ruz
Date: Fri May 19 18:52:41 2006
New Revision: 5269

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm

Log:
 r3100 at cubic-pc:  cubic | 2006-05-20 02:56:50 +0400
 * Get in any context were returning empty list for unexistant options,
   so code like foo( opt2 => RT->Config->Get('not_exist'), opt2 => 'val')
   may fail terribly or generate warning.


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm	Fri May 19 18:52:41 2006
@@ -264,7 +264,12 @@
     my $self = shift;
     my $name = shift;
     my $user = shift;
-    return unless exists $OPTIONS{ $name };
+    unless ( exists $OPTIONS{ $name } ) {
+        # if don't know anything about option
+        # return empty list, but undef in scalar
+        # context
+        return wantarray? (): undef;
+    }
 
     my $res;
     if ( $user && $META{ $name }->{'Overridable'} ) {


More information about the Rt-commit mailing list