Greg Sabino Mullane wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>
>
>
>>Well, I personally almost always use indirect file handles rather than
>>globals. But I don't know that using globals file handles (which is what
>>I gather you are objecting to) is deprecated, is it? The perl docs are
>>absolutely littered with examples.
>>
>>
>
>No, my primary objection was using open() without checking the result.
>Everything else was icing. :)
>
>
I see. Well, given that it is meant to illustrate something that won't
run, I don't think that matters too much. But there is another error on
that page, where we state that the function will be created but fail to
run. In fact, now that we have a validator, it will not even be created:
andrew=# CREATE FUNCTION badfunc() RETURNS integer AS $$
andrew$# open(TEMP, ">/tmp/badfile");
andrew$# print TEMP "Gotcha!\n";
andrew$# return 1;
andrew$# $$ LANGUAGE plperl;
ERROR: creation of Perl function failed: 'open' trapped by operation
mask at line 2.
andrew=#
I'll make your change and fix the incorrect wording shortly.
cheers
andrew