mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-20 17:49:56 +00:00
PerconaTest: use croak for slurp/load_file
This commit is contained in:
@@ -35,6 +35,8 @@ use constant PTDEVDEBUG => $ENV{PTDEVDEBUG} || 0;
|
|||||||
|
|
||||||
use Percona::Toolkit;
|
use Percona::Toolkit;
|
||||||
|
|
||||||
|
use Carp qw(croak);
|
||||||
|
|
||||||
use Test::More;
|
use Test::More;
|
||||||
use Time::HiRes qw(sleep time);
|
use Time::HiRes qw(sleep time);
|
||||||
use File::Temp qw(tempfile);
|
use File::Temp qw(tempfile);
|
||||||
@@ -192,7 +194,7 @@ sub output {
|
|||||||
sub load_data {
|
sub load_data {
|
||||||
my ( $file ) = @_;
|
my ( $file ) = @_;
|
||||||
$file = "$trunk/$file";
|
$file = "$trunk/$file";
|
||||||
open my $fh, '<', $file or die "Cannot open $file: $OS_ERROR";
|
open my $fh, '<', $file or croak "Cannot open $file: $OS_ERROR";
|
||||||
my $contents = do { local $/ = undef; <$fh> };
|
my $contents = do { local $/ = undef; <$fh> };
|
||||||
close $fh;
|
close $fh;
|
||||||
(my $data = join('', $contents =~ m/(.*)/g)) =~ s/\s+//g;
|
(my $data = join('', $contents =~ m/(.*)/g)) =~ s/\s+//g;
|
||||||
@@ -210,7 +212,7 @@ sub load_file {
|
|||||||
|
|
||||||
sub slurp_file {
|
sub slurp_file {
|
||||||
my ($file) = @_;
|
my ($file) = @_;
|
||||||
open my $fh, "<", $file or die "Cannot open $file: $OS_ERROR";
|
open my $fh, "<", $file or croak "Cannot open $file: $OS_ERROR";
|
||||||
my $contents = do { local $/ = undef; <$fh> };
|
my $contents = do { local $/ = undef; <$fh> };
|
||||||
close $fh;
|
close $fh;
|
||||||
return $contents;
|
return $contents;
|
||||||
|
Reference in New Issue
Block a user