mirror of
				https://codeberg.org/h3xx/simplify_static_dir
				synced 2024-08-14 23:57:24 +00:00 
			
		
		
		
	Use croak/carp instead of die/warn (PBP)
This commit is contained in:
		
							parent
							
								
									4e2e94881b
								
							
						
					
					
						commit
						3e96b9bc19
					
				
					 3 changed files with 8 additions and 5 deletions
				
			
		|  | @ -2,6 +2,7 @@ package Directory::Simplify::Instruction::Generator; | |||
| use strict; | ||||
| use warnings; | ||||
| use overload '""' => 'as_string'; | ||||
| use Carp qw/ carp /; | ||||
| require File::Compare; | ||||
| 
 | ||||
| # :squash-remove-start: | ||||
|  | @ -126,7 +127,7 @@ sub _entries_contents_match { | |||
| 
 | ||||
|     # warn about hash collision | ||||
|     unless ($contents_same) { | ||||
|         warn "Hash collision between files:\n* $entry_a->{name}\n* $entry_b->{name}\n  (don't panic)\n"; | ||||
|         carp "Hash collision between files:\n* $entry_a->{name}\n* $entry_b->{name}\n  (don't panic)\n"; | ||||
|     } | ||||
|     return $contents_same; | ||||
| } | ||||
|  | @ -147,7 +148,7 @@ sub instructions { | |||
|         my @non_readonly; | ||||
|         foreach my $entry (@{$bucket}) { | ||||
|             unless (-w $entry->{dirname}) { | ||||
|                 warn "Warning: $entry->{name} not able to be unlinked!"; | ||||
|                 carp "Warning: $entry->{name} not able to be unlinked!"; | ||||
|             } | ||||
|             push @non_readonly, $entry; | ||||
|         } | ||||
|  |  | |||
|  | @ -2,6 +2,7 @@ package Directory::Simplify::Instruction::Hardlink; | |||
| use strict; | ||||
| use warnings; | ||||
| use overload '""' => 'as_string'; | ||||
| use Carp qw/ croak /; | ||||
| 
 | ||||
| # :squash-remove-start: | ||||
| require Directory::Simplify::Utils; | ||||
|  | @ -20,10 +21,10 @@ sub run { | |||
|     # hard link the files | ||||
| 
 | ||||
|     unless (unlink $self->{target}->{name}) { | ||||
|         die "Failed to remove file `$self->{target}->{name}': $!\n"; | ||||
|         croak "Failed to remove file `$self->{target}->{name}': $!\n"; | ||||
|     } | ||||
|     unless (link $self->{source}->{name}, $self->{target}->{name}) { | ||||
|         die "Failed to hard link `$self->{source}->{name}' => `$self->{target}->{name}': $!"; | ||||
|         croak "Failed to hard link `$self->{source}->{name}' => `$self->{target}->{name}': $!"; | ||||
|     } | ||||
|     # bookkeeping | ||||
|     ++$self->{source}->{nlink}; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue