Hello fellow monks, I'm writing a script to handle e-mail input. Thre are basically two parts to my script. One part is a loop, like this:
until ($FromAddress =~ /From/i) { $FromAddress = <STDIN> }
This part gets me a 'From' address that I can use to search a database of authorized users. Then, some time later, I do this:
my $parser = new MIME::Parser; my $entity = $parser->parse(\*STDIN) or debug_parser();
Now, the problem is this. When I take a message in a text file and pipe it to my script, everything works just fine. However, when I pipe it from a mail server alias, the MIME::Parser never gets any data. The From: checker gets the data fine. To check the alias, I changed it to pipe to the command "cat - > some.file". The entire message, including MIME data, was found in some.file. In fact, when I turned around and did "cat some.file | perl MyCommand.pl", everything worked fine! But no matter what I do, nothing ever gets to the Mime Parser. I can tell this by examining the directory that Mime::Parser creates: the message text is 0 bytes and no attachments get detached. I know this is not a file permission error because, when I change file permissions so that the output directory is not writeable, I get a bounce message from my mail server. I'm using PostFix. Anyone know what might be going on? Thanks, SM

In reply to Odd MIME::Parser STDIN behavior by SpritusMaximus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.