School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,119 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,964 people online right now. Registration is fast and FREE... Join Now!




Need some help with IO::Scalar and piping data

 

Need some help with IO::Scalar and piping data

jakev383

25 Sep, 2009 - 11:04 AM
Post #1

New D.I.C Head
*

Joined: 27 May, 2008
Posts: 37


My Contributions
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:
CODE

# 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:
CODE

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_line_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?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 01:39PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month