/ Published in: Perl

Dumps your snippets (and possibly skips your favourites [British spelling]) to standard output. Requires Frontier::RPC2.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl -w use strict; use Frontier::Client; my $key = ''; # (your API key) my $user = ''; # used to skip others' snippets (fill with your user name) my $session = Frontier::Client->new( url => 'http://snipplr.com/xml-rpc.php', debug => 0,); $session->call('user.checkkey', $key) my @args = ($key, ''); my $list = $session->call('snippet.list', @args); my @snippets; # in case you need to process data afterwards (sort ...) my $data = $session->call('snippet.get', $_->{'id'}); if ($data->{username} !~ /^$user$/) {next}; # skip favorites (back up just your snippets) $snippets[$i]=$data; # dump for post loop processing }
Comments
