semifor / net-twitter-lite

A lighter weight (non-Moose) Perl interface to the Twitter API
Other
26 stars 11 forks source link

DIE Can't locate Net/OAuth/V1_0A/ProtectedResourceRequest.pm in @INC #11

Closed f055 closed 6 years ago

f055 commented 11 years ago

I get this error message sometimes, it's weird because it doesn't interfere with Net::Twitter::Lite operation (meaning it still executes fine the Twitter methods, I just find this in my error logs). Any idea why would it do that?

nigelhorne commented 9 years ago

I have the same problem. Any fix on the way?

semifor commented 9 years ago

I don't think this is a Net::Twitter::Lite bug. IIRC, this is due to an environment problem. Perhaps PERL5LIB differs at runtime from what it did when Net::Titter::Lite was installed, so it's getting backleveled dependencies.

Please check @INC at runtime and ensure you have the Net::OAuth version you expect (should be >= 0.25).

If you find it's an environment problem, please leaves some details here to help the next person who encounters it.

I we find it's a Net::Twitter::Lite issue, I'll happily fix it and release an updated version. So far, I haven't been able to reproduce it, though. Happy to help track it down, too. Can you dump @INC and %INC where the error is encountered?

nigelhorne commented 9 years ago

Hope this is what you're after. Please let me know if you need anything else.

%ENV: PERL5LIB="/home/hornenj/perlmods/lib/perl/5.14:/home/hornenj/perlmods/lib/perl/5.14.2:/home/hornenj/perlmods/share/perl/5.14:/home/hornenj/perlmods/share/perl/5.14.2:/home/hornenj/perlmods/lib/perl5" @INC: /home/hornenj/perlmods/lib/perl/5.14 /home/hornenj/perlmods/lib/perl/5.14.2 /home/hornenj/perlmods/share/perl/5.14 /home/hornenj/perlmods/share/perl/5.14.2 /home/hornenj/perlmods/lib/perl5/x86_64-linux-gnu-thread-multi /home/hornenj/perlmods/lib/perl5 /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .

nigelhorne commented 9 years ago

Also, Net::OAuth is version 0.28.

semifor commented 9 years ago

What about %INC? That should show us where it's finding Net::OAuth. I suspect there's a different version on one of the paths in PERL5LIB.

nigelhorne commented 9 years ago

There are three OAuth.pm's on the system. Which is used? They are different.

[ps395777]$ ls -l locate OAuth.pm -r--r--r-- 1 root root 14763 Apr 15 06:10 /usr/local/share/perl/5.14.2/Net/OAuth.pm -rw-r--r-- 1 root root 1807 Sep 28 2011 /usr/share/perl5/Net/Twitter/OAuth.pm -rw-r--r-- 1 root root 14879 Sep 28 2011 /usr/share/perl5/Net/Twitter/Role/OAuth.pm [ps395777]$

semifor commented 9 years ago

Those are three different modules.

The first is Net::OAuth. It seems to be the source of the problem, somehow. It's used by Net::Twitter and Net::Twitter::Lite to provide OAuth protocol support.

The second is part of the Net::Twitter distribution. It provides backwards compatibility for an older distribution that predated Net::Twitter's OAuth capability. Unless you have use Net::Twitter::OAuth in your code, you're not using it. You shouldn't be using it if you are.

The last is Net::Twitter::Role::OAuth. It's part of the Net::Twitter distribution and gets applied when you include OAuth in the list of traits to Net::Twitter's constructor. It uses Net::OAuth.

Are you using Net::Twitter or Net::Twitter::Lite?

The Net::OAuth distribution contains many files. To see exactly what's being used, you need to inspect %INC at the point the error is raised.

Can you provide a small example program that demonstrates the error? Just replace consumer_key, consumer_secret, access_token, and access_token_secret with bogus values if they're included in the code.

nigelhorne commented 9 years ago

It is Net::Twitter::Lite::WithAPIv1_1.

There are two ProtectedResourcesRequest files:

/usr/local/share/perl/5.14.2/Net/OAuth/ProtectedResourceRequest.pm /usr/share/perl5/Net/OAuth/ProtectedResourceRequest.pm

Both are in %INC so why aren't they found?

semifor commented 9 years ago

From a message you shared earlier, Net::OAuth is going to be found in /usr/share/perl5. You likely want the version in /usr/local/share/perl5/5.14.2. Find where PERL5LIB is getting set, and change the order of include paths so your locally installed modules are found first.

That's likely going to be in .bashrc, .profile, etc.

This really isn't, as far as I can tell, a Net::Twitter::Lite, problem. You might find better (or at least faster) help on IRC (irc.perl.org) in channel #perl-help getting your PERL5LIB correctly configured.

@INC:
/home/hornenj/perlmods/lib/perl/5.14
/home/hornenj/perlmods/lib/perl/5.14.2
/home/hornenj/perlmods/share/perl/5.14
/home/hornenj/perlmods/share/perl/5.14.2
/home/hornenj/perlmods/lib/perl5/x86_64-linux-gnu-thread-multi
==> /home/hornenj/perlmods/lib/perl5
/etc/perl
/usr/local/lib/perl/5.14.2
==> /usr/local/share/perl/5.14.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.14
/usr/share/perl/5.14
/usr/local/lib/site_perl
nigelhorne commented 9 years ago

But I do have a version in /usr/local/share/perl/5.14.2:

[ps395777]$ ls -l /usr/local/share/perl/5.14.2/Net/OAuth/ProtectedResourceRequest.pm -r--r--r-- 1 root root 681 Apr 15 06:10 /usr/local/share/perl/5.14.2/Net/OAuth/ProtectedResourceRequest.pm [ps395777]$

semifor commented 9 years ago

The way your environment is configured, I think it will find the one in /home/hornenj/perlmods/lib/perl5 first, and use that instead of the one in /usr/local/share/perl/5.14.2.

nigelhorne commented 9 years ago

Looks like this is also reported in https://rt.cpan.org/Public/Bug/Display.html?id=85598

semifor commented 6 years ago

I haven't seen any reports of this in ages. I'm going to assume it has either been fixed in Net::OAuth or it was due to broken environments.