Malformed session key while using Facebook API

Hi,

I am doing some experiments with facebook API and unable to update the status using the API.
My code is as follow as:

use WWW::Facebook::API;
use JSON::Any;

my $query=new CGI;
my $j = JSON::Any->new;
my $api_key="#MY API KEY#";
my $secret="#MY SECRET KEY#";
my $fb = WWW::Facebook::API->new( 
    desktop => 0, 
    api_key => $api_key, 
    secret  => $secret, 
    session_key => $query->cookie($api_key.'_session_key'),
    session_expires => $query->cookie($api_key.'_expires'), 
    session_uid => $query->cookie($api_key.'_user')
);

my $res = $fb->stream->publish( 
    message => 'Test message', 
    attachment => $j->objToJson( 
        { name => 'Foo bar baz', 
          href => 'http://www.google.com/', 
          description => "this is a thing" 
       } ), 
    action_links =>  $j->objToJson( 
      [ { text => 'action link text', 
          href => 'http://www.foobar.com/' 
      } ] ) 
);

In the original code, i replaced with original api and secret keys .
But i am receiving the below error an di don't have any clue how to fix this.

Odd number of elements in hash assignment at C:/Dwimperl/perl/site/lib/WWW/Facebook/API.pm line 164.
Error during REST stream.publish call:
params = 
    action_links:[{"href":"http://www.foobar.com/","text":"action link text"}]
    api_key:#api_key#
    attachment:{"href":"http://www.google.com/","name":"Foo bar baz","description":"this is a thing"}
    format:JSON
    message:Test message
    method:facebook.stream.publish
    session_key:session_expires
    v:1.0
response =
{"error_code":102,"error_msg":"Session key is malformed.","request_args":[{"key":"action_links","value":"[{\"href\":\"http:\/\/www.foobar.com\/\",\"text\":\"action link text\"}]"},{"key":"api_key","value":"#api_key#"},{"key":"attachment","value":"{\"href\":\"http:\/\/www.google.com\/\",\"name\":\"Foo bar baz\",\"description\":\"this is a thing\"}"},{"key":"format","value":"JSON"},{"key":"message","value":"Test message"},{"key":"method","value":"facebook.stream.publish"},{"key":"session_key","value":"session_expires"},{"key":"v","value":"1.0"},{"key":"sig","value":"fa1423663792249368fd00e9f102b992"}]}

Any thoughts on this.

Thanks in Advance!

--Pandeesh

Which line is C:/Dwimperl/perl/site/lib/WWW/Facebook/API.pm line 164 ?

Maybe one of the parameters is missing, The odd hash says to me that a routine expecting "key, payload" pairs of arguments to put in a hash mapped container did not get pairs = even number. A hash mapped container looks up payload by key, and the key is hashed into an integer that is mod the bucket count to pick the bucket to search. For instance if key 'DGPickett' hashed to 123456 and there were 1000 buckets, the key and corresponding payload gets stored in bucket 456 for efficient random access. The key is rechecked on fetch, in case the bucket has someone else in it, too or only.