Posted on 2005-04-14 16:37:32-07 by perlplexed
Debug output
I successfully installed the mail-webmail-gmail module, make test says it passed. I copied the examples from the readme and ran them. I get no errors, but it doesn't seems like I'm actually logged into my account. There are no messages printed, no labels found, I can't send a message. So my question is: Is there any way to turn on debug messages that can tell me if I've successfully logged into the account? Should I assume since no errors were printed that I am indeed logged in?

Any help would be appriciated.

I case anyone cares I'm running Redhat 8.0 on a i686 athlon perl version 5.8.0 mail-webmail-gmail version 1.01 (and the latest modules it depends on) I'm behind a router without a proxy.

-Brian
Direct Responses: 1411 | Write a response
Posted on 2005-11-27 04:29:14-08 by labmaster in response to 339
Re: Debug output
I tried the sample scripts and got the same behavior. There seems to be a login problem, but I am not sure why. I am on XP. I take a look at the error before proceeding and there is error content.
---output---- Error: Could not login with those credentials Additionally, HTTP error: 200 OK Error: Could not Login. ---end output--- ---my script------ #!c:\perl\bin\perl -w # Perl script that logs in to Gmail, retrieves the user defined labels # Then prints out all new messages under the first label use Mail::Webmail::Gmail; my $gmail = Mail::Webmail::Gmail->new( username => 'username', password => 'mypassword', ); my @labels = $gmail->get_labels(); if ( $gmail->error() ) { print $gmail->error_msg(); } ---end script-----
Direct Responses: 1437 | Write a response
Posted on 2005-12-02 23:40:36-08 by karl in response to 1411
Re: Debug output

I tried to debug this a little myself. It looks like Gmail changed things around a bit.

I was able to get the login to work by first changing the LOGIN_URL in the module to this:

our $LOGIN_URL = "https://www.google.com/accounts/ServiceLoginAuth?service=mail&rm=false&continue=h +ttp://mail.google.com/mail/";

And then changing some of the code in the login() sub from:

if ( $res->is_success() ) { update_tokens( $self, $res ); if ( $res->content() =~ /top.location = "(.*?)";/ ) { $req = HTTP::Request->new( GET => "https://www.google.com/accounts/$1" ); $req->header( 'Cookie' => $self->{_cookie} ); $res = $self->{_ua}->request( $req ); if ( $res->content() =~ /location.replace\("(.*?)"\)/ ) { update_tokens( $self, $res ); $req = HTTP::Request->new( GET => $1 ); $req->header( 'Cookie' => $self->{_cookie} ); $res = $self->{_ua}->request( $req ); if ( $res->content() =~ /<script src="(.*?)">/ ) {

to:

if ($res->code == 302) { update_tokens( $self, $res ); my $checkcookie_url = $res->header('Location'); if ($checkcookie_url =~ /CheckCookie/) { $req = HTTP::Request->new( GET => $checkcookie_url ); $req->header( 'Cookie' => $self->{_cookie} ); $res = $self->{_ua}->request( $req ); if ( $res->content() =~ /location.replace\("(.*?)"\)/ ) { update_tokens( $self, $res ); $req = HTTP::Request->new( GET => $1 ); $req->header( 'Cookie' => $self->{_cookie} ); $res = $self->{_ua}->request( $req ); if ( $res->content() =~ /<script type=text\/javascript src="(.*?)">/ ) {

But even then, it seems like more of the functions are broken.

Perhaps Allen is already looking into things, but if I come up with any more patches, I'll post them here.

--Karl.

Direct Responses: 1442 | 2059 | Write a response
Posted on 2005-12-05 16:32:01-08 by sarojkmohapatra in response to 1437
Re: Debug output
Except login other features are broken......... I was using it till spetember...... Seems gmail havae changed few things........
Direct Responses: Write a response
Posted on 2006-03-29 07:07:56-08 by np in response to 1437
Re: Debug output
I encountered the same Debug message on Gmail.pm version 1.03. Then I upgraded to the latest version of Gmail module [1.05]. Now the output message is different. it looks something like this msgid = 10a44c14153bca65 Any solution?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.