lib/CrashTest/Model/Frame.pm
changeset 78 0ebef32c34af
parent 37 013953be0f3b
child 81 29e378724e62
equal deleted inserted replaced
77:e408da1419cd 78:0ebef32c34af
       
     1 # This program is free software: you can redistribute it and/or modify
       
     2 # it under the terms of the GNU General Public License as published by
       
     3 # the Free Software Foundation, either version 3 of the License, or
       
     4 # (at your option) any later version.
       
     5 #
       
     6 # This program is distributed in the hope that it will be useful,
       
     7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
     8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
     9 # GNU General Public License for more details.
       
    10 #
       
    11 # You should have received a copy of the GNU General Public License
       
    12 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
       
    13 
       
    14 package CrashTest::Model::Frame;
       
    15 use Mojo::Base -base;
       
    16 use Mojo::ByteStream 'b';
       
    17 use Mojolicious::Plugin::TagHelpers;
       
    18 use File::Basename;
       
    19 
       
    20 # from json
       
    21 has [ qw/frame module function file line trust/ ];
       
    22 has [ qw/function_offset module_offset offset/ ];
       
    23 has [ qw/missing_symbols corrupt_symbols/ ];
       
    24 
       
    25 # added
       
    26 has frame_number => undef;
       
    27 has module_name => "";
       
    28 has function_name => "";
       
    29 has file_link => "";
       
    30 has frame_warnings => sub { return []; };
       
    31 has module_warnings => sub { return []; };
       
    32 #has "infos";
       
    33 
       
    34 sub new {
       
    35     my $self = shift->SUPER::new(@_);
       
    36 
       
    37     # defaults
       
    38     $self->frame_number($self->frame);
       
    39     $self->function_name($self->function);
       
    40     $self->module_name($self->module);
       
    41     if(defined($self->file)) {
       
    42         my $filename = fileparse($self->file);
       
    43         $self->file_link($filename . ":" . $self->line);
       
    44     }
       
    45 
       
    46     return $self;
       
    47 }
       
    48 
       
    49 1;