package Mirror::JSON;
use 5.005;
use strict;
use Carp qw{ croak };
use Params::Util qw{ _STRING _POSINT _ARRAY0 _INSTANCE };
use JSON ();
use URI ();
use
Time::HiRes ();
use Time::Local ();
use LWP::Simple ();
use Mirror::JSON::URI ();
use constant ONE_DAY => 86700; # 1 day plus 5 minutes fudge factor
use constant TWO_DAYS =>
';
}
#####################################################################
# Wrapper for the JSON::Tiny methods
sub new {
my $class = shift;
my $self = bless { @_ }, $class;
if ( _STRING($se
package Mirror::JSON::URI;
use 5.005;
use strict;
use URI ();
use Params::Util qw{ _STRING _INSTANCE };
use LWP::Simple ();
use vars qw{$VERSION};
BEGIN {
$VERSION = '0.01';
}
######
elf->uri, 'URI') ) {
return undef;
}
return $self;
}
sub uri {
$_[0]->{uri};
}
sub json {
$_[0]->{json};
}
sub live {
!! $_[0]->{live};
}
sub lag {
$_[0]->{lag};
}
###################
shift;
my $uri = URI->new('mirror.json')->abs( $self->uri );
my $before = Time::HiRes::time();
my $json = LWP::Simple::get($uri);
unless ( $json and $json =~ /^---/ ) {
# Site does not exis