GMail-Checker
view release on metacpan or search on metacpan
package GMail::Checker;
# Perl interface for a gmail wrapper
# Allows you to check new mails, retrieving new mails and information about them
# $Id: Checker.pm,v 1.04 2004/12/13 22:52:17 sacred Exp $
use strict;
use IO::Socket::SSL;
use Carp;
use vars qw($VERSION);
$VERSION = 1.04;
sub version { sprintf("%f", $VERSION); }
sub new {
my $self = {};
my $proto = shift;
my $size = shift;
$size /= 1024;
my $unit = "Kbytes";
($size, $unit) = ($size/1024, "Mbytes") if (($size / 1024) > 1) ;
return ($size, $unit);
}
sub login {
my $self = shift;
my ($login, $passwd) = @_;
my $not = new IO::Socket::SSL "pop.gmail.com:995" or die IO::Socket::SSL->errstr();
$self->{SOCK} = $not;
my $line = <$not>; # Reading the welcome message
print $not "USER $login\r\n";
$line = <$not>;
if ($line !~ /^\+OK/) { print "Wrong username, please check your settings.\n"; $self->close(); } # We are not allowing USER on transaction state.
print $not "PASS $passwd\r\n";
$line = <$not>;
if ($line !~ /^\+OK/) { print "Wrong password, please check your settings.\n"; $self->close(); } # Same as above for PASS.
$self->{USERNAME} = $login;
$self->{PASSWORD} = $passwd;
The implemented methods are :
=over 4
=item C<new>
Creates the wrapper object.
The L<IO::Socket::SSL> object is stored as $object->{SOCK}.
It currently only accepts username and password as hash options.
=over 4
=item C<USERNAME>
Your GMail account username (without @gmail.com).
=item C<PASSWORD>
- Search through mails body and headers
- Include mail storing/reading option
- Headers regexp argument for headers retrieval
- Correct bugs ?
=head1 SEE ALSO
L<IO::Socket::SSL>, L<WWW::GMail>
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: GMail-Checker
version: 1.04
version_from: Checker.pm
installdirs: site
license: perl
requires:
IO::Socket::SSL: 0
distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17
Makefile.PL view on Meta::CPAN
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'GMail::Checker',
'VERSION_FROM' => 'Checker.pm',
'PREREQ_PM' => {
'IO::Socket::SSL' => 0,
},
);
( run in 0.547 second using v1.01-cache-2.11-cpan-4d50c553e7e )