Commits

Toby Inkster  committed 3d36826

Use Path::Class instead of File::Path

  • Participants
  • Parent commits 9ba53bd

Comments (0)

Files changed (2)

File lib/P5U/Lib/Testers.pm

 };
 
 use Any::Moose       0;
-use File::Path       0 qw< make_path >;
 use File::Spec       0 qw< >;
 use JSON             0 qw< from_json >;
 use LWP::Simple      0 qw< mirror is_success >;
 use List::Util       0 qw< maxstr >;
 use Object::AUTHORITY qw/AUTHORITY/;
+use Path::Class      0 qw< dir file >;
 use namespace::clean;
 
 has cache_dir => (
 		substr($self->distro, 0, 1),
 		$self->distro,
 	);
-	my $results_file = File::Spec->catfile(
+	my $results_file = file(
 		$self->cache_dir,
 		sprintf('%s.json', $self->distro),
 	);
 			die "Failed to retrieve URI $results_uri\n";
 		};
 		
-	my $results = from_json do {
-		open my $fh, '<', $results_file
-			or die "Could not open $results_file: $!";
-		local $/ = <$fh>;
-	};
+	my $results = from_json scalar $results_file->slurp;
 	die "Unexpected non-ARRAY content from $results_uri\n"
 		unless ref $results eq 'ARRAY';
 	
 
 sub _build_cache_dir
 {
-	my $dir = File::Spec::->catdir(
+	my $dir = dir(
 		File::Spec::->tmpdir,
 		'CpanTesters',
 	);
-	make_path $dir unless -d $dir;
+	dir($dir)->mktree unless -d $dir;
 	return $dir;
 }
 

File meta/makefile.ttl

 	:requires           "autodie";
 	:requires           "Class::Load";
 	:requires           "File::HomeDir";
-	:requires           "File::Path";
 	:requires           "File::pushd";
 	:requires           "File::Slurp";
 	:requires           "JSON 2.00";
 	:requires           "Module::Manifest";
 	:requires           "namespace::clean 0.19";
 	:requires           "Object::AUTHORITY";
+	:requires           "Path::Class";
+	:requires	    "Path::Class::Rule";
 	:requires           "PerlX::Maybe";
 	:test_requires      "Test::More 0.61".