File: memento_find.pm

package info (click to toggle)
libcatmandu-identifier-perl 0.15-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 292 kB
  • sloc: perl: 978; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Catmandu::Fix::memento_find;

our $VERSION = '0.15';

use Catmandu::Sane;
use Moo;
use Memento::TimeTravel;
use Catmandu::Fix::Has;

has path => (fix_arg => 1);
has date => (fix_arg => 1);

with 'Catmandu::Fix::SimpleGetValue';

sub emit_value {
    my ($self, $var) = @_;
    my $date = $self->date;

    "${var} = Memento::TimeTravel::find_mementos(${var},${date}) if is_string(${var}) && length(${var});";
}

=head1 NAME

Catmandu::Fix::memento_find - find Mementos for a url

=head1 SYNOPSIS

   # Find mementos for a URL. E.g. myurl => 'http://www.ugent.be'
   memento_find(myurl,2013)

=head1 SEE ALSO

L<Catmandu::Fix>

=cut

1;