use changes from command-line
[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 @changes = @ARGV;
13
14 my $t = Mojo::Client->new;
15 $t->max_redirects( 1 );
16
17 foreach my $c ( @changes ) {
18
19         print "# $c\n";
20
21         my $params = retrieve $c;
22
23         my $tx = $t->post_form( $url => $params->to_hash );
24         if ( my $res = $tx->success) { print $res->body }
25         else {
26                 my ($code, $message) = $tx->error;
27                 die "Error: $message";
28         }
29
30 #       last if $max-- == 0;
31 }