in reply to Re: Can I seek in a command's piped output?
in thread Can I seek in a command's piped output?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Can I seek in a command's piped output?
by fullermd (Vicar) on Feb 12, 2009 at 11:35 UTC | |
by ikegami (Patriarch) on Feb 12, 2009 at 16:01 UTC | |
by wardy3 (Scribe) on Feb 16, 2009 at 00:26 UTC | |
|
Re^3: Can I seek in a command's piped output?
by graff (Chancellor) on Feb 12, 2009 at 15:18 UTC |