I am working on a perl script that will login to gmail, and display on my unread email
I have the login part working flawlessly, and I have found out how the emails are distinguished.
In the HTML of gmail, the only difference between an unread mail and a read mail is that <tr> it is in has a different bgcolor
since unread mail is grouped together I thought starting at the 'unread' mail color background and matching up to the 'read' mail background color would be slick, no dice
So I guess the only line I am having issues with is this:
CODE
my @test = $output =~ m|\Q(<tr bgcolor="#ffffff">.*)<tr bgcolor="#E8EEF7">\E|g;
for some reason this does not match everything start with the bgcolor or 'unread' and going to 'read'
Thanks in advance
CODE
#!/usr/bin/perl
##Use##
use strict;
use WWW::Mechanize;
##Declarations##
my $url = "http://gmail.com";
my $outfile = 'gm-out.html';
my $mech = WWW::Mechanize->new(autocheck =>1);
##Let the code Begin##
open(OUTFILE, ">$outfile" );
$mech->get($url );
##################Login##########################
$mech->form_number(1); #
$mech->field('Email', 'MYUSERNAME'); #
$mech->field('Passwd', 'MYPASSWORD'); #
$mech->click(); #
$mech->follow_link( n=>1 ); #
#################################################
#the last line follows the auto re-direct
my $output = $mech->content();
#my $test = $te->parse( $output );
my @test = $output =~ m|\Q(<tr bgcolor="#ffffff">.*)<tr bgcolor="#E8EEF7">\E|g;
foreach my $test (@test)
{
print OUTFILE $test;
}
close OUTFILE;