From b24c6fc7166adff432821a2b0452e48d1c6a84d5 Mon Sep 17 00:00:00 2001 From: Nigel Metheringham Date: Sun, 24 Apr 2011 16:28:35 +0100 Subject: [PATCH] Use File::Path to make directories --- script/gen.pl | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) 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; -- 2.30.2