I am trying to write an "email checker" and perform some checks against the message being sent. I'm getting hung up on getting the message into Mail::DKIM::verifier though. Here is the loading part of my script:
# slurp the email from STDIN my( $raw ); { local $/ = undef; local *FILE; open FILE, "-"; $raw = <FILE>; close +FILE } defined( $raw ) or die( "Nothing read from STDIN!\n" ); # Create an IO::Handle for Mail::DKIM::Verifier to read message from my( $raw_iohandle ) = new IO::Scalar( \$raw ); # Read from the IO::Handle my( $mail ) = load Mail::DKIM::Verifier->new(); $mail->load( \$raw_iohandle ); $mail->CLOSE; # Import message to Email::Simple my( $incoming ) = Email::Simple->new( \$raw );
And I get this error:
Use_of_uninitialized_value_in_<HANDLE>_at_/usr/lib/perl5/site_perl/5.8 +.8/Mail/DKIM/Common.pm_line_87./readline()_on_unopened_filehandle_at_ +/usr/lib/perl5/site_perl/5.8.8/Mail/DKIM/Common.pm_line_87./Can't_use +_string_("Mail::DKIM::Verifier")_as_a_HASH_ref_while_"strict_refs"_in +_use_at_/usr/lib/perl5/site_perl/5.8.8/Mail/DKIM/MessageParser.pm_lin +e_88./
It's almost painfully obvious that I am trying to get the message into $mail incorrectly, but I do not see what I am doing wrong. Can someone show (and explain!) what I am doing wrong?

In reply to Help with IO::Scalar and piping by jakev383

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.