Skip Menu |

This queue is for tickets about the Net-OAuth2 CPAN distribution.

Report information
The Basics
Id: 102307
Status: resolved
Priority: 0/
Queue: Net-OAuth2

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

Bug Information
Severity: Normal
Broken in: 0.61
Fixed in: (no value)



Subject: unknown method host_port
I'm using this code to attempt to access Google Calendar: my $auth = Net::OAuth2::Profile::WebServer->new( name => 'Google Calendar', client_id => $foo, client_secret => $bar, scope => 'https://www.googleapis.com/auth/calendar.readonly', ); Now, it's true that I may need extra options, Google is a quagmire of security through obscurity, but I am surprised that I get this error. Something is clearly up because URI does have a method host_port. Can't locate object method "host_port" via package "URI::_generic" at /Users/hornenj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/OAuth2/Profile.pm line 197 (#1) (F) You called a method correctly, and it correctly indicated a package functioning as a class, but that package doesn't define that particular method, nor does any of its base classes. See perlobj. Uncaught exception from user code: Can't locate object method "host_port" via package "URI::_generic" at /Users/hornenj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/OAuth2/Profile.pm line 197. at /Users/hornenj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/OAuth2/Profile.pm line 197. Net::OAuth2::Profile::build_request(Net::OAuth2::Profile::WebServer=HASH(0x7f9e7300b318), "POST", URI::_generic=SCALAR(0x7f9e73197178), HASH(0x7f9e74029590)) called at /Users/hornenj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/OAuth2/Profile/WebServer.pm line 159 Net::OAuth2::Profile::WebServer::build_request(Net::OAuth2::Profile::WebServer=HASH(0x7f9e7300b318), "POST", URI::_generic=SCALAR(0x7f9e73197178), HASH(0x7f9e74029590)) called at /Users/hornenj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/OAuth2/Profile/WebServer.pm line 83 Net::OAuth2::Profile::WebServer::get_access_token(Net::OAuth2::Profile::WebServer=HASH(0x7f9e7300b318), "gcal") called at ./gcal line 25
Subject: Re: [rt.cpan.org #102307] unknown method host_port
Date: Tue, 24 Feb 2015 00:44:14 +0100
To: Nigel Horne via RT <bug-Net-OAuth2 [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Nigel Horne via RT (bug-Net-OAuth2@rt.cpan.org) [150223 23:07]: Show quoted text
> I'm using this code to attempt to access Google Calendar: > > my $auth = Net::OAuth2::Profile::WebServer->new( > name => 'Google Calendar', > client_id => $foo, > client_secret => $bar, > scope => 'https://www.googleapis.com/auth/calendar.readonly', > ); > Can't locate object method "host_port" via package "URI::_generic" at
Show quoted text
> Net::OAuth2::Profile::WebServer::build_request(Net::OAuth2::Profile::WebServer=HASH(0x7f9e7300b318), "POST", URI::_generic=SCALAR(0x7f9e73197178), HASH(0x7f9e74029590)) called at /Users/hornenj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Net/OAuth2/Profile/WebServer.pm line 83
I think I have seen this before. Somewhere you have to specify a URI but pass in something else. From the trace, it seems to be the access_token_url which is wrong. Not set? When the URI is not a http* uri, then it does have a host_port method. If this is not enough answer for you, I'll need to try to remember how it all worked ;-) -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
I hope you have found the solution by now.