funkymonky has asked for the wisdom of the Perl Monks concerning the following question: (mail and news)

the following method selects a folder $imap->select($folder) When I trace the response from the server, it looks like this:
000E SELECT "INBOX" * FLAGS (\Answered \Flagged \Draft \Deleted \Seen) * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] * 3 EXISTS * 0 RECENT * OK [UIDVALIDITY 1030359672] * OK [UIDNEXT 191] 000E OK [READ-WRITE] Completed
Now I want to use this in my program. The function returns a hash reference so I do the following:

This command works perfectly, but the PROBLEM is it does not contain the server response.
QUESTION: How do I extract the server response?

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: select function from Mail::IMAPClient
by jlongino (Parson) on Oct 19, 2002 at 17:11 UTC
    You probably want to use the Results method (without argument) to obtain the server response from the last IMAP client command issued:
    use strict; use warnings; use Mail::IMAPClient; use Data::Dumper; my $host = ''; my $id = 'login'; my $pw = 'password'; my $folder = "/somepath/tomail/folder"; my $imap = Mail::IMAPClient->new( Server => $host, User => $id, Password => $pw, Debug => 1, ) or die "Cannot connect to $host as $id: $@"; $imap->select($folder); my @results1 = $imap->Results; my @status = $imap->status($folder); my @results2 = $imap->Results; my $uidnext = $imap->uidnext($folder); my @results3 = $imap->Results; print Dumper(\@results1, \@status, \@results2, $uidnext, \@results3);