|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.74 2010/01/20 03:37:10 rhaas Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.75 2010/01/26 23:11:56 adunstan Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="plperl">
|
4 | 4 | <title>PL/Perl - Perl Procedural Language</title>
|
@@ -285,29 +285,39 @@ SELECT * FROM perl_set();
|
285 | 285 | </para>
|
286 | 286 |
|
287 | 287 | <para>
|
288 |
| - If you wish to use the <literal>strict</> pragma with your code, |
289 |
| - the easiest way to do so is to <command>SET</> |
290 |
| - <literal>plperl.use_strict</literal> to true. This parameter affects |
291 |
| - subsequent compilations of <application>PL/Perl</> functions, but not |
292 |
| - functions already compiled in the current session. To set the |
293 |
| - parameter before <application>PL/Perl</> has been loaded, it is |
294 |
| - necessary to have added <quote><literal>plperl</></> to the <xref |
295 |
| - linkend="guc-custom-variable-classes"> list in |
296 |
| - <filename>postgresql.conf</filename>. |
| 288 | + If you wish to use the <literal>strict</> pragma with your code you have a few options. |
| 289 | + For temporary global use you can <command>SET</> <literal>plperl.use_strict</literal> |
| 290 | + to true (see <xref linkend="plperl.use_strict">). |
| 291 | + This will affect subsequent compilations of <application>PL/Perl</> |
| 292 | + functions, but not functions already compiled in the current session. |
| 293 | + For permanent global use you can set <literal>plperl.use_strict</literal> |
| 294 | + to true in the <filename>postgresql.conf</filename> file. |
297 | 295 | </para>
|
298 | 296 |
|
299 | 297 | <para>
|
300 |
| - Another way to use the <literal>strict</> pragma is to put: |
| 298 | + For permanent use in specific functions you can simply put: |
301 | 299 | <programlisting>
|
302 | 300 | use strict;
|
303 | 301 | </programlisting>
|
304 |
| - in the function body. But this only works in <application>PL/PerlU</> |
305 |
| - functions, since the <literal>use</> triggers a <literal>require</> |
306 |
| - which is not a trusted operation. In |
307 |
| - <application>PL/Perl</> functions you can instead do: |
308 |
| -<programlisting> |
309 |
| -BEGIN { strict->import(); } |
310 |
| -</programlisting> |
| 302 | + at the top of the function body. |
| 303 | + </para> |
| 304 | + |
| 305 | + <para> |
| 306 | + The <literal>feature</> pragma is also available to <function>use</> if your Perl is version 5.10.0 or higher. |
| 307 | + </para> |
| 308 | + |
| 309 | + </sect1> |
| 310 | + |
| 311 | + <sect1 id="plperl-data"> |
| 312 | + <title>Data Values in PL/Perl</title> |
| 313 | + |
| 314 | + <para> |
| 315 | + The argument values supplied to a PL/Perl function's code are |
| 316 | + simply the input arguments converted to text form (just as if they |
| 317 | + had been displayed by a <command>SELECT</command> statement). |
| 318 | + Conversely, the <function>return</function> and <function>return_next</function> |
| 319 | + commands will accept any string that is acceptable input format |
| 320 | + for the function's declared return type. |
311 | 321 | </para>
|
312 | 322 | </sect1>
|
313 | 323 |
|
@@ -682,18 +692,6 @@ SELECT done();
|
682 | 692 | </sect2>
|
683 | 693 | </sect1>
|
684 | 694 |
|
685 |
| - <sect1 id="plperl-data"> |
686 |
| - <title>Data Values in PL/Perl</title> |
687 |
| - |
688 |
| - <para> |
689 |
| - The argument values supplied to a PL/Perl function's code are |
690 |
| - simply the input arguments converted to text form (just as if they |
691 |
| - had been displayed by a <command>SELECT</command> statement). |
692 |
| - Conversely, the <literal>return</> command will accept any string |
693 |
| - that is acceptable input format for the function's declared return |
694 |
| - type. So, within the PL/Perl function, |
695 |
| - all values are just text strings. |
696 |
| - </para> |
697 | 695 | </sect1>
|
698 | 696 |
|
699 | 697 | <sect1 id="plperl-global">
|
@@ -1042,8 +1040,7 @@ CREATE TRIGGER test_valid_id_trig
|
1042 | 1040 | <itemizedlist>
|
1043 | 1041 | <listitem>
|
1044 | 1042 | <para>
|
1045 |
| - PL/Perl functions cannot call each other directly (because they |
1046 |
| - are anonymous subroutines inside Perl). |
| 1043 | + PL/Perl functions cannot call each other directly. |
1047 | 1044 | </para>
|
1048 | 1045 | </listitem>
|
1049 | 1046 |
|
@@ -1072,6 +1069,8 @@ CREATE TRIGGER test_valid_id_trig
|
1072 | 1069 | </listitem>
|
1073 | 1070 | </itemizedlist>
|
1074 | 1071 | </para>
|
| 1072 | + </sect2> |
| 1073 | + |
1075 | 1074 | </sect1>
|
1076 | 1075 |
|
1077 | 1076 | </chapter>
|
0 commit comments