[Boulder.pm] Weird bug in glob
Rob Nagler
nagler at bivio.biz
Wed Mar 26 14:53:28 PDT 2008
The attached program dies at "bug here" on 5.8. glob() behaves
differently depending on whether it is called in a function or not.
It appears to be storing state on a per-function basis but not based
on the pattern, which makes the code pretty weird to debug.
Rob
----------------------------------------------------------------
sub _t {
open(OUT, "> " . shift(@_));
close(OUT);
}
_t('1.rjn');
_t('2.rjn');
my $x = glob('*.rjn');
$x eq '1.rjn' || die;
$x = glob('*.rjn');
$x eq '1.rjn' || die;
sub _f {
return glob('*.rjn');
}
$x = _f();
$x eq '1.rjn' || die;
$x = _f();
$x eq '1.rjn' || die('bug here');
More information about the Boulder-pm
mailing list