]> git.donarmstrong.com Git - perltidy.git/commitdiff
add comment
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 30 Dec 2024 18:18:00 +0000 (10:18 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 30 Dec 2024 18:18:00 +0000 (10:18 -0800)
examples/dump_unique_keys.pl

index cdd1176e76d08fcd418f06b78084bb72ed8b6201..d5b771d374addde72fe99cc53ee49cede13f0541 100755 (executable)
@@ -7,6 +7,16 @@ use File::Temp qw{ tempfile };
 # show hash keys which just appear in one file.
 # Requires Perl::Tidy version 20240903.09 or higher
 
+# The latest version of this file should be at:
+# https://github.com/perltidy/perltidy/blob/master/examples/dump_unique_keys.pl
+
+my ( $fh_tmp, $tmpfile );
+END {
+    if ( defined($tmpfile) && -e $tmpfile ) {
+        unlink($tmpfile) or warn "Could not unlink $tmpfile: $!";
+    }
+}
+
 main();
 
 sub main {
@@ -33,7 +43,7 @@ EOM
         if ( !-e $file ) { die "file '$file' not found\n" }
     }
 
-    my ( $fh_tmp, $tmpfile ) = tempfile();
+    ( $fh_tmp, $tmpfile ) = tempfile();
     if ( !$fh_tmp ) {
         die "unable to open temporary file $tmpfile\n";
     }
@@ -82,11 +92,6 @@ EOM
 
     print {*STDOUT} $output_string;
 
-    END {
-        if ( defined($tmpfile) && -e $tmpfile ) {
-            unlink($tmpfile) or warn "Could not unlink $tmpfile: $!";
-        }
-    }
 } ## end sub main
 
 sub read_MANIFEST {