--- a/lib/CrashTest/Command/update.pm Sun Apr 02 14:36:18 2017 +0200
+++ b/lib/CrashTest/Command/update.pm Wed Jun 21 23:11:42 2017 +0200
@@ -16,9 +16,7 @@
use Mojo::Base 'Mojolicious::Command';
use Mojo::JSON::MaybeXS;
use Mojo::JSON qw/decode_json/;
-use Mojo::Util qw/slurp/;
-use File::Spec::Functions qw/catdir catfile/;
-use File::Basename;
+use Mojo::File qw/path/;
# Short description
has description => 'Update crash';
@@ -37,15 +35,17 @@
}
foreach my $jsonfile(@args) {
- my ($uuid,$path,$suffix) = fileparse($jsonfile, qw/.json/);
+ my $path = path($jsonfile);
+ my $uuid = $path->basename('.json');
+ my $dmp_file = $path->dirname->child("$uuid.dmp");
my $dmp = undef;
- if(-e catfile($path, "$uuid.dmp")) {
- $dmp = slurp(catfile($path, "$uuid.dmp"));
+ if(-e $dmp_file) {
+ $dmp = $dmp_file->slurp;
}
eval {
- my $pjson = decode_json(slurp(catfile($path, "$uuid.json")));
+ my $pjson = decode_json($path->slurp);
$self->app->crash_reports->update($uuid, $pjson, $pjson->{client_info}, $dmp);
};
warn $@ if $@;