Browse code

cosmetic cleanups

René Wagner authored on 30.09.2019 18:20:01
Showing 2 changed files

... ...
@@ -11,7 +11,7 @@ use File::Find::Rule;
11 11
 use File::Find;
12 12
 use Switch;
13 13
 
14
-my $VERSION = 0.1;
14
+my $VERSION = '0.1';
15 15
 my $PROGRAM = 'Multiversion Sidecar Cleaner';
16 16
 
17 17
 my $delete_flag = 0;
... ...
@@ -41,13 +41,10 @@ sub main
41 41
 	print "files with newer versions:\r\n";
42 42
 
43 43
 	# alle Dateien in allen Unterordnern *.spd *.spf suchen
44
-	my $rule =  File::Find::Rule->new;
45
-	$rule->file;
46
-	$rule->name( '*.spd', '*.spf' );
47
-	my @files = $rule->in( $dir );
44
+
45
+	my @files = File::Find::Rule->file->name( '*.spd', '*.spf' )->in( $dir );
48 46
 	
49
-	my $file;
50
-	foreach $file ( @files )
47
+	foreach my $file ( @files )
51 48
 	{
52 49
 		if ( exist_newer_file($file) )
53 50
 		{
... ...
@@ -88,12 +85,9 @@ sub exist_newer_file
88 85
 		
89 86
 		my $filefinder_regex = "$fileparts[0].$fileparts[1].$version_regex.$fileparts[3]";
90 87
 	
91
-		my $versions_rule = File::Find::Rule->new;
92
-		$versions_rule->file;
93
-		$versions_rule->name( $filefinder_regex );
94
-		my @files = $versions_rule->in( dirname($original_file) );
88
+		my @version_files = File::Find::Rule->file->name( $filefinder_regex )->maxdepth(1)->in( dirname($original_file) );
95 89
 	
96
-		if ( scalar @files )
90
+		if ( scalar @version_files )
97 91
 		{
98 92
 			return 1;
99 93
 		}
... ...
@@ -11,7 +11,7 @@ use File::Find::Rule;
11 11
 use File::Find;
12 12
 use Switch;
13 13
 
14
-my $VERSION = 0.1;
14
+my $VERSION = '0.1';
15 15
 my $PROGRAM = 'Orphaned Sidecar Cleaner';
16 16
 
17 17
 # parse commandline args
... ...
@@ -43,13 +43,9 @@ sub main
43 43
 	print "files with missing raw:\r\n";
44 44
 
45 45
 	# alle Dateien in allen Unterordnern *.spd *.spf suchen
46
-	my $rule =  File::Find::Rule->new;
47
-	$rule->file;
48
-	$rule->name( '*.spd', '*.spf' );
49
-	my @files = $rule->in( $dir );
46
+	my @files = File::Find::Rule->file->name( '*.spd', '*.spf' )->in( $dir );
50 47
 	
51
-	my $file;
52
-	foreach $file ( @files )
48
+	foreach my $file ( @files )
53 49
 	{
54 50
 		if ( ! exists_raw_filename($file) )
55 51
 		{