[Rt-commit] [svn] r1247 - in rt: . branches/3.3-TESTING/lib/RT

autrijus at pallas.eruditorum.org autrijus at pallas.eruditorum.org
Wed Jul 14 15:24:24 EDT 2004


Author: autrijus
Date: Wed Jul 14 15:24:23 2004
New Revision: 1247

Modified:
   rt/   (props changed)
   rt/branches/3.3-TESTING/lib/RT/StyleGuide.pod
Log:
 ----------------------------------------------------------------------
 r6050 at not:  autrijus | 2004-07-14T19:21:34.616159Z
 
 * Add style guide information about parameter passing style.
 ----------------------------------------------------------------------


Modified: rt/branches/3.3-TESTING/lib/RT/StyleGuide.pod
==============================================================================
--- rt/branches/3.3-TESTING/lib/RT/StyleGuide.pod	(original)
+++ rt/branches/3.3-TESTING/lib/RT/StyleGuide.pod	Wed Jul 14 15:24:23 2004
@@ -239,7 +239,27 @@
         my $var1 = shift;                       # right
         my $var2 = shift;                       
 
+=head2 Method parameters
 
+If a method takes exactly one mandatory argument, the argument should be
+passed in a straightforward manner:
+
+        my $self = shift;
+        my $id = shift;
+
+In all other cases, the method needs to take named parameters, usually
+using a C<%args> hash to store them:
+
+        my $self = shift;
+        my %args = ( Name => undef,
+                     Description => undef,
+                     @_ );
+
+You may specify defaults to those named parameters instead of using
+C<undef> above, as long as it is documented as such.
+
+It is worth noting that the existing RT codebase had not followed this
+style perfectly; we are trying to fix it without breaking exsiting APIs.
 
 =head2 Tests
 


More information about the Rt-commit mailing list