lib/CrashTest/Storage/FileSystem.pm
changeset 19 300b902b5461
parent 12 c98d3fa4a948
child 24 b69b7aa98a1d
equal deleted inserted replaced
18:60db1090095b 19:300b902b5461
    15 
    15 
    16 use strict;
    16 use strict;
    17 use warnings;
    17 use warnings;
    18 
    18 
    19 sub new {
    19 sub new {
    20     my ($class, $data_path) = @_;
    20     my ($class, $config) = @_;
    21     my $self  = {};
    21     my $self  = {};
    22     $self->{data_path} = $data_path;
    22     $self->{data_path} = $config->{DataDir};
    23     bless ($self, $class);
    23     bless ($self, $class);
    24     return $self;
    24     return $self;
    25 }
    25 }
    26 
    26 
    27 sub index {
    27 sub index {
    77 
    77 
    78 sub store_dump {
    78 sub store_dump {
    79     my ($self, $uuid, $file) = @_;
    79     my ($self, $uuid, $file) = @_;
    80 
    80 
    81     my $dmp_file = File::Spec->catfile($self->{data_path}, "$uuid.dmp");
    81     my $dmp_file = File::Spec->catfile($self->{data_path}, "$uuid.dmp");
    82     $file->move_to($dmp_file);
    82     my $fh = IO::File->new($dmp_file, "w") or die($!);
       
    83     $fh->binmode;
       
    84     print $fh $file;
       
    85     undef $fh;
    83 }
    86 }
    84 
    87 
    85 1;
    88 1;