Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

attempt to fix https://rt.cpan.org/Public/Bug/Display.html?id=89296 .…

….. doesn't actually address problem he's having in the ticket.
  • Loading branch information...
commit c8c3415eec92c7c52b967aea5450a58f8671c08e 1 parent 31dd379
Paul Miller authored
Showing with 38 additions and 4 deletions.
  1. +3 −0  Changes
  2. +1 −0  MANIFEST
  3. +6 −4 Simple.pm
  4. +28 −0 t/80_top.t
View
3  Changes
@@ -1,3 +1,6 @@
+1.2203: Mon Oct 07 2013
+ - https://rt.cpan.org/Public/Bug/Display.html?id=89296
+
1.2202: Wed Oct 02 2013
- really minor pod fix
https://rt.cpan.org/Public/Bug/Display.html?id=89195
View
1  MANIFEST
@@ -37,6 +37,7 @@ t/55_uid_stuff.t
t/60_fetch_with_grammar.t
t/70_list2range.t
t/75_back_and_forth.t
+t/80_top.t
t/critic.t
t/pod.t
t/pod_coverage.t
View
10 Simple.pm
@@ -9,7 +9,7 @@ use IO::Socket;
use IO::Select;
use Net::IMAP::Simple::PipeSocket;
-our $VERSION = "1.2202";
+our $VERSION = "1.2203";
BEGIN {
# I'd really rather the pause/cpan indexers miss this "package"
@@ -480,6 +480,7 @@ sub noop {
sub top {
my ( $self, $number ) = @_;
+ my $messages = $number || '1:' . $self->_last;
my @lines;
@@ -496,12 +497,13 @@ sub top {
## rfc2822 ## sections 3 and 4 of this standard.
return $self->_process_cmd(
- cmd => [ FETCH => qq[$number RFC822.HEADER] ],
+ cmd => [ FETCH => qq[$messages RFC822.HEADER] ],
final => sub {
- $lines[-1] =~ s/\)\x0d\x0a\z//; # sometimes we get this and I don't think we should
+ $lines[-1] =~ s/\)\x0d\x0a\z// # sometimes we get this and I don't think we should
# I really hoping I'm not breaking someting by doing this.
+ if @lines;
- \@lines
+ return wantarray ? @lines : \@lines
},
process => sub {
return if $_[0] =~ m/\*\s+\d+\s+FETCH/i; # should this really be case insensitive?
View
28 t/80_top.t
@@ -0,0 +1,28 @@
+BEGIN { unless( $ENV{I_PROMISE_TO_TEST_SINGLE_THREADED} ) { print "1..1\nok 1\n"; exit 0; } }
+
+use strict;
+use warnings;
+
+use Test;
+use Net::IMAP::Simple;
+
+plan tests => our $tests = 1;
+
+our $imap;
+
+sub run_tests {
+ $imap->create_mailbox("blarg");
+ my $n = $imap->select("blarg");
+ $imap->delete("1:$n");
+ $imap->expunge_mailbox;
+
+ $imap->select("blarg");
+ $imap->put( blarg => "Subject: test$_\n\ntest$_" ) for 1..2;
+
+ my @r = $imap->top;
+ my @a = "@r" =~ m/(test\d+)/g;
+
+ ok( "@a", "test1 test2" );
+}
+
+do "t/test_runner.pm";
Please sign in to comment.
Something went wrong with that request. Please try again.