--- a/CrashTest.pl Sat May 09 23:17:47 2015 +0200
+++ b/CrashTest.pl Sat May 09 23:24:13 2015 +0200
@@ -32,10 +32,11 @@
die ref $e ? "Exception: $e" : 'Not found!';
}
- return $storage_class->new(
+ state $storage = $storage_class->new(
config => $self->app->config->{Storage},
extra_columns => $self->app->config->{WebInterface}->{ExtraColumns},
);
+ return $storage;
});
app->attr(decode_queue => sub {
@@ -47,11 +48,22 @@
die ref $e ? "Exception: $e" : 'Not found!';
}
- return $decode_class->new(
+ state $decode = $decode_class->new(
config => $self->app->config->{DecodeQueue},
dumper_config => $self->app->config->{Dumper},
storage => $self->app->storage
);
+ return $decode;
+});
+
+app->attr(stackfilter => sub {
+ my $self = shift;
+
+ state $stackfilter = CrashTest::StackFilter->new(
+ config => $self->app->config,
+ app => $self->app
+ );
+ return $stackfilter;
});
get '/' => sub {
@@ -80,16 +92,14 @@
my $data = $self->app->storage->get_processed_data($self->param('uuid'));
$self->stash(processed_data => $data);
- my $stackfilter = CrashTest::StackFilter->new(config => $self->app->config, app => $self->app);
-
my $crashing_thread = CrashTest::Models::Thread->new($data->{crashing_thread});
- $crashing_thread = $stackfilter->apply($crashing_thread);
+ $crashing_thread = $self->app->stackfilter->apply($crashing_thread);
$self->stash(crashing_thread => $crashing_thread);
my @threads = ();
foreach my $raw_thread(@{$data->{threads}}) {
my $thread = CrashTest::Models::Thread->new($raw_thread);
- $thread = $stackfilter->apply($thread);
+ $thread = $self->app->stackfilter->apply($thread);
push @threads, $thread;
}
$self->stash(threads => \@threads);