|
1 | 1 | <!--
|
2 |
| -$PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.47 2005/10/18 22:53:54 adunstan Exp $ |
| 2 | +$PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.48 2005/10/24 15:39:50 adunstan Exp $ |
3 | 3 | -->
|
4 | 4 |
|
5 | 5 | <chapter id="plperl">
|
@@ -554,12 +554,16 @@ $$ LANGUAGE plperl;
|
554 | 554 | system operations are not allowed for security reasons:
|
555 | 555 | <programlisting>
|
556 | 556 | CREATE FUNCTION badfunc() RETURNS integer AS $$
|
557 |
| - open(TEMP, ">/tmp/badfile"); |
558 |
| - print TEMP "Gotcha!\n"; |
| 557 | + my $tmpfile = "/tmp/badfile"; |
| 558 | + open my $fh, '>', $tmpfile |
| 559 | + or elog(ERROR, qq{Could not open the file "$tmpfile": $!}); |
| 560 | + print $fh "Testing writing to a file\n"; |
| 561 | + close $fh or elog(ERROR, qq{Could not close the file "$tmpfile": $!}); |
559 | 562 | return 1;
|
560 | 563 | $$ LANGUAGE plperl;
|
561 | 564 | </programlisting>
|
562 |
| - The creation of the function will succeed, but executing it will not. |
| 565 | +The creation of this function will fail as its use of a forbidden |
| 566 | +operation will be be caught by the validator. |
563 | 567 | </para>
|
564 | 568 |
|
565 | 569 | <para>
|
|