#!/usr/bin/env perl
use strict;
use warnings;
use 5.016;
use Feed;
use Log::Log4perl;

Log::Log4perl::init(\<<'LOG');
log4perl.rootLogger = TRACE, Screen
log4perl.appender.Screen = Log::Log4perl::Appender::Screen
log4perl.appender.Screen.stderr = 1
log4perl.appender.Screen.layout = PatternLayout
log4perl.appender.Screen.layout.ConversionPattern = [%d{ISO8601}] (%c) %m{chomp}%n
LOG

my $feed_class = Feed->with_traits(
    'Printer',
    'FixDateTime',
    'DeDupe',
    'AuthorName',
);

sub feed {
    my (%args) = @_;
    my $feed = $feed_class->new({
        dupe_dsn => 'dbi:SQLite:dbname=dedup.db',
        %args,
    });
    $feed->process;
}

feed(uri=>'http://www.gentoo.org/rdf/en/gentoo-news.rdf');
feed(uri=>'http://feeds2.feedburner.com/sydneypadua/yBZX');
feed(uri=>'http://oglaf.com/feeds/rss/');
feed(uri=>'http://feeds.gawker.com/io9/full');
