Skip Menu |

This queue is for tickets about the MailClientYahoo CPAN distribution.

Report information
The Basics
Id: 18411
Status: open
Priority: 0/
Queue: MailClientYahoo

People
Owner: Nobody in particular
Requestors: simonw [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.0
Fixed in: (no value)



Subject: fix some warnings + sending mails no longer works
I had to patch a few things to hush up a couple of warnings with this module. Also, sending of mails through the module no longer works, at least for me. It looks like HTML::Form fails to extract the <button name="send(top|bottom)" ...> from the page for some reason, possibly Javascript related. I'm able to use the module intermittently - it will work for a while and then I'll get ... Select Folder failed on Folder Stats Retrieval: Not Found - trying to get https://edit.yahoo.com/config/Folders?.redir_from=LOGIN&.redir_from=REGISTRATION Not sure if you're even using this any more but I figure it's worth a shot. Simon
Subject: mailclientyahoo.patch
diff -urb MailClientYahoo-1.0/lib/Mail/Client/Yahoo.pm MailClientYahoo-new/lib/Mail/Client/Yahoo.pm --- MailClientYahoo-1.0/lib/Mail/Client/Yahoo.pm 2004-05-11 23:12:31.000000000 +0100 +++ MailClientYahoo-new/lib/Mail/Client/Yahoo.pm 2006-03-28 15:28:40.000000000 +0100 @@ -2,6 +2,7 @@ use 5.006; our $VERSION = 1.0; +use Carp qw(croak); #***** Interface *****# @@ -40,7 +41,7 @@ slogin => 'https://login.yahoo.com/config/login?.src=ym', logout => 'Logout', folders => 'Folders', - box => 'ShowFolder?sort=date&order=up&box=%s', + box => 'ShowFolder?sort=date&order=up&rb=%s', msghead => 'ShowLetter?bodyPart=HEADER&box=%s&MsgId=%s', msgbody => 'ShowLetter?bodyPart=TEXT&box=%s&MsgId=%s', message => 'ShowLetter?box=%s&MsgId=%s', @@ -72,7 +73,7 @@ save_value => 'yes', attach_field => 'ATT', attach_value => '1', - send_button => 'SEND', + send_button => qr/Send/i, send_error => qr/class="errmsg"/i, attach_form => 'Attachments', @@ -130,8 +131,8 @@ $self->{error} = sub { my $msg = $self->{mech}->res->message; $msg = shift()."\n" if $msg =~ /^OK/; - ($args{error} || sub { die @_ })->( - "$self->{phase} failed on $self->{step}: $msg" + ($args{error} || sub { croak @_ })->( + "$self->{phase} failed on $self->{step}: $msg - trying to get ". $self->{mech}->res()->request()->uri ); }; @@ -163,6 +164,8 @@ $mech->get($1); } + + $self->{step} = 'Login'; if($mech->content =~ $Patterns{bad_user}) { $self->error("Invalid username"); @@ -181,7 +184,9 @@ $self->{phase} = 'Logout'; $self->{step} = 'Logout Submission'; + if (defined $self->{mech}) { $self->{mech}->get($URLs{logout}); + } undef $self->{mech}; %$self = (); @@ -193,16 +198,21 @@ sub _fetch_folder_stats { my $self = shift; + $self->{step} = 'Folder Stats Retrieval'; + $self->{mech}->get($URLs{folders}); + #print STDERR $self->{mech}->res()->request()->uri; + my @stats = keys %{$Patterns{folder_stats}}; my @cols = @{$Patterns{folder_stats}}{@stats}; my $te = new HTML::TableExtract(headers => [@cols], keep_html => 1); $te->parse($self->{mech}->content); + foreach my $row ($te->rows) { my %stats; @stats{@stats} = @$row; @@ -226,7 +236,7 @@ my $self = shift; my $name = shift; - return if $name eq $self->{current_folder}; + return if defined $self->{current_folder} && $name eq $self->{current_folder}; $self->{phase} = 'Select Folder'; @@ -427,6 +437,7 @@ $self->{step} = 'Form Retrieval'; $mech->get($URLs{sendmsg}); + if($args{attach}) { $self->{step} = 'Attach Files'; $mech->submit_form( @@ -466,6 +477,11 @@ $cb->value($Patterns{html_value}); } + #die $mech->content; + use Data::Dumper; + #foreach my $f ($mech->forms) { + # print STDERR $f->dump; + # } $mech->submit_form( form_name => $Patterns{send_form}, fields => { @@ -485,9 +501,12 @@ ) : () ), }, - button => $Patterns{send_button}, + #button => $Patterns{send_button}, ); + $mech->click($Patterns{send_button}); + + if($mech->response->as_string() =~ $Patterns{send_error}) { $self->error('Error sending message'); } Only in MailClientYahoo-new: test
Subject: Re: [rt.cpan.org #18411] fix some warnings + sending mails no longer works
Date: Tue, 28 Mar 2006 11:46:05 -0500
To: via RT <bug-MailClientYahoo [...] rt.cpan.org>
From: Cory Johns <johnsca [...] cpan.org>

Dear Simon,

 

Thanks for the feedback.  I haven't had time to do any work on this module for quite some time, as I've been pretty busy with school.  Strangely, I use the module myself every day and haven't noticed any problems with it.  On the other hand, it runs in the background, so it's entirely possible I'm simply not seeing any warnings or errors it might be generating. :)  Oh, and neither do I use the sending mail function.

 

At any rate, I hope to have a bit of time after April to try and get caught up on bug fixes / updates to my CPAN modules, so I will definitely keep your patch handy.  Thanks again.

 

Sincerely,

 

Cory Johns

On Tue, 28 Mar 2006 11:12:49 -0500 (EST), via RT wrote:
>
>�Tue Mar 28 11:12:48 2006: Request 18411 was acted upon.
>�Transaction: Ticket created by SIMONW
>�Queue: MailClientYahoo
>�Subject: fix some warnings + sending mails no longer works Owner:
>�Nobody Requestors: SIMONW@cpan.org Status: new
>�Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=18411 >
>
>
>�I had to patch a few things to hush up a couple of warnings with
>�this module.
>
>�Also, sending of mails through the module no longer works, at least
>�for me. It looks like HTML::Form fails to extract the <button
>�name="send(top|bottom)" ...>�from the page for some reason,
>�possibly Javascript related.
>
>�I'm able to use the module intermittently - it will work for a
>�while and then I'll get ...
>
>�Select Folder failed on Folder Stats Retrieval: Not Found - trying
>�to get
>�https://edit.yahoo.com/config/Folders?.redir_from=LOGIN&amp;.redir_from=RE
>�GISTRATION
>
>�Not sure if you're even using this any more but I figure it's worth
>�a shot.
>
>�Simon