Perl-Dist-WiX

changeset 1035:5a202646b345 maint-May2011

Changes from running perlcritic.t.
author Curtis Jewell <perl@curtisjewell.name>
date Sun Jun 05 05:42:56 2011 -0600 (2011-06-05)
parents 646672d7d125
children f487892d6c97
files lib/Perl/Dist/WiX.pm lib/Perl/Dist/WiX/Asset/DistFile.pm lib/Perl/Dist/WiX/Asset/Distribution.pm lib/Perl/Dist/WiX/Asset/File.pm lib/Perl/Dist/WiX/Asset/Library.pm lib/Perl/Dist/WiX/Mixin/BuildPerl.pm lib/Perl/Dist/WiX/Mixin/Support.pm lib/Perl/Dist/WiX/Role/Asset.pm lib/Perl/Dist/WiX/Util/Machine.pm
line diff
     1.1 --- a/lib/Perl/Dist/WiX.pm	Sun Jun 05 05:25:43 2011 -0600
     1.2 +++ b/lib/Perl/Dist/WiX.pm	Sun Jun 05 05:42:56 2011 -0600
     1.3 @@ -3021,7 +3021,7 @@
     1.4  	my $self = shift;
     1.5  	my $dir  = $self->dir(@_);
     1.6  	if ( -e $dir ) {
     1.7 -		$self->remove_path( $dir );
     1.8 +		$self->remove_path($dir);
     1.9  	}
    1.10  	return 1;
    1.11  }
    1.12 @@ -3030,7 +3030,8 @@
    1.13  	my $self = shift;
    1.14  	my $file = $self->file(@_);
    1.15  	if ( -e $file ) {
    1.16 -		unlink( $file );
    1.17 +		## TODO: Deal with the 'no critic'
    1.18 +		unlink $file; ## no critic(RequireCheckedSyscalls)
    1.19  	}
    1.20  	return 1;
    1.21  }
     2.1 --- a/lib/Perl/Dist/WiX/Asset/DistFile.pm	Sun Jun 05 05:25:43 2011 -0600
     2.2 +++ b/lib/Perl/Dist/WiX/Asset/DistFile.pm	Sun Jun 05 05:42:56 2011 -0600
     2.3 @@ -265,7 +265,7 @@
     2.4  	# Extract the tarball
     2.5  	if ( -d $unpack_to ) {
     2.6  		$self->_trace_line( 2, "Removing previous $unpack_to\n" );
     2.7 -		$self->remove_path( $unpack_to );
     2.8 +		$self->remove_path($unpack_to);
     2.9  	}
    2.10  	$self->_trace_line( 4, "Unpacking to $unpack_to\n" );
    2.11  	$self->_extract( $path => $self->_get_build_dir() );
     3.1 --- a/lib/Perl/Dist/WiX/Asset/Distribution.pm	Sun Jun 05 05:25:43 2011 -0600
     3.2 +++ b/lib/Perl/Dist/WiX/Asset/Distribution.pm	Sun Jun 05 05:42:56 2011 -0600
     3.3 @@ -383,12 +383,12 @@
     3.4  
     3.5  	# Download the file
     3.6  	my $url = $self->_abs_uri( $self->_get_cpan() );
     3.7 -	my $tgz = eval { 
     3.8 -		$self->_mirror_url( $url, $self->_get_modules_dir(), ) 
     3.9 -	} || PDWiX::Caught->throw(
    3.10 -			message => $@, 
    3.11 -			info => 'Error trying to download distribution'
    3.12 -		);
    3.13 +	my $tgz =
    3.14 +	  eval { $self->_mirror_url( $url, $self->_get_modules_dir(), ) }
    3.15 +	  || PDWiX::Caught->throw(
    3.16 +		message => $EVAL_ERROR,
    3.17 +		info    => 'Error trying to download distribution'
    3.18 +	  );
    3.19  
    3.20  	# Does it exist? If not, throw an error here.
    3.21  	if ( not -f $tgz ) {
     4.1 --- a/lib/Perl/Dist/WiX/Asset/File.pm	Sun Jun 05 05:25:43 2011 -0600
     4.2 +++ b/lib/Perl/Dist/WiX/Asset/File.pm	Sun Jun 05 05:42:56 2011 -0600
     4.3 @@ -108,7 +108,8 @@
     4.4  	$self->_copy( $from => $to );
     4.5  
     4.6  	# Clear the download file
     4.7 -	unlink($file);
     4.8 +	## TODO: Deal with the 'no critic'
     4.9 +	unlink $file; ## no critic(RequireCheckedSyscalls)
    4.10  
    4.11  	my $filelist =
    4.12  	  File::List::Object->new()->load_array(@files)
     5.1 --- a/lib/Perl/Dist/WiX/Asset/Library.pm	Sun Jun 05 05:25:43 2011 -0600
     5.2 +++ b/lib/Perl/Dist/WiX/Asset/Library.pm	Sun Jun 05 05:42:56 2011 -0600
     5.3 @@ -218,7 +218,7 @@
     5.4  	  catdir( $self->_get_build_dir(), $self->_get_unpack_to() );
     5.5  	if ( -d $unpack_to ) {
     5.6  		$self->_trace_line( 2, "Removing previous $unpack_to\n" );
     5.7 -		$self->remove_path( $unpack_to );
     5.8 +		$self->remove_path($unpack_to);
     5.9  	}
    5.10  	@files = $self->_extract( $tgz, $unpack_to );
    5.11  
     6.1 --- a/lib/Perl/Dist/WiX/Mixin/BuildPerl.pm	Sun Jun 05 05:25:43 2011 -0600
     6.2 +++ b/lib/Perl/Dist/WiX/Mixin/BuildPerl.pm	Sun Jun 05 05:42:56 2011 -0600
     6.3 @@ -125,7 +125,7 @@
     6.4  
     6.5  =cut
     6.6  
     6.7 -sub _force_flag {
     6.8 +sub _force_flag { ## no critic(UnusedPrivateSubroutines)
     6.9  	shift;                             # We don't use $self.
    6.10  	my $force = shift;
    6.11  	return $force ? ( force => 1 ) : (),;
     7.1 --- a/lib/Perl/Dist/WiX/Mixin/Support.pm	Sun Jun 05 05:25:43 2011 -0600
     7.2 +++ b/lib/Perl/Dist/WiX/Mixin/Support.pm	Sun Jun 05 05:42:56 2011 -0600
     7.3 @@ -652,24 +652,23 @@
     7.4  	my $dir   = rel2abs(shift);
     7.5  	my $err;
     7.6  	if ( not -d $dir ) {
     7.7 -		File::Path::make_path("$dir", { error => \$err, });
     7.8 -		if (@{$err}) {
     7.9 +		File::Path::make_path( "$dir", { error => \$err, } );
    7.10 +		if ( @{$err} ) {
    7.11  			my $errors = q{};
    7.12 -			for my $diag (@{$err}) {
    7.13 -				my ($file, $message) = %{$diag};
    7.14 -				if ($file eq q{}) {
    7.15 +			for my $diag ( @{$err} ) {
    7.16 +				my ( $file, $message ) = %{$diag};
    7.17 +				if ( $file eq q{} ) {
    7.18  					$errors .= "General error: $message\n";
    7.19 -				}
    7.20 -				else {
    7.21 +				} else {
    7.22  					$errors .= "Problem remaking $file: $message\n";
    7.23  				}
    7.24  			}
    7.25  			PDWiX::Directory->throw(
    7.26  				dir     => $dir,
    7.27  				message => "Failed to create directory, errors:\n$errors"
    7.28 -			);	
    7.29 -		}
    7.30 -	}
    7.31 +			);
    7.32 +		} ## end if ( @{$err} )
    7.33 +	} ## end if ( not -d $dir )
    7.34  	if ( not -d $dir ) {
    7.35  		PDWiX::Directory->throw(
    7.36  			directory => $dir,
    7.37 @@ -698,57 +697,58 @@
    7.38  	my $dir   = rel2abs(shift);
    7.39  	my $err;
    7.40  	if ( -d "$dir" ) {
    7.41 -		File::Path::remove_tree("$dir", {
    7.42 -			keep_root => 1,
    7.43 -			error     => \$err, 
    7.44 -		});
    7.45 -		my $e = $@;
    7.46 +		File::Path::remove_tree(
    7.47 +			"$dir",
    7.48 +			{   keep_root => 1,
    7.49 +				error     => \$err,
    7.50 +			} );
    7.51 +		my $e = $EVAL_ERROR;
    7.52  		if ($e) {
    7.53  			PDWiX::Directory->throw(
    7.54 -				dir     => $dir,
    7.55 -				message => "Failed to remove directory during recreation, critical error:\n$e"
    7.56 -			);	
    7.57 +				dir => $dir,
    7.58 +				message =>
    7.59 +"Failed to remove directory during recreation, critical error:\n$e"
    7.60 +			);
    7.61  		}
    7.62 -		if (@{$err}) {
    7.63 +		if ( @{$err} ) {
    7.64  			my $errors = q{};
    7.65 -			for my $diag (@{$err}) {
    7.66 -				my ($file, $message) = %{$diag};
    7.67 -				if ($file eq q{}) {
    7.68 +			for my $diag ( @{$err} ) {
    7.69 +				my ( $file, $message ) = %{$diag};
    7.70 +				if ( $file eq q{} ) {
    7.71  					$errors .= "General error: $message\n";
    7.72 -				}
    7.73 -				else {
    7.74 +				} else {
    7.75  					$errors .= "Problem removing $file: $message\n";
    7.76  				}
    7.77  			}
    7.78  			PDWiX::Directory->throw(
    7.79 -				dir     => $dir,
    7.80 -				message => "Failed to remove directory during recreation, errors:\n$errors"
    7.81 -			);	
    7.82 -		}
    7.83 -	}
    7.84 +				dir => $dir,
    7.85 +				message =>
    7.86 +"Failed to remove directory during recreation, errors:\n$errors"
    7.87 +			);
    7.88 +		} ## end if ( @{$err} )
    7.89 +	} ## end if ( -d "$dir" )
    7.90  	if ( not -d "$dir" ) {
    7.91 -		File::Path::make_path("$dir", { error => \$err, });
    7.92 -		if (@{$err}) {
    7.93 +		File::Path::make_path( "$dir", { error => \$err, } );
    7.94 +		if ( @{$err} ) {
    7.95  			my $errors = q{};
    7.96 -			for my $diag (@{$err}) {
    7.97 -				my ($file, $message) = %{$diag};
    7.98 -				if ($file eq q{}) {
    7.99 +			for my $diag ( @{$err} ) {
   7.100 +				my ( $file, $message ) = %{$diag};
   7.101 +				if ( $file eq q{} ) {
   7.102  					$errors .= "General error: $message\n";
   7.103 -				}
   7.104 -				else {
   7.105 +				} else {
   7.106  					$errors .= "Problem remaking $file: $message\n";
   7.107  				}
   7.108  			}
   7.109  			PDWiX::Directory->throw(
   7.110  				dir     => $dir,
   7.111  				message => "Failed to recreate directory, errors:\n$errors"
   7.112 -			);	
   7.113 -		}
   7.114 -	}
   7.115 +			);
   7.116 +		} ## end if ( @{$err} )
   7.117 +	} ## end if ( not -d "$dir" )
   7.118  	if ( not -d "$dir" ) {
   7.119  		PDWiX::Directory->throw(
   7.120  			dir     => $dir,
   7.121 -			message => "Failed to recreate directory, no information why"
   7.122 +			message => 'Failed to recreate directory, no information why'
   7.123  		);
   7.124  	}
   7.125  	return $dir;
   7.126 @@ -773,35 +773,37 @@
   7.127  	my $dir   = rel2abs(shift);
   7.128  	my $err;
   7.129  	if ( -d "$dir" ) {
   7.130 -		File::Path::remove_tree("$dir", {
   7.131 -			keep_root => 0,
   7.132 -			error     => \$err, 
   7.133 -		});
   7.134 -		my $e = $@;
   7.135 +		File::Path::remove_tree(
   7.136 +			"$dir",
   7.137 +			{   keep_root => 0,
   7.138 +				error     => \$err,
   7.139 +			} );
   7.140 +		my $e = $EVAL_ERROR;
   7.141  		if ($e) {
   7.142  			PDWiX::Directory->throw(
   7.143  				dir     => $dir,
   7.144  				message => "Failed to remove directory, critical error:\n$e"
   7.145 -			);	
   7.146 +			);
   7.147  		}
   7.148 -		if (@{$err}) {
   7.149 +		if ( @{$err} ) {
   7.150  			my $errors = q{};
   7.151 -			for my $diag (@{$err}) {
   7.152 -				my ($file, $message) = %{$diag};
   7.153 -				if ($file eq q{}) {
   7.154 +			for my $diag ( @{$err} ) {
   7.155 +				my ( $file, $message ) = %{$diag};
   7.156 +				if ( $file eq q{} ) {
   7.157  					$errors .= "General error: $message\n";
   7.158 -				}
   7.159 -				else {
   7.160 +				} else {
   7.161  					$errors .= "Problem removing $file: $message\n";
   7.162  				}
   7.163  			}
   7.164  			PDWiX::Directory->throw(
   7.165  				dir     => $dir,
   7.166  				message => "Failed to remove directory, errors:\n$errors"
   7.167 -			);	
   7.168 -		}
   7.169 -	}
   7.170 -}
   7.171 +			);
   7.172 +		} ## end if ( @{$err} )
   7.173 +	} ## end if ( -d "$dir" )
   7.174 +
   7.175 +	return;
   7.176 +} ## end sub remove_path
   7.177  
   7.178  
   7.179  
     8.1 --- a/lib/Perl/Dist/WiX/Role/Asset.pm	Sun Jun 05 05:25:43 2011 -0600
     8.2 +++ b/lib/Perl/Dist/WiX/Role/Asset.pm	Sun Jun 05 05:42:56 2011 -0600
     8.3 @@ -367,8 +367,9 @@
     8.4  
     8.5  The C<remove_path> method is for the convienence of assets that need it.
     8.6  
     8.7 -It removes the path specified, and can take any object (e.g., a 
     8.8 -L<Path::Class::Dir>) that stringifies to a name of a directory to remove.
     8.9 +It removes the path specified, and can take any object (e.g., a
    8.10 +L<Path::Class::Dir|Path::Class::Dir>) that stringifies to a name of a
    8.11 +directory to remove.
    8.12  
    8.13  =cut
    8.14  
    8.15 @@ -377,35 +378,37 @@
    8.16  	my $dir   = rel2abs(shift);
    8.17  	my $err;
    8.18  	if ( -d "$dir" ) {
    8.19 -		File::Path::remove_tree("$dir", {
    8.20 -			keep_root => 0,
    8.21 -			error     => \$err, 
    8.22 -		});
    8.23 -		my $e = $@;
    8.24 +		File::Path::remove_tree(
    8.25 +			"$dir",
    8.26 +			{   keep_root => 0,
    8.27 +				error     => \$err,
    8.28 +			} );
    8.29 +		my $e = $EVAL_ERROR;
    8.30  		if ($e) {
    8.31  			PDWiX::Directory->throw(
    8.32  				dir     => $dir,
    8.33  				message => "Failed to remove directory, critical error:\n$e"
    8.34 -			);	
    8.35 +			);
    8.36  		}
    8.37 -		if (@{$err}) {
    8.38 +		if ( @{$err} ) {
    8.39  			my $errors = q{};
    8.40 -			for my $diag (@{$err}) {
    8.41 -				my ($file, $message) = %{$diag};
    8.42 -				if ($file eq q{}) {
    8.43 +			for my $diag ( @{$err} ) {
    8.44 +				my ( $file, $message ) = %{$diag};
    8.45 +				if ( $file eq q{} ) {
    8.46  					$errors .= "General error: $message\n";
    8.47 -				}
    8.48 -				else {
    8.49 +				} else {
    8.50  					$errors .= "Problem removing $file: $message\n";
    8.51  				}
    8.52  			}
    8.53  			PDWiX::Directory->throw(
    8.54  				dir     => $dir,
    8.55  				message => "Failed to remove directory, errors:\n$errors"
    8.56 -			);	
    8.57 -		}
    8.58 -	}
    8.59 -}
    8.60 +			);
    8.61 +		} ## end if ( @{$err} )
    8.62 +	} ## end if ( -d "$dir" )
    8.63 +
    8.64 +	return;
    8.65 +} ## end sub remove_path
    8.66  
    8.67  1;
    8.68  
     9.1 --- a/lib/Perl/Dist/WiX/Util/Machine.pm	Sun Jun 05 05:25:43 2011 -0600
     9.2 +++ b/lib/Perl/Dist/WiX/Util/Machine.pm	Sun Jun 05 05:42:56 2011 -0600
     9.3 @@ -570,33 +570,34 @@
     9.4  		# Flush out the image dir for the next run
     9.5  		my $err;
     9.6  		my $dir = $dist->image_dir();
     9.7 -		remove_tree("$dir", {
     9.8 -			keep_root => 1,
     9.9 -			error     => \$err, 
    9.10 -		});
    9.11 -		my $e = $@;
    9.12 +		remove_tree(
    9.13 +			"$dir",
    9.14 +			{   keep_root => 1,
    9.15 +				error     => \$err,
    9.16 +			} );
    9.17 +		my $e = $EVAL_ERROR;
    9.18 +
    9.19  		if ($e) {
    9.20  			PDWiX::Directory->throw(
    9.21  				dir     => $dir,
    9.22  				message => "Failed to remove directory, critical error:\n$e"
    9.23 -			);	
    9.24 +			);
    9.25  		}
    9.26 -		if (@{$err}) {
    9.27 +		if ( @{$err} ) {
    9.28  			my $errors = q{};
    9.29 -			for my $diag (@{$err}) {
    9.30 -				my ($file, $message) = %{$diag};
    9.31 -				if ($file eq q{}) {
    9.32 +			for my $diag ( @{$err} ) {
    9.33 +				my ( $file, $message ) = %{$diag};
    9.34 +				if ( $file eq q{} ) {
    9.35  					$errors .= "General error: $message\n";
    9.36 -				}
    9.37 -				else {
    9.38 +				} else {
    9.39  					$errors .= "Problem removing $file: $message\n";
    9.40  				}
    9.41  			}
    9.42  			PDWiX::Directory->throw(
    9.43  				dir     => $dir,
    9.44  				message => "Failed to remove directory, errors:\n$errors"
    9.45 -			);	
    9.46 -		}
    9.47 +			);
    9.48 +		} ## end if ( @{$err} )
    9.49  	} ## end while ( my $dist = $self->next...)
    9.50  	return 1;
    9.51  } ## end sub run