mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-10-20 01:16:14 +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 Carp qw(croak);
|
||||
|
||||
use Test::More;
|
||||
use Time::HiRes qw(sleep time);
|
||||
use File::Temp qw(tempfile);
|
||||
@@ -192,7 +194,7 @@ sub output {
|
||||
sub load_data {
|
||||
my ( $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> };
|
||||
close $fh;
|
||||
(my $data = join('', $contents =~ m/(.*)/g)) =~ s/\s+//g;
|
||||
@@ -210,7 +212,7 @@ sub load_file {
|
||||
|
||||
sub slurp_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> };
|
||||
close $fh;
|
||||
return $contents;
|
||||
|
Reference in New Issue
Block a user