mirror of
				https://codeberg.org/h3xx/simplify_static_dir
				synced 2024-08-14 23:57:24 +00:00 
			
		
		
		
	Refactor FileHash to expect named arguments
This commit is contained in:
		
							parent
							
								
									31fe372e09
								
							
						
					
					
						commit
						15c466e581
					
				
					 2 changed files with 5 additions and 12 deletions
				
			
		|  | @ -22,16 +22,9 @@ sub new { | |||
| } | ||||
| 
 | ||||
| sub add { | ||||
|     my $self = shift; | ||||
|     my (@files, $callback); | ||||
|     if (ref $_[0] eq 'HASH') { | ||||
|         # Called method like { files => [] } | ||||
|         my %opts = %{$_[0]}; | ||||
|         @files = @{$opts{files}}; | ||||
|         $callback = $opts{callback}; | ||||
|     } else { | ||||
|         @files = @_; | ||||
|     } | ||||
|     my ($self, %args) = @_; | ||||
|     my @files = @{$args{files}}; | ||||
|     my $callback = $args{callback}; | ||||
|     foreach my $file (@files) { | ||||
|         unless (ref $file eq 'Directory::Simplify::File') { | ||||
|             $file = Directory::Simplify::File->new($file); | ||||
|  |  | |||
|  | @ -230,10 +230,10 @@ MAIN: { | |||
|             } | ||||
|         }; | ||||
|     } | ||||
|     $filehash->add({ | ||||
|     $filehash->add( | ||||
|         files => \@files, | ||||
|         callback => $cb, | ||||
|     }); | ||||
|     ); | ||||
|     print STDERR "done.\n" | ||||
|         if $verbose; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue