I'm not sure I follow your suggestion fully though.
As I said, I'm trying to pre-check some XML before I let XML::Parser do its magic.
my $parser = XML::Parser->new( Handlers => { Start => \&s_start, End => \&s_end, Final => \&s_final, } ); my %device_info = $parser->parse($fh);
It's the call to parse with a parameter of $fh that I'm not sure how to change. I need to peek inside $fh beforehand and set up different parser handler routines, depending on what I see. If I sneak a look before calling the parser, the first few lines of XML are lost and it dies with a malformed error, which is fair enough.
So, I need to remember the first 5 or so lines (no problem) and then somehow insert these in the front of the file that parse is going to read? But I don't understand how ...
Thanks
In reply to Re^2: Can I seek in a command's piped output?
by wardy3
in thread Can I seek in a command's piped output?
by wardy3
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |