On 4/24/00 10:06 AM, Randal L. Schwartz wrote:
>> "Matt" == Matt Sergeant <[EMAIL PROTECTED]> writes:
>>
>> So do I have to use gensym(), or not?
>
> As long as you are aware of the package in which the symbol ends up, I
> can't see how it'd matter. And nobody uses string indirect
> filehandles ($x = 'FH'; print $x 'hello') these days, we'd hope.
I ran into a gensym()-related snag while trying to be cute by doing:
my $fh = do { local *FH };
in a mod_perl content handler. It worked fine 90% of the time,
but it eventually broke, causing $fh to be undefined. This would
usually happen after an hour or so of use. I didn't bother chasing
it down, though. I just switched to gensym(). This was with perl
5.005_03 and mod_perl 1.2x, BTW. In 5.6.x you can just do this, IIRC:
my $fh;
open($fh, ...)
which does The Right Thing as far as name clashes goes, does it not?
-John