But, I also want to keep a copy of the email exactly as it came in, before MIME::Parser does it's thing. However,my $input = \*STDIN; my $entity = $parser->parse($input);
works fine for keeping the copy, but then there is nothing left for MIME::Parser to parse it seems. If I reverse the order, and parse it first, then there is nothing to print in my copy file.I gues STDIN is only good for one read? I tried makeing a copy of the reference, likemy $input = \*STDIN; my @copy = <$input>; open(COPY, ">copy.txt"); print COPY @copy; close COPY; my $entity = $parser->parse($input);
but that just makes another reference to the same data address I guess (which makes a lot of sense), because it is still only good for one read. I triedmy $input = \*STDIN; my $copy = $input;
Which seems to make sense, but now MIME::Parse doesn't parse the $copy. If I print $copy; instead, I see that $copy does indeed contain a copy of the file, but I can't figure out why MIME::Parse will only parse it if it is the original. Anybody have any ideas?my $input = \*STDIN; my @copy = <$input>; open (TMP, ">/tmp/copy.txt"); print TMP @copy; close(TMP); open($copy, "</tmp/copy.txt"); my $entity = $parser->parse($copy);
In reply to Copy of a filehandle reference by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |