working POC:
#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;
use XMLRPC::Lite +trace => qw(debug);
my $username = "username";
my $password = "psw";
my $blogid = "blog";
my $proxyurl = 'http://hostname/xmlrpc.php';
my ($buf,$contents);
print "Enter title ->";
my $title = ;
chomp $title;
print "Enter description: (to finish enter crtl-d on a new line)";
my $descr=undef;
while(){
$descr .= $_;
}
print "Enter the full path to a png or jpeg file, just press enter to go with out a file";
my $image = ;
chomp $image;
open(FILE, $image) or die "$!";
while (read(FILE, $buf, 60*57)) {
$contents .= $buf;
}
my $resi = XMLRPC::Lite
->proxy($proxyurl)
->call('metaWeblog.newMediaObject', $blogid, $username, $password,
{ name => $image, type => "image/png", bits => $contents })
->result;
my $imageurl=undef;
my $filesize=undef;
if (defined ($resi)) {
print "--success--\\n";
print Dumper ($resi);
$imageurl=$resi->{url};
$descr .= "";
} else {
print "failed: $!";
}
my $res = XMLRPC::Lite
->proxy($proxyurl)
->call('metaWeblog.newPost', $blogid,
$username, $password,
{ title => $title,
description => $descr
},
XMLRPC::Data->type('boolean',1))
->result;
if (defined ($res)) {
print "--success--\\n";
print Dumper ($res);
} else {
print "failed: $!";
}
exit;