Adjust description of use_strict parameter. Some other minor editorial
authorTom Lane
Wed, 24 Aug 2005 18:56:07 +0000 (18:56 +0000)
committerTom Lane
Wed, 24 Aug 2005 18:56:07 +0000 (18:56 +0000)
cleanup.

doc/src/sgml/plperl.sgml
doc/src/sgml/runtime.sgml

index 2702508880e81088bb2fc58a7d46b59e1277580c..e7cdd2eb3c89b2c0536fccbd24fd74620b3ef5ef 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -46,46 +46,18 @@ $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.43 2005/08/12 21:42:53 momjian E
   
    To create a function in the PL/Perl language, use the standard
    
-   syntax.  A PL/Perl function must always return a scalar value.  You
-   can return more complex structures (arrays, records, and sets) 
-   in the appropriate context by returning a reference.
-   Never return a list.  Here follows an example of a PL/Perl
-   function.
+   syntax:
 
 
 CREATE FUNCTION funcname (argument-types) RETURNS return-type AS $$
     # PL/Perl function body
 $$ LANGUAGE plperl;
 
-   The body of the function is ordinary Perl code.
+   The body of the function is ordinary Perl code. A PL/Perl function must
+   always return a scalar value.  You can return more complex structures
+   (arrays, records, and sets) by returning a reference, as discussed below.
+   Never return a list.
   
-    
-    As with ordinary Perl code, you should use the strict pragma,
-    which you can do in one of two ways:
-
-    
-     
-      
-       Globally, by adding plperl to the list of 
-        linkend="guc-custom-variable-classes"> and setting
-       plperl.use_strict to true in
-       postgresql.conf
-      
-    
-     
-      
-       One function at a time, by using PL/PerlU (you must be database
-       superuser to do this) and including
-
-
-use strict;
-
-
-        in the function body.
-        
-    
-    
-    
 
    
     The syntax of the CREATE FUNCTION command requires
@@ -205,13 +177,13 @@ SELECT * FROM perl_row();
 
   
     PL/Perl functions can also return sets of either scalar or
-    composite types.  In general, you'll want to return rows one at a
-    time both to speed up startup time and to keep from queueing up
+    composite types.  Usually you'll want to return rows one at a
+    time, both to speed up startup time and to keep from queueing up
     the entire result set in memory.  You can do this with
     return_next as illustrated below.  Note that
     after the last return_next, you must put
-    either return; or (better) return
-    undef;
+    either return or (better) return
+    undef.
 
 
 CREATE OR REPLACE FUNCTION perl_set_int(int)
@@ -237,7 +209,7 @@ $$ LANGUAGE plperl;
     contains either scalars, references to arrays, or references to
     hashes for simple types, array types, and composite types,
     respectively.  Here are some simple examples of returning the entire
-    result set as a reference:
+    result set as an array reference:
 
 
 CREATE OR REPLACE FUNCTION perl_set_int(int) RETURNS SETOF INTEGER AS $$
@@ -267,6 +239,27 @@ SELECT * FROM perl_set();
      it is a hazard if you declare a PL/Perl function
      as returning a domain type.
     
+
+  
+   If you wish to use the strict pragma with your code,
+   the easiest way to do so is to SET
+   plperl.use_strict to true.  This parameter affects
+   subsequent compilations of PL/Perl functions, but not
+   functions already compiled in the current session.  To set the
+   parameter before PL/Perl has been loaded, it is
+   necessary to have added plperl to the 
+   linkend="guc-custom-variable-classes"> list in
+   postgresql.conf.
+  
+
+  
+   Another way to use the strict pragma is to just put
+
+use strict;
+
+   in the function body.  But this only works for PL/PerlU
+   functions, since use is not a trusted operation.
+  
  
 
  
index a699e0096b29522e8942a12c2b7ad50fd7142503..320f1bfb8e8038d863e68dbfedb164223a7236c3 100644 (file)
@@ -1,5 +1,5 @@
 
 
 
@@ -4382,10 +4382,10 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
      when using custom variables:
 
 
-custom_variable_classes = 'plr,pljava'
+custom_variable_classes = 'plr,plperl'
 plr.path = '/usr/lib/R'
-pljava.foo = 1
-plruby.bar = true        # generates error, unknown class name
+plperl.use_strict = true
+plruby.use_strict = true        # generates error: unknown class name