#!/usr/bin/perl use MIME::Parser; my $parser = MIME::Parser->new; # Open temp file for both read and write open (TMP, "+> /tmp/copy.txt") or die "Couldn't open copy for write: $!\n"; # Copy the whole thing while (read(STDIN,$buf,8192)) { print TMP $buf; } # Rewind the temp file seek(TMP,0,0) or die "Seek error: $!\n"; # Now create our MIME entity. my $entity = $parser->parse(\*TMP) or die "Couldn't parse: \n"; close(TMP) or die "Error closing temp file: $!\n"; # Done! $entity->dump_skeleton;
In reply to Re: Copy of a filehandle reference
by sgifford
in thread Copy of a filehandle reference
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |