From: Steve Hancock Date: Sat, 19 Aug 2023 22:27:33 +0000 (-0700) Subject: eliminate module DevNull.pm X-Git-Tag: 20230701.03~11 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6f637cfef5f8885b4e2ccaefaa855c0a580539b3;p=perltidy.git eliminate module DevNull.pm --- diff --git a/MANIFEST b/MANIFEST index 0c4fc56e..2301ab47 100644 --- 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 diff --git a/dev-bin/build.pl b/dev-bin/build.pl index af3a1905..e5c87285 100755 --- a/dev-bin/build.pl +++ b/dev-bin/build.pl @@ -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 diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 825c9649..876e90a3 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -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 index 4ee5198f..00000000 --- a/lib/Perl/Tidy/DevNull.pm +++ /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 70e4c7b0..99da1ccb 100755 --- 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