CrashTest.pl
changeset 68 c810480b2c37
parent 67 9e95be0b1b8c
child 70 dfc2f094a04f
equal deleted inserted replaced
67:9e95be0b1b8c 68:c810480b2c37
    30     my $storage_class = $self->app->config->{Storage}->{Type};
    30     my $storage_class = $self->app->config->{Storage}->{Type};
    31     if (my $e = $loader->load($storage_class)) {
    31     if (my $e = $loader->load($storage_class)) {
    32         die ref $e ? "Exception: $e" : 'Not found!';
    32         die ref $e ? "Exception: $e" : 'Not found!';
    33     }
    33     }
    34 
    34 
    35     return $storage_class->new(
    35     state $storage = $storage_class->new(
    36         config => $self->app->config->{Storage},
    36         config => $self->app->config->{Storage},
    37         extra_columns => $self->app->config->{WebInterface}->{ExtraColumns},
    37         extra_columns => $self->app->config->{WebInterface}->{ExtraColumns},
    38     );
    38     );
       
    39     return $storage;
    39 });
    40 });
    40 
    41 
    41 app->attr(decode_queue => sub {
    42 app->attr(decode_queue => sub {
    42     my $self = shift;
    43     my $self = shift;
    43     my $loader = Mojo::Loader->new;
    44     my $loader = Mojo::Loader->new;
    45     my $decode_class = $self->app->config->{DecodeQueue}->{Type};
    46     my $decode_class = $self->app->config->{DecodeQueue}->{Type};
    46     if (my $e = $loader->load($decode_class)) {
    47     if (my $e = $loader->load($decode_class)) {
    47         die ref $e ? "Exception: $e" : 'Not found!';
    48         die ref $e ? "Exception: $e" : 'Not found!';
    48     }
    49     }
    49 
    50 
    50     return $decode_class->new(
    51     state $decode = $decode_class->new(
    51         config => $self->app->config->{DecodeQueue},
    52         config => $self->app->config->{DecodeQueue},
    52         dumper_config => $self->app->config->{Dumper},
    53         dumper_config => $self->app->config->{Dumper},
    53         storage => $self->app->storage
    54         storage => $self->app->storage
    54     );
    55     );
       
    56     return $decode;
       
    57 });
       
    58 
       
    59 app->attr(stackfilter => sub {
       
    60     my $self = shift;
       
    61 
       
    62     state $stackfilter = CrashTest::StackFilter->new(
       
    63         config => $self->app->config,
       
    64         app => $self->app
       
    65     );
       
    66     return $stackfilter;
    55 });
    67 });
    56 
    68 
    57 get '/' => sub {
    69 get '/' => sub {
    58     my $self = shift;
    70     my $self = shift;
    59     my $page = 1;
    71     my $page = 1;
    78     my $self = shift;
    90     my $self = shift;
    79 
    91 
    80     my $data = $self->app->storage->get_processed_data($self->param('uuid'));
    92     my $data = $self->app->storage->get_processed_data($self->param('uuid'));
    81     $self->stash(processed_data => $data);
    93     $self->stash(processed_data => $data);
    82 
    94 
    83     my $stackfilter = CrashTest::StackFilter->new(config => $self->app->config, app => $self->app);
       
    84 
       
    85     my $crashing_thread = CrashTest::Models::Thread->new($data->{crashing_thread});
    95     my $crashing_thread = CrashTest::Models::Thread->new($data->{crashing_thread});
    86     $crashing_thread = $stackfilter->apply($crashing_thread);
    96     $crashing_thread = $self->app->stackfilter->apply($crashing_thread);
    87     $self->stash(crashing_thread => $crashing_thread);
    97     $self->stash(crashing_thread => $crashing_thread);
    88 
    98 
    89     my @threads = ();
    99     my @threads = ();
    90     foreach my $raw_thread(@{$data->{threads}}) {
   100     foreach my $raw_thread(@{$data->{threads}}) {
    91         my $thread = CrashTest::Models::Thread->new($raw_thread);
   101         my $thread = CrashTest::Models::Thread->new($raw_thread);
    92         $thread = $stackfilter->apply($thread);
   102         $thread = $self->app->stackfilter->apply($thread);
    93         push @threads, $thread;
   103         push @threads, $thread;
    94     }
   104     }
    95     $self->stash(threads => \@threads);
   105     $self->stash(threads => \@threads);
    96 
   106 
    97     $self->render('report/crash');
   107     $self->render('report/crash');