Skip Menu |

This queue is for tickets about the Net-IMAP-Simple CPAN distribution.

Report information
The Basics
Id: 125334
Status: resolved
Priority: 0/
Queue: Net-IMAP-Simple

People
Owner: jettero [...] cpan.org
Requestors: kurt [...] otown.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.2211



Subject: UID question/bug
Date: Thu, 17 May 2018 02:23:16 -0400
To: bug-Net-IMAP-Simple [...] rt.cpan.org
From: Kurt <kurt [...] otown.com>
I modified the example as follows: Show quoted text
> for(my $i = 1; $i <= $nm; $i++){ > if($imap->seen($i)){ > print "*"; > } else { > print " "; > } > my $es = Email::Simple->new(join '', @{ $imap->top($i) } ); > print $es->header('Delivery-date'); > my $uid = $imap->uid("$i"); > print qq{\t$i:$uid\n}; > } > $imap->quit;
Gives the output: *Fri, 20 Oct 2017 23:12:49 -0400 1:1 *Sun, 05 Nov 2017 14:52:59 -0500 2:1 *Sun, 31 Dec 2017 17:28:18 -0500 3:1 *Sun, 31 Dec 2017 17:30:09 -0500 4:1 *Sat, 20 Jan 2018 19:42:42 -0500 5:1 *Sun, 21 Jan 2018 00:34:43 -0500 6:1 *Sun, 18 Feb 2018 00:17:27 -0500 7:1 *Sun, 18 Feb 2018 10:17:21 -0500 8:1 *Mon, 19 Mar 2018 06:00:12 -0400 9:1 *Mon, 26 Mar 2018 11:59:26 -0400 10:1 *Mon, 26 Mar 2018 11:59:32 -0400 11:1 *Thu, 05 Apr 2018 11:59:27 -0400 12:1 *Fri, 06 Apr 2018 11:59:41 -0400 13:1 Not clear why the UID is always 1? Is the UID DERIVED from the message? Or simply assigned during a session? Basically, I’m deleting emails based on age, but since I don’t know how the order of messages is determined (age? size? randomly?) does deleting one change the positions of others in the sequence? It appears that deleting a message only marks a message for deletion, and that the actual deletion only takes place at the END of the session, and that the sequence of messages doesn’t change in between (unless “expunged”?) and that such automatically happens at the end of a session (and if that’s all true, then maybe I don’t even need the UID) - but I’m not sure. Any help would be appreciated. Thanks. Kurt
On Thu May 17 03:28:51 2018, Kurta wrote: Show quoted text
> my $uid = $imap->uid("$i");
The docs indicate this should work, but it really can't. under uid() is a uidsearch, and under that is a search, and that always returns a list or the size of the list in scalar context. If you used my ($uid) = $imap->uid("$i"); you'd be all set. I'll have to fix the docs to reflect this as there's no practical way to fix search so that it returns the first uid match and a one off fix to the uid sub feels like it doesn't make sense.
Subject: Re: [rt.cpan.org #125334] UID question/bug
Date: Thu, 17 May 2018 21:47:08 -0400
To: bug-Net-IMAP-Simple [...] rt.cpan.org
From: Kurt <kurt [...] otown.com>
Show quoted text
> On May 17, 2018, at 11:57, Paul Miller via RT <bug-Net-IMAP-Simple@rt.cpan.org> wrote: > > If you used my ($uid) = $imap->uid("$i"); you'd be all set.
Ah-HA! That does it! Thanks for the help. Kurt