From: Nigel Metheringham Date: Sun, 24 Apr 2011 15:28:35 +0000 (+0100) Subject: Use File::Path to make directories X-Git-Tag: exim-4_89_1~62 X-Git-Url: https://git.exim.org/exim-website.git/commitdiff_plain/b24c6fc7166adff432821a2b0452e48d1c6a84d5 Use File::Path to make directories --- diff --git a/script/gen.pl b/script/gen.pl index 685d0eb..9667a7c 100755 --- a/script/gen.pl +++ b/script/gen.pl @@ -6,6 +6,7 @@ use warnings; use CSS::Minifier::XS 0.07; use File::Copy; use File::Find; +use File::Path qw(make_path); use File::Slurp; use File::Spec; use Getopt::Long; @@ -312,7 +313,7 @@ sub transform { my $doc = $stylesheet->transform($xml); ## Make the containing directory if it doesn't exist - mkdirp( ( $out_path =~ /^(.+)\/.+$/ )[0] ); + make_path( ( $out_path =~ /^(.+)\/.+$/ )[0], { verbose => 1 } ); ## Write out the document open my $out, '>', $out_path or die "Unable to write $out_path - $!"; @@ -320,20 +321,6 @@ sub transform { close $out; } -## "mkdir -p " -sub mkdirp { - my $path = shift; - - my @parts = (); - foreach ( split( /\//, $path ) ) { - push @parts, $_; - my $make = join( '/', @parts ); - next unless length($make); - next if -d $make; - mkdir($make) or die "Unable to mkdir $make: $!\n"; - } -} - ## error_help sub error_help { my $msg = shift;