perl-google-voice icon indicating copy to clipboard operation
perl-google-voice copied to clipboard

Module Not working x/post from Cpan RT

Open yougotborked opened this issue 11 years ago • 2 comments

Installed and tried running the example and got back the following:

Can't call method "send_sms" on an undefined value at test.pl line 7. 

I double checked my credentials and even tried a different account, then debugged the code and it crapped out at Voice.pm line 50

 $el = $c->get('https://www.google.com/voice#inbox') ->res->dom->at('input[name="_rnr_se"]');

It looked like $el was undefined so it returned. Unfortunately, I am not familiar enough with Mojo to work with it further, but I was hoping you'd be able to help. Also, URL '' https://www.google.com/voice/b/0/sms/send' on line 68 throws a 403 if I try to connect to it manually, not sure if that matters...

yougotborked avatar Nov 17 '13 04:11 yougotborked

I got a similar error. To fix it, I had to install a version of IO::Socket::SSL greater than 1.75. Otherwise, the Mojo UA can't login to the Google account. Without a valid login, the subsequent get requests will return undef.

After upgrading IO::Socket::SSL, The $c->get() calls weren't working because Voice.pm module and the Feed.pm module call an attrs() method of Mojo::DOM objects. Mojo::DOM has no attrs() method. The Mojo::DOM Changes file makes note of this:

4.50 2013-10-22

  • Removed deprecated attrs method from Mojo::DOM.

So, a call like this:

my $el = $c->get('https://accounts.google.com/ServiceLogin')->res->dom->at('input[name="GALX"]');

will return undef. Mojo::DOM does have an attr() method and this is what should be used. To fix this, I edited Voice.pm and Feed.pm to call attr() rather than attrs().

From there, the sample code for sending an SMS worked for me. This should be a straightforward fix for the maintainers in the next release.

charleslarry avatar Dec 31 '13 19:12 charleslarry

Cool - submit a pull request, and I’ll add it to the repo.

On Dec 31, 2013, at 12:34 PM, charleslarry [email protected] wrote:

I got a similar error. To fix it, I had to install a version of IO::Socket::SSL greater than 1.75. Otherwise, the Mojo UA can't login to the Google account. Without a valid login, the subsequent get requests will return undef.

After upgrading IO::Socket::SSL, The $c->get() calls weren't working because Voice.pm module and the Feed.pm module call an attrs() method of Mojo::DOM objects. Mojo::DOM has no attrs() method. So, at('input[name=...]') returns undef. Mojo::DOM does have an attr() method and this is what should be used. To fix this, I edited Voice.pm and Feed.pm to call attr() rather than attrs().

From there, the sample code for sending an SMS worked for me.

— Reply to this email directly or view it on GitHub.

tempire avatar Dec 31 '13 20:12 tempire