帮帮我,我正在使用以下perl脚本通过metaweblogAPI over XMLRPC在我的wordpress博客中创建一个新的帖子,并使用自定义字段,但是似乎自定义字段存在问题。只有第二个自定义字段(width)似乎被发布了。无法正确发布“height”。当我添加另一个字段时,我会收到“匿名哈希中的元素数量奇数”错误。这一定是什么简单的问题 - 请有人检查一下我的语法是否正确?谢谢。
#!/usr/bin/perl -w
use strict;
use RPC::XML::Client;
use Data::Dumper;
my $cli=RPC::XML::Client->new('http://www.sitename.com/wp/xmlrpc.php');
my $appkey="perl"; # doesn't matter
my $blogid=1; # doesn't matter (except blogfarm)
my $username="Jim";
my $passwd='_____';
my $text=<<'END';
This is the post content...
You can also include html tags...
See you!
END
my $publish=0; # set to 1 to publish, 0 to put post in drafts
my $resp=$cli->send_request('metaWeblog.newPost',
$blogid,
$username,
$passwd,
{
'title' => "this is doodoo",
'description' => $text,
'custom_fields' => {
{ "key" => "height", "value" => 500 },
{ "key" => "width", "value" => 750 }
},
},
$publish);
exit 0;