line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use strict; |
5
|
2
|
|
|
2
|
|
13
|
use Moo; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
56
|
|
6
|
2
|
|
|
2
|
|
11
|
use JSON; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
1722
|
use Scalar::Util qw(blessed); |
|
2
|
|
|
|
|
14469
|
|
|
2
|
|
|
|
|
11
|
|
8
|
2
|
|
|
2
|
|
265
|
use LWP::Simple; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
114
|
|
9
|
2
|
|
|
2
|
|
807
|
|
|
2
|
|
|
|
|
25207
|
|
|
2
|
|
|
|
|
17
|
|
10
|
|
|
|
|
|
|
my ($self, $uri, $date) = @_; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
0
|
8080
|
unless (blessed($self)) { |
13
|
|
|
|
|
|
|
$date = $uri; |
14
|
2
|
50
|
|
|
|
12
|
$uri = $self; |
15
|
2
|
|
|
|
|
4
|
} |
16
|
2
|
|
|
|
|
5
|
|
17
|
|
|
|
|
|
|
die "usage: find_mementos(uri,date)" |
18
|
|
|
|
|
|
|
unless defined($uri) && defined($date); |
19
|
2
|
50
|
33
|
|
|
13
|
|
20
|
|
|
|
|
|
|
die "usage: date =~ YYYYMMDDHHMMSS" unless ($date =~ /^\d{4,14}$/); |
21
|
|
|
|
|
|
|
|
22
|
2
|
50
|
|
|
|
13
|
my $api_call = sprintf "http://timetravel.mementoweb.org/api/json/%s/%s", |
23
|
|
|
|
|
|
|
$date, $uri; |
24
|
2
|
|
|
|
|
12
|
|
25
|
|
|
|
|
|
|
my $mementos = get($api_call); |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
9
|
return undef unless defined($mementos) && length($mementos); |
28
|
|
|
|
|
|
|
|
29
|
2
|
100
|
66
|
|
|
21173
|
decode_json($mementos); |
30
|
|
|
|
|
|
|
} |
31
|
1
|
|
|
|
|
71
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Memento::TimeTravel - A time traveler for URLS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Memento::TimeTravel; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $traveler = Memento::TimeTravel->new(); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $mementos = $traveler->find_mementos('http://www.ugent.be/',2013); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Patrick Hochstenbach, C<< <patrick.hochstenbach at ugent.be> >> |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 LICENSE |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
51
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
52
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=cut |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |