Please help me fix this.

When I run it, I get the following message:

Can't call method "select" on an undefined value at ./fof_imap1.pl line 12.

Thank you
_____________

Program:

#!/opt/local/bin/perl
use lib "/home/william/.cpan/build/Mail-IMAPClient-2.2.9/blib/lib";
use Mail::IMAPClient;
$imaphost="mymailserver.co.uk";

$login="myname"; $pass="mypassword";

my $imap = Mail::IMAPClient->new( Server => $imaphost,
              User   => $login,
              Password=> $pass,
              Uid => 1,    # optional
);
   $imap->select("smut");
   for my $h (
    # grab the Subject and Date from every message in my (fictional!) smut
folder;
    # the first argument is a reference to an array listing all messages in
the folder
    # (which is what gets returned by the $imap->search("ALL") method when
called in
    # scalar context) and the remaining arguments are the fields to parse
out
    # The key is the message number, which in this case we don't care
about:
    values %{$imap->parse_headers( scalar($imap->search("ALL")) ,
"Subject", "Date")}
   ) {
      # $h is the value of each element in the hash ref returned from
parse_headers,
      # and $h is also a reference to a hash.
      # We'll only print the first occurance of each field because we don't
expect more
      # than one Date: or Subject: line per message.
       print map { "$_:\t$h->{$_}[0]\n"} keys %$h ;
   }

__________________

William Ampeh (x3939)
Federal Reserve Board


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to