]> git.donarmstrong.com Git - perltidy.git/commitdiff
eliminate module DevNull.pm
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 19 Aug 2023 22:27:33 +0000 (15:27 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 19 Aug 2023 22:27:33 +0000 (15:27 -0700)
MANIFEST
dev-bin/build.pl
lib/Perl/Tidy.pm
lib/Perl/Tidy/DevNull.pm [deleted file]
pm2pl

index 0c4fc56e4ddb44344ac72a7b327d5d30c8ef29e0..2301ab472115b862688d61fa77c5599a69993d0c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -37,7 +37,6 @@ INSTALL.md
 lib/Perl/Tidy.pm
 lib/Perl/Tidy.pod
 lib/Perl/Tidy/Debugger.pm
-lib/Perl/Tidy/DevNull.pm
 lib/Perl/Tidy/Diagnostics.pm
 lib/Perl/Tidy/FileWriter.pm
 lib/Perl/Tidy/Formatter.pm
@@ -97,3 +96,4 @@ t/testwide-tidy.pl.srctdy
 t/testwide-tidy.t
 t/testwide.pl.src
 t/testwide.t
+t/zero.t
index af3a1905714c3c591a796a0b2a2ef1586455de75..e5c87285de0ee425b559a938fc169b9514a5fb6d 100755 (executable)
@@ -397,7 +397,6 @@ sub update_version_number {
     push @sources, "CHANGES.md";
     my @more = qw(
       Tidy/Debugger.pm
-      Tidy/DevNull.pm
       Tidy/Diagnostics.pm
       Tidy/FileWriter.pm
       Tidy/Formatter.pm
index 825c964918aabdf5c9c246c249b84d4e459bf103..876e90a3fb6220b5596fa0e79cf3343a4a1ccb4c 100644 (file)
@@ -65,7 +65,6 @@ use Carp;
 use English     qw( -no_match_vars );
 use Digest::MD5 qw(md5_hex);
 use Perl::Tidy::Debugger;
-use Perl::Tidy::DevNull;
 use Perl::Tidy::Diagnostics;
 use Perl::Tidy::FileWriter;
 use Perl::Tidy::Formatter;
@@ -744,7 +743,7 @@ EOM
 
         # if the user defines a formatter, there is no output stream,
         # but we need a null stream to keep coding simple
-        $destination_stream = Perl::Tidy::DevNull->new();
+        $destination_stream = \my $tmp;
     }
 
     # see if ARGV is overridden
@@ -1838,17 +1837,19 @@ sub process_all_files {
 
             # If the source is from an array or string, then .LOG output
             # is only possible if a logfile stream is specified.  This prevents
-            # unexpected perltidy.LOG files.
+            # unexpected perltidy.LOG files.  If the stream is not defined
+            # then we will capture it in a string ref but it will not be
+            # accessible. Previously by Perl::Tidy::DevNull (fix c255);
             if ( !defined($logfile_stream) ) {
-                $logfile_stream = Perl::Tidy::DevNull->new();
+                $logfile_stream = \my $tmp;
 
                 # Likewise for .TEE and .DEBUG output
             }
             if ( !defined($teefile_stream) ) {
-                $teefile_stream = Perl::Tidy::DevNull->new();
+                $teefile_stream = \my $tmp;
             }
             if ( !defined($debugfile_stream) ) {
-                $debugfile_stream = Perl::Tidy::DevNull->new();
+                $debugfile_stream = \my $tmp;
             }
         }
         elsif ( $input_file eq '-' ) {    # '-' indicates input from STDIN
diff --git a/lib/Perl/Tidy/DevNull.pm b/lib/Perl/Tidy/DevNull.pm
deleted file mode 100644 (file)
index 4ee5198..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#####################################################################
-#
-# The Perl::Tidy::DevNull class supplies a dummy print method
-#
-#####################################################################
-
-package Perl::Tidy::DevNull;
-use strict;
-use warnings;
-our $VERSION = '20230701.02';
-sub new   { my $self = shift; return bless {}, $self }
-sub print { return }
-sub close { return }
-
-1;
-
diff --git a/pm2pl b/pm2pl
index 70e4c7b09677492eb8920cd33b29d154e522b4f1..99da1ccb60bcab4552d813862da12a8bf8532c98 100755 (executable)
--- a/pm2pl
+++ b/pm2pl
@@ -41,7 +41,6 @@ my $script  = 'bin/perltidy';
 my @modules = qw(
   lib/Perl/Tidy.pm
   lib/Perl/Tidy/Debugger.pm
-  lib/Perl/Tidy/DevNull.pm
   lib/Perl/Tidy/Diagnostics.pm
   lib/Perl/Tidy/FileWriter.pm
   lib/Perl/Tidy/Formatter.pm