#!/usr/bin/env perl
use warnings;
use strict;
# http://thyme.apnic.net/ap-data/1999/02/23/0400/mail-global
#
# from 1999-02-23 til now
my $url_f = 'http://thyme.apnic.net/ap-data/%Y/%m/%d/0400/mail-global';

use Date::Manip;
use LWP::Simple;

my $borked = 0;
for my $d ( ParseRecur('0:0:0:1:0:0:0', '1999-02-23', '1999-02-23', '2013-08-03') ) {
	my $url = UnixDate($d, $url_f);
	#printf "   url -> %s\n", $url;
	my $content = get $url;
	if ($content =~ /Prefixes being announced from the IANA Reserved Address blocks:\s+(\d+)/ ) {
		$borked = $1;
	}
	if ($content =~ /Prefixes being announced from unallocated address space:\s+(\d+)/ ) {
		$borked = $1;
	}
	printf "%s,%d\n", UnixDate($d, '%Y-%m-%d'), $borked;
}




