#!/usr/bin/perl
use warnings;
use strict;

use LWP::Simple;
use XML::Simple;
use JSON;
use Data::Dump qw(dump);

my $UserID = $ENV{UserID} || die "usage: UserID=1234 key=abcd $0";
my $key    = $ENV{key}    || die "key required";

my $url = "https://api.zotero.org/users/$UserID/items?key=$key&format=atom&content=json&order=dateModified&sort=desc";

my $file = "$UserID.atom";

warn "# $url\n";
if ( mirror( $url => $file ) == RC_NOT_MODIFIED ) {
	warn "not modified";
#	exit 0;
}

my $feed = XMLin( $file );

warn "# feed ",dump($feed);

