Permalink
Browse files

Simplify formatter

  • Loading branch information...
1 parent d51daf8 commit d6058c14d3241fbd434ac7a70ad52a5d0ffb38f3 @tadzik committed May 1, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 formatter
View
@@ -1,10 +1,12 @@
#!/usr/bin/env perl
-use 5.014;
use Mojo::JSON;
use Mojo::Template;
-use File::Slurp 'slurp';
my $mt = Mojo::Template->new;
-my $results = Mojo::JSON->new->decode(slurp 'results.json');
-print $mt->render_file_to_file('template.tt', 'index.html', $results);
+open my $fh, '<', 'results.json' or die "No results.json available";
+my $json = do { local $/; <$fh> };
+close $fh;
+
+my $results = Mojo::JSON->new->decode($json);
+$mt->render_file_to_file('template.tt', 'index.html', $results);

0 comments on commit d6058c1

Please sign in to comment.