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

ruz at bestpractical.com ruz at bestpractical.com
Thu Apr 19 09:48:11 EDT 2007


Author: ruz
Date: Thu Apr 19 09:48:10 2007
New Revision: 7566

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

Log:
 r4989 at cubic-pc:  cubic | 2007-04-19 17:45:10 +0400
 * update RT->Config->{Get,Set}'s POD


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	Thu Apr 19 09:48:10 2007
@@ -290,6 +290,23 @@
 
 Takes name of the option as argument and returns its current value.
 
+Returns different things in scalar and array contexts. For scalar
+options it's not that important, however for arrays and hash it's.
+In scalar context returns references to arrays and hashes.
+
+Use C<scalar> perl's op to force context, especially when you use
+C<(..., Argument => RT->Config->Get('ArrayOpt'), ...)>
+as perl's '=>' op doesn't change context of the right hand argument to
+scalar. Instead use C<(..., Argument => scalar RT->Config->Get('ArrayOpt'), ...)>.
+
+It's also important for options that have no default value(no default
+in F<etc/RT_Config.pm>). If you don't force scalar context then you'll
+get empty list and all your named args will be messed up. For example
+C<(arg1 => 1, arg2 => RT->Config->Get('OptionDoesNotExist'), arg3 => 3)>
+will result in C<(arg1 => 1, arg2 => 'arg3', 3)> what is most probably
+unexpected, or C<(arg1 => 1, arg2 => RT->Config->Get('ArrayOption'), arg3 => 3)>
+will result in C<(arg1 => 1, arg2 => 'element of option', 'another_one' => ..., 'arg3', 3)>.
+
 =cut
 
 sub Get
@@ -324,8 +341,11 @@
 
 =head2 Set
 
-Takes two arguments: name of the option and new value.
-Set option's value to new value.
+Set option's value to new value. Takes name of the option and new value.
+
+The new value should scalar, array or hash depending on type of the option.
+If the option is not defined in meta or the default RT config then it is of
+sclar type.
 
 =cut
 


More information about the Rt-commit mailing list