this basically does what i want it to do, but in perl
Code:
#!/usr/bin/perl -w
use strict;
use Frontier::Client;
my $apikey = 'APIKEYHERE';
my $src = 'sourcecode.phps';
my $title='test post';
my $code = '';
my $tags = 'tag1 tag2 tag3';
my $language = 'php';
my $flag = 0;
open(FC, "<:utf8", $src);
while (<FC>) {
if (/^\#[^!]\s*(.+)/ && $flag == 0) {
$title = $1;
$flag++;
}
elsif (/^\#[^!]\s*(.+)/ && $flag == 1) {
$tags = $1;
$flag++;
if (/(\w+) (.+)/) {
$language = $1;
$tags = $2;
}
}
$code = $code . $_;
}
my $session = Frontier::Client->new( url => 'http://snipplr.com/xml-rpc.php', debug => 0,);
my @args = ($apikey, $title, $code, $tags, $language);
my $result = $session->call('snippet.post', @args);
the command line version of it using the snipplr ruby gem would be
Code:
snipplr -c -meta ":title=>'test post',:tags=>'tag1 tag2 tag3',:language=> 'php'" < sourcode.phps