http://www.perlmonks.org?node_id=1017809

ultranerds has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm trying to get Net::Twitter to work in my admin backend. Basically (with permission) it will post on users twitter feeds when they add a listing. I have this:
use Net::Twitter; my $nt = Net::Twitter->new( traits => [qw/OAuth API::REST/], consumer_key => 'aaaaa', consumer_secret => 'xxxxx', access_token => $user->{tw_token}, access_token_secret => $user->{tw_token_secret}, ); my $result; eval { $result = $nt->update('Hello, world!'); }; if ( my $err = $@ ) { die $@; warn "HTTP Response Code: ", $err->code, "\n", "HTTP Message......: ", $err->message, "\n", "Twitter error.....: ", $err->error, "\n"; }
When I run it, I get:

<p><font face='Tahoma,Arial,Helvetica' size=2>A fatal error has occured:</font></p><blockquote><pre></pre></blockquote><p><font face='Tahoma,Arial,Helvetica' size=2>Please enable debugging in setup for more details.</font></p>

Which is of no use what-so-ever :( I know the key/secrets are ok, as I'm using those to login with. Anyone got any ideas? I've googled on the subject - but didn't come up with anything.

TIA

Andy

Replies are listed 'Best First'.
Re: Net::Twitter - fatal , but no error?
by tobyink (Canon) on Feb 08, 2013 at 13:22 UTC

    The key and secret are not a Twitter username+password combo; they are an OAuth pair, and will be different from what you'd use to log into the Twitter website with your browser.

    PS: have you tried enabling debugging in setup perchance?

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
      Thanks - I'm actually using the OAuth key/secret :) (not what I use to login on the twitter website itself)

      >>PS: have you tried enabling debugging in setup perchance?<<

      In Net::Twitter? I can't see anything about enabling debug on the Cpan POD?

      TIA!

      Andy

        I assume the message about debugging was coming from some sort of web interface that is wrapping your code - your "admin backend"?

        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name