fix non-debug verbosity
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 20 Sep 2009 16:11:16 +0000 (16:11 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 20 Sep 2009 16:11:16 +0000 (16:11 +0000)
lib/PXElator/file.pm

index 8337b6a..94a1a6b 100644 (file)
@@ -6,7 +6,7 @@ use Carp qw/carp confess/;
 use File::Path qw//;
 use Data::Dump qw/dump/;
 
-my $debug = 1;
+my $debug = 0;
 
 sub mkpath {
        my $file = shift;
@@ -39,17 +39,19 @@ sub append {
 #              $content =~ s{[\n\r]*$}{\n}s;
 
                if ( $on_disk =~ s{([\s+]exit[\s\d]*)$}{\n$content\n$1}s ) {
-#                      warn "# insert $file\n$on_disk";
+                       warn "# insert $file\n$on_disk" if $debug;
                        write_file $file, $on_disk;
                } else {
-#                      warn "# append $file\n$content\n";
+                       warn "# append $file\n$content\n" if $debug;
                        open($fh, '>>', $file);
                        print $fh $content;
                        close($fh);
                }
 
-               carp "## append to $file";
+               carp "## append to $file" if $debug;
                return -s $file;
+       } else {
+               warn "## $file not modified" if $debug;
        }
 }