--- a/lib/CrashTest/Decode/Queue/NoQueue.pm Mon Aug 04 15:45:02 2014 +0200
+++ b/lib/CrashTest/Decode/Queue/NoQueue.pm Thu Aug 07 23:50:08 2014 +0200
@@ -12,40 +12,38 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
package CrashTest::Decode::Queue::NoQueue;
-
+use Mojo::Base -base;
use File::Temp;
-use strict;
-use warnings;
+has [ qw/config dumper_config storage/ ];
sub new {
- my ($class, $config, $dumperconfig, $storage) = @_;
- my $self = {};
- $self->{Dumper} = $dumperconfig;
- $self->{storage} = $storage;
- bless ($self, $class);
+ my $self = shift->SUPER::new(@_);
+
return $self;
}
sub decode {
my ($self, $file, $paramshash, $uuidstr, $cb) = @_;
+
my $fh = File::Temp->new(SUFFIX => '.dmp');
my $dmp_file = $fh->filename;
$file->move_to($dmp_file);
- my $cmd = $self->{Dumper}->{JSONStackwalker} . " $dmp_file " . $self->{Dumper}->{SymbolsPath};
+ my $cmd = $self->dumper_config->{JSONStackwalker} . " $dmp_file " . $self->dumper_config->{SymbolsPath};
my $out = qx($cmd 2>/dev/null) or die $!;
my $json = Mojo::JSON->new;
my $pjson = $json->decode($out);
# Create json for the params
+ # TODO check for authorised values ...
$pjson->{client_info} = $paramshash;
- $self->{storage}->store_dump($uuidstr, $file->slurp);
- $self->{storage}->store_processed_data($uuidstr, $pjson);
+ $self->storage->store_dump($uuidstr, $file->slurp);
+ $self->storage->store_processed_data($uuidstr, $pjson);
- &$cb($pjson);
+ $cb->($pjson);
}
1;