Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
….. doesn't actually address problem he's having in the ticket.
  • Loading branch information
Paul Miller committed Oct 7, 2013
1 parent 31dd379 commit c8c3415
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -480,6 +480,7 @@ sub noop {

sub top {
my ( $self, $number ) = @_;
my $messages = $number || '1:' . $self->_last;

my @lines;

Expand All @@ -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?
Expand Down
28 changes: 28 additions & 0 deletions t/80_top.t
Original file line number Diff line number Diff line change
@@ -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";

0 comments on commit c8c3415

Please sign in to comment.