Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############################################################
- #### BASTARD::IMAP
- #### v1.00
- #### (C)2009 Warbucks Heavy Industries, LLC
- ############################################################
- package BASTARD::IMAP;
- our $VERSION = '1.00';
- use MooseX::AttributeHelpers;
- use Net::IMAP::Simple;
- with qw(
- MooseX::LogDispatch::Levels
- );
- has logger => (
- metaclass => 'NoGetopt',
- isa => 'Log::Dispatch::Config',
- is => 'rw',
- lazy_build => 1,
- );
- has _servername => (
- isa => 'Str',
- is => 'ro',
- default => sub { 'imap.gmail.com' },
- );
- has username => (
- isa => 'Str',
- is => 'ro',
- );
- has password => (
- isa => 'Str',
- is => 'ro',
- );
- has unread => (
- isa => 'Int',
- is => 'ro',
- default => sub { 0 },
- );
- has _imap => (
- isa => 'Net::IMAP::Simple',
- is => 'rw',
- accessor => 'imap',
- lazy_build => 1,
- );
- sub _build__imap {
- my ($self) = @_;
- my $i = Net::IMAP::Simple->new($self->_servername);
- $i->login($self->user, $self->pass);
- $self->unread = $i->select('INBOX');
- return $i
- }
- 1; # End of BASTARD:IMAP
Add Comment
Please, Sign In to add comment