Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Path::Tiny instead of File::Slurp #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WriteMakefile(
PREREQ_PM => {
'Carp' => '0',
'File::Finder' => '0',
'File::Slurp' => '0',
'Path::Tiny' => '0',
'File::Spec' => '0',
'IO::File' => '0',
'parent' => '0',
Expand Down
11 changes: 8 additions & 3 deletions lib/Test/PerlTidy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package Test::PerlTidy;

use strict;
use warnings;
use English qw( -no_match_vars );

use parent 'Exporter';

Expand All @@ -10,7 +11,7 @@ use vars qw( @EXPORT ); ## no critic (Modules::ProhibitAutomaticExportation)

use Carp;
use File::Finder;
use File::Slurp;
use Path::Tiny qw( path );
use File::Spec;
use IO::File;
use Perl::Tidy;
Expand Down Expand Up @@ -67,7 +68,11 @@ sub is_file_tidy {

# If there were perltidy errors report them and return.
$stderr_fh->seek( 0, 0 );
my $stderr = read_file($stderr_fh);
binmode $stderr_fh, ':encoding(UTF-8)' or croak "error setting binmode $!";
my $stderr = do {
local $INPUT_RECORD_SEPARATOR = undef;
<$stderr_fh>;
};
if ($stderr) {
unless ($MUTE) {
$test->diag("perltidy reported the following errors:\n");
Expand Down Expand Up @@ -167,7 +172,7 @@ sub load_file {
return unless -f $filename;

# Slurp the file.
my $content = read_file($filename);
my $content = path($filename)->slurp_utf8;
return $content;
}

Expand Down