re-apply changes from /tmp
[MojoFacets.git] / script / changes
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 use Storable;
7 use Mojo::Client;
8
9 my $url = 'http://localhost:3000/data/edit';
10 my $max = 1;
11
12 my $t = Mojo::Client->new;
13 $t->max_redirects( 1 );
14
15 foreach my $c ( glob '/tmp/changes/*.data.edit' ) {
16
17         print "# $c\n";
18
19         my $params = retrieve $c;
20
21         my $tx = $t->post_form( $url => $params->to_hash );
22         if ( my $res = $tx->success) { print $res->body }
23         else {
24                 my ($code, $message) = $tx->error;
25                 die "Error: $message";
26         }
27
28 #       last if $max-- == 0;
29 }