Skip Menu |

This queue is for tickets about the WWW-Facebook-API CPAN distribution.

Report information
The Basics
Id: 27270
Status: resolved
Priority: 0/
Queue: WWW-Facebook-API

People
Owner: Nobody in particular
Requestors: olaf [...] wundersolutions.com
Cc:
AdminCc:

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



Subject: cannot get example to work
Hi! I'm using the "facebook" script in the "examples" folder. After I fill in the values at the command line, I get the following error (I've replaced the auth_token with a placeholder): Attribute (secret) is required, so cannot be set to undef at (eval 80) line 1 WWW::Facebook::API::Base::secret('WWW::Facebook::API::Simple=HASH(0x87ac754)', 'undef') called at /usr/local/share/perl/5.8.7/WWW/Facebook/API/Auth.pm line 50 WWW::Facebook::API::Auth::get_session('WWW::Facebook::API::Auth=HASH(0x877d198)', 'auth_token', 'XXXXXX') called at facebook line 13 perl -v This is perl, v5.8.7 built for i486-linux-gnu-thread-multi Copyright 1987-2005, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. Linux 2.6.12-9-386 #1 Mon Oct 10 13:14:36 BST 2005 i686 GNU/Linux I'm using the latest version of WWW-Facebook-API This looks really cool, so let me know if there's anything else you may need from me. Olaf
Hi Olaf, On Thu May 24 00:47:09 2007, OALDERS wrote: Show quoted text
> I'm using the "facebook" script in the "examples" folder. After I > fill > in the values at the command line, I get the following error (I've > replaced the auth_token with a placeholder): > > Attribute (secret) is required, so cannot be set to undef at (eval 80) > line 1 > >
WWW::Facebook::API::Base::secret('WWW::Facebook::API::Simple=HASH(0x87ac754)', Show quoted text
> 'undef') called at > /usr/local/share/perl/5.8.7/WWW/Facebook/API/Auth.pm > line 50 > >
WWW::Facebook::API::Auth::get_session('WWW::Facebook::API::Auth=HASH(0x877d198)', Show quoted text
> 'auth_token', 'XXXXXX') called at facebook line 13
Although I haven't been able to create a test case for the bug, I know what the problem is. An error was returned by the server and wasn't being caught. The latest version (0.1.0) should confess before that step now, and spit out the error returned from the server. Thanks for the feedback!
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Mon, 28 May 2007 18:31:26 -0400
To: bug-WWW-Facebook-API [...] rt.cpan.org
From: Olaf Alders <olaf [...] wundersolutions.com>
On 28-May-07, at 10:55 AM, David Romano via RT wrote: Show quoted text
> > Although I haven't been able to create a test case for the bug, I know > what the problem is. An error was returned by the server and wasn't > being caught. The latest version (0.1.0) should confess before that > step > now, and spit out the error returned from the server. Thanks for the > feedback!
I just upgraded and I still get the same error. However, if I comment the following lines in get_session: $self->base->secret( $xml->{auth_getSession_response}->[0]->{secret}->[0] ); then it works and I can get a list of friends etc. I've dumped auth_getSession_response and the secret is not being returned, but it's already saved in $self anyway, so I'm not sure why it's being set as part of get_session.: 'auth_getSession_response' => [ { 'session_key' => [ 'xxx' ], 'xmlns' => 'http:// api.facebook.com/1.0/', 'uid' => [ 'xxx' ], 'xsi:schemaLocation' => 'http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd', 'session_uid' => [], 'xmlns:xsi' => 'http:// www.w3.org/2001/XMLSchema-instance', 'session_expires' => [], 'expires' => [ '1180477453' ] } ] Hope this is helpful? Best, Olaf -- Olaf Alders olaf@wundersolutions.com http://www.wundersolutions.com
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Mon, 28 May 2007 15:50:11 -0700
To: Olaf Alders via RT <bug-WWW-Facebook-API [...] rt.cpan.org>
From: David Romano <unobe [...] cpan.org>
Olaf Alders via RT wrote on Mon, May 28, 2007 at 03:32:55PM PDT: Show quoted text
> I just upgraded and I still get the same error. However, if I > comment the following lines in get_session: > > $self->base->secret( > $xml->{auth_getSession_response}->[0]->{secret}->[0] > ); > > then it works and I can get a list of friends etc.
This needs to be set when you're using a desktop app per the Facebook API documentation (search for "the secret returned by getSession" at http://developers.facebook.com/documentation.php?v=1.0&doc=auth ). Is your developer key for a web app? Show quoted text
> I've dumped auth_getSession_response and the secret is not being > returned, but it's already saved in $self anyway, so I'm not sure why > it's being set as part of get_session.
The authentication guide says it should be changed for subsequent calls when using a desktop app. The dump shows that a session_key isn't being returned, yet your subsequent calls still work. In short, I think the way to fix this in the example is just to set the 'desktop' parameter to 0 when calling WWW::Facebook::API->new. - David -- "You will find that the State is the kind of organization which, though it does big things badly, does small things badly, too." -- John Kenneth Galbraith
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Mon, 28 May 2007 19:03:34 -0400
To: bug-WWW-Facebook-API [...] rt.cpan.org
From: Olaf Alders <olaf [...] wundersolutions.com>
On 28-May-07, at 6:50 PM, unobe@cpan.org via RT wrote: Show quoted text
> The authentication guide says it should be changed for subsequent > calls when using a desktop app. The dump shows that a session_key > isn't > being returned, yet your subsequent calls still work. In short, I > think > the way to fix this in the example is just to set the 'desktop' > parameter to 0 when calling WWW::Facebook::API->new. > > - David
Ok. That works for me. As far as the example goes, when printing a quote, I get: Random one: HASH(0x8a35bf4) I tried this: my $rand = int rand scalar @quotes; print "Random one:\t".$quotes[$rand]."\n"; That printed out the actual quote. As far as tests go, it would be helpful to have some tests that run based on your own config info. Those tests could be skipped if you're missing a file like "facebook.cfg", so that end users who don't want to do extra testing don't have to deal with it. Grant set something like this up for WWW::Myspace and it was really helpful. I'm not sure what you're planning as far as tests go, but I need to write some before I go live with Facebook stuff anyway. If it helps, I could send you some quick tests when I get a chance to write them. Olaf -- Olaf Alders olaf@wundersolutions.com http://www.wundersolutions.com
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Mon, 28 May 2007 19:13:19 -0400
To: bug-WWW-Facebook-API [...] rt.cpan.org
From: Olaf Alders <olaf [...] wundersolutions.com>
On 28-May-07, at 6:50 PM, unobe@cpan.org via RT wrote: Show quoted text
> The authentication guide says it should be changed for subsequent > calls when using a desktop app. The dump shows that a session_key > isn't > being returned, yet your subsequent calls still work. In short, I > think > the way to fix this in the example is just to set the 'desktop' > parameter to 0 when calling WWW::Facebook::API->new. > > - David
In my Facebook account the "Application Type" is set to "Website" rather than "Desktop". That would explain why no secret is being returned by the API. :) Olaf -- Olaf Alders olaf@wundersolutions.com http://www.wundersolutions.com
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Mon, 28 May 2007 16:32:44 -0700
To: Olaf Alders via RT <bug-WWW-Facebook-API [...] rt.cpan.org>
From: David Romano <unobe [...] cpan.org>
Hi Olaf, Olaf Alders via RT wrote on Mon, May 28, 2007 at 04:04:12PM PDT: Show quoted text
> Ok. That works for me.
Great! :-) Show quoted text
> As far as the example goes, when printing a quote, I get: > > Random one: HASH(0x8a35bf4) > > I tried this: > my $rand = int rand scalar @quotes; > print "Random one:\t".$quotes[$rand]."\n"; > > That printed out the actual quote.
Hmm, that construct has the same meaning as the one I already have in place, just more verbose. Since it returned a hash reference, I think it is still returning an element of @quotes, and so something isn't wrong with the index (i.e., int rand @quotes). Did you try the original style multiple times, or just once? If it truly is a problem, could you use Dumper to show me @quotes right before the print statement? I find it hard to believe that int rand @quotes is different than int rand scalar @quotes. Show quoted text
> As far as tests go, it would be helpful to have some tests that run > based on your own config info. Those tests could be skipped if > you're missing a file like "facebook.cfg", so that end users who > don't want to do extra testing don't have to deal with it. Grant set > something like this up for WWW::Myspace and it was really helpful. > I'm not sure what you're planning as far as tests go, but I need to > write some before I go live with Facebook stuff anyway. If it helps, > I could send you some quick tests when I get a chance to write them.
I've been wanting to really beef up the tests more, but haven't. The .cfg idea sounds really good, and I remember seeing that in WWW::MySpace. As for writing tests, that's always helpful :-) Thanks again for the feedback: I really appreciate it, - David -- "If I were two-faced, would I be wearing this one?" -- Abraham Lincoln
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Mon, 28 May 2007 23:55:33 -0400
To: bug-WWW-Facebook-API [...] rt.cpan.org
From: Olaf Alders <olaf [...] wundersolutions.com>
On 28-May-07, at 7:33 PM, unobe@cpan.org via RT wrote: Show quoted text
> Hmm, that construct has the same meaning as the one I already have in > place, just more verbose. Since it returned a hash reference, I think > it is still returning an element of @quotes, and so something isn't > wrong with the index (i.e., int rand @quotes). Did you try the > original > style multiple times, or just once? If it truly is a problem, could > you > use Dumper to show me @quotes right before the print statement? I find > it hard to believe that int rand @quotes is different than int rand > scalar @quotes.
You know, you're right. When I run it a few times, sometimes I get a quote and sometimes I don't. Some of the list elements are actually hash references, so a random element won't always return a quote. I'll copy the dumped structure at the end of this email. Show quoted text
>
>> As far as tests go, it would be helpful to have some tests that run >> based on your own config info. Those tests could be skipped if >> you're missing a file like "facebook.cfg", so that end users who >> don't want to do extra testing don't have to deal with it. Grant set >> something like this up for WWW::Myspace and it was really helpful. >> I'm not sure what you're planning as far as tests go, but I need to >> write some before I go live with Facebook stuff anyway. If it helps, >> I could send you some quick tests when I get a chance to write them.
> I've been wanting to really beef up the tests more, but haven't. The > .cfg idea sounds really good, and I remember seeing that in > WWW::MySpace. As for writing tests, that's always helpful :-)
Cool! I appreciate you being so responsive with this. That has been really helpful. I'll put some tests together over the next week or so and get those to you. If you want me to email those to you directly rather than via RT, just send me a message directly with an address that I should use. Best, Olaf -- Olaf Alders olaf@wundersolutions.com http://www.wundersolutions.com
Subject: Re: [rt.cpan.org #27270] cannot get example to work
Date: Tue, 29 May 2007 00:34:54 -0400
To: bug-WWW-Facebook-API [...] rt.cpan.org
From: Olaf Alders <olaf [...] wundersolutions.com>
Forgot to attach the dump of @quotes: $VAR1 = [ '"Go big or go home"', { 'xsi:nil' => 'true' }, {}, 'I put my pants just like everyone else - one leg at a time. Except that, once my pants are on, I make gold records. Lois: You\'re drunk again. Peter: No, I\'m just exhausted \'cause I\'ve been up all night drinking. (While playing Pacman at the bar) Matt: Get, get the fruit. It\'s more points. Get the fruit. Barry: I\'m not gonna get the fruit. Matt: Get the fruit. Barry: I\'m not gonna... I can\'t get the fruit. Matt: Get the fruit. Barry: I\'m not gonna... I\'m not gonna get the fruit there\'s a ghost right there! OK, I stole that last one. But could you imagine? I mean really, just imagine that. Remember Harbor Boulevard The dreaming days where the mess was made Look how all the kids have grown We have changed but we\'re still the same After all that we\'ve been through I know we\'re cool ', { 'xsi:nil' => 'true' }, {}, '"Minds are like parachutes. They only function when they are open." "Experience is something you don\'t get until just after you need it" "Outside of a dog, a book is man\'s best friend. Inside of a dog, it \'s too dark to read."', '"If it\'s too loud, yer to old"', { 'xsi:nil' => 'true' }, {}, {}, { 'xsi:nil' => 'true' }, {}, { 'xsi:nil' => 'true' }, {}, { 'xsi:nil' => 'true' }, {}, '"When caught between two evils I generally pick the one I \'ve never tried before" Mae West "Fashions fade style is eternal" Yves St. Laurent ', { 'xsi:nil' => 'true' }, { 'xsi:nil' => 'true' }, {}, { 'xsi:nil' => 'true' }, {}, '"Things get worse and worse. They never get better." - Kurt Vonnegut "The only difference between George W. Bush and Adolph Hitler is that Hitler was actually elected. You know that, don\'t you?" - Kurt Vonnegut "Millions of innocent men, women, and children, since the introduction of Christianity, have been burnt, tortured, fined, and imprisoned; yet we have not advanced one inch toward uniformity. What has been the effect of coercion? To make one-half the world fools and the other half hypocrites." - Thomas Jefferson in Notes on Virginia "What difference does it make to the dead, the orphans, and the homeless, whether the mad destruction is brought under the name of totalitarianism or the holy name of liberty and democracy?" - Mahatma Gandhi "When the missionaries came to Africa, they had the Bible and we had the land. They taught us to pray with our eyes closed. When we opened them, we had the Bible in our hand, and they had the land." - Jomo Kenyatta, Kenyan independence leader and first president "Workers of all countries unite. You have nothing to lose but your chains." - Karl Marx / Friedrich Engels "The strength of us all could demolish the wall, but you chose to walk through the door." - Ex-Teenage Rebel, Subhumans "Look. I said a whole bunch of stuff about charity, caring for the poor and the weak and loving your fellow humans, and I said nothing about Janet Jackson\'s nipple, gay marriage, stem cell research or your birthright to the world\'s resources. Quit obfuscating my message as the thin edge of the advancing wedge of behaviour control and religious fascism." - Jesus (a paraphrase, naturally.) ', {}, { 'xsi:nil' => 'true' }, '"I saw two shooting stars last night, so I wished on them, but they were only satellites" "A few harmless flakes working together can unleash an avalanche of destruction" "What\'s the big f**kin\' deal bitch?" - Eric Cartman ', '"This shouldn\'t hurt a bit","I think it stopped bleeding... oh maybe not". "What\'s the number for 911?"', "\"The quickest way to end a war is to lose it.\" ~ George Orwell \"When we say 'War is over if you want it,' we mean that if everyone demanded peace instead of another TV set, we'd have peace.\x{201d} ~ John Lennon ", 'Nihilism is best done by professionals. -- Iggy Pop', { 'xsi:nil' => 'true' }, 'If You\'re Not On the Edge, Then You\'re Taking Up Too Much Room.', {}, 'Better to be a big part of a small wheel than a small part of a big wheel. Not so much a quote as an answer, and the answer is 42. ', 'Who you are is based on your experiences not by the amount of melanin you produce. Common sense is NOT common', { 'xsi:nil' => 'true' }, {}, { 'xsi:nil' => 'true' }, {}, {}, { 'xsi:nil' => 'true' }, 'C\'est la vie!', '"This, however, I know full well, namely if all men should carry their own private troubles to market for barter with their neighbors, there would not be a single one who, when he had looked into the troubles of other men, would not be glad to carry home again what he had brought." Herodotus, 7.152. "If women are expected to do the same work as men, we must teach them the same things." Plato "Freedom of will is given to everyone. If they wish to follow the right path and become righteous, they have the ability to do so. If they wish to follow the path of wrong and become wicked, they have the ability to do so as well." - Moses Ben Maimonides "Every day you may make progress. Every step may be fruitful. Yet there will stretch out before you an ever-lengthening, ever- ascending, ever-improving path. You know you will never get to the end of the journey. But this, so far from discouraging, only adds to the joy and glory of the climb." Sir Winston Churchill ', {}, {}, 'Mr. Hoover, president of Delta house? One point six; four C\'s and an F. A fine example you set! Daniel Simpson Day... HAS no grade point average. All courses incomplete. Mr. Blu - MR. BLUTARSKY... ZERO POINT ZERO. Fat, drunk and stupid is no way to go through life, son. ', {}, {}, '"Do, or Do Not. There is no Try" - Yoda', { 'xsi:nil' => 'true' }, '"catch me if you can",Shake and Bake,If you ain\'t first your last!!to finish first,first you must finish,Second place is the first Loser.Let\'s go racing boyz', { 'xsi:nil' => 'true' }, {}, {} ]; Random one: HASH(0x8a2e818) -- Olaf Alders olaf@wundersolutions.com http://www.wundersolutions.com
fixed in 0.1.4