Net-IMAP-Simple

 view release on metacpan or  search on metacpan

contrib/hand_test01.pl  view on Meta::CPAN

use strict;
use warnings;
use lib 'inc', "blib/lib", "blib/arch";
use rebuild_iff_necessary;
use slurp_fetchmail;
use Data::Dump qw(dump);

my $imap = slurp_fetchmail->login(use_ssl=>1);

my @c;
for my $box (map {split m/\s+/} (@ARGV ? @ARGV : ("INBOX"))) {
    push @c, {
        selectres => dump($imap->select($box)), 
        box => $imap->current_box, first_unseen=>$imap->unseen, recent=>$imap->recent,
    };
}

warn dump(@c) . "\n";

lib/Net/IMAP/Simple.pm  view on Meta::CPAN

        final => sub {
            if( $fetching ) {
                if( $fetching > 0 ) {
                    # XXX: this is just about the least efficient way in the
                    # world to do this; I should appologize, but really,
                    # nothing in this module is done particularly well.  I
                    # doubt anyone will notice this.

                    local $"="";
                    my $message = "@lines";
                    @lines = split m/(?<=\x0d\x0a)/, substr($message, 0, $fetching)
                        if( length $message > $fetching );
                }
                return  wantarray ? @lines : Net::IMAP::Simple::_message->new(\@lines)
            }

            if( defined $fetching and $fetching == 0 ) {
                return "\n"; # XXX: Your 0 byte message is incorrectly returned as a newline.  Meh.
            }

            # NOTE: There is not supposed to be an error if you ask for a

lib/Net/IMAP/Simple.pm  view on Meta::CPAN

            } elsif( $fetching ) {
                push @lines, join( ' ', @_ );
            }
        },
    );

}

sub _process_flags {
    my $self = shift;
    my @ret = map { split m/\s+/, $_ } grep { $_ } @_;

    return @ret;
}

sub put {
    my ( $self, $mailbox_name, $msg, @flags ) = @_;

    croak "usage: \$imap->put(mailbox, message, \@flags)" unless defined $msg and defined $mailbox_name;

    my $size = length $msg;



( run in 1.217 second using v1.01-cache-2.11-cpan-71847e10f99 )