in reply to Re: (XML::Parser) Finding and fixing a bug
in thread (XML::Parser) Finding and fixing a bug
my $config = $parser->parse('CONFIG');
But that would better be checked with something like ref(\$arg) eq 'GLOB'.my $config = $parser->parse(*CONFIG);
But... XML::Parser::Expat::parse allows strings to be used. In your try, it'll try to use XML::Parser::Expat::CONFIG. Things change if your symbolic reference contains :::
It is unlikely that someone uses a string constant there, but it COULD be some $foo that is the result of whatever, which could in turn be some stringified version of *CONFIG. *CONFIG stringifies to *main::CONFIG, and with that * there it still works:my $config = $parser->parse('main::CONFIG');
my $config = $parser->parse('*main::CONFIG');
I didn't want to break (stupid) code like this:
sub something_that_stringifies { "$_[0]" } my $fh = something_that_stringifies *CONFIG; my $config = $parser->parse($fh);
Juerd
- http://juerd.nl/
- spamcollector_perlmonks@juerd.nl (do not use).
|
|---|