diff options
31 files changed, 70 insertions, 68 deletions
diff --git a/dselect/methods/Dselect/Ftp.pm b/dselect/methods/Dselect/Ftp.pm index 38c2c5499..6818ac0a7 100644 --- a/dselect/methods/Dselect/Ftp.pm +++ b/dselect/methods/Dselect/Ftp.pm @@ -74,7 +74,7 @@ sub store_config { open(my $vars_fh, '>', $vars) or die "couldn't open $vars in write mode: $!\n"; - print $vars_fh Dumper(\%CONFIG); + print { $vars_fh } Dumper(\%CONFIG); close $vars_fh; } diff --git a/dselect/methods/ftp/install b/dselect/methods/ftp/install index 2d539f574..5277a651c 100755 --- a/dselect/methods/ftp/install +++ b/dselect/methods/ftp/install @@ -628,7 +628,7 @@ foreach (keys %md5sums) { } open(my $md5sums_fh, '>', "$methdir/md5sums") or die "can't open $methdir/md5sums in write mode: $!\n"; -print $md5sums_fh Dumper(\%md5sums); +print { $md5sums_fh } Dumper(\%md5sums); close $md5sums_fh; exit $exit; diff --git a/scripts/Dpkg/BuildOptions.pm b/scripts/Dpkg/BuildOptions.pm index 270525240..409d53834 100644 --- a/scripts/Dpkg/BuildOptions.pm +++ b/scripts/Dpkg/BuildOptions.pm @@ -166,7 +166,7 @@ sub output { my ($self, $fh) = @_; my $o = $self->{options}; my $res = join(' ', map { defined($o->{$_}) ? $_ . '=' . $o->{$_} : $_ } sort keys %$o); - print $fh $res if defined $fh; + print { $fh } $res if defined $fh; return $res; } diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm index cebaf8c30..42a64d7ce 100644 --- a/scripts/Dpkg/Changelog.pm +++ b/scripts/Dpkg/Changelog.pm @@ -462,12 +462,12 @@ sub output { my $str = ''; foreach my $entry (@{$self}) { my $text = $entry->output(); - print $fh $text if defined $fh; + print { $fh } $text if defined $fh; $str .= $text if defined wantarray; } my $text = $self->get_unparsed_tail(); if (defined $text) { - print $fh $text if defined $fh; + print { $fh } $text if defined $fh; $str .= $text if defined wantarray; } return $str; diff --git a/scripts/Dpkg/Changelog/Entry.pm b/scripts/Dpkg/Changelog/Entry.pm index 95a0fce75..5d0dee237 100644 --- a/scripts/Dpkg/Changelog/Entry.pm +++ b/scripts/Dpkg/Changelog/Entry.pm @@ -97,7 +97,7 @@ sub output { $str .= _format_output_block($self->{blank_after_changes}); $str .= $self->{trailer} . "\n" if defined($self->{trailer}); $str .= _format_output_block($self->{blank_after_trailer}); - print $fh $str if defined $fh; + print { $fh } $str if defined $fh; return $str; } diff --git a/scripts/Dpkg/Conf.pm b/scripts/Dpkg/Conf.pm index e30eaded8..77f25fbb0 100644 --- a/scripts/Dpkg/Conf.pm +++ b/scripts/Dpkg/Conf.pm @@ -167,7 +167,7 @@ sub output { $opt .= '"'; } $opt .= "\n"; - print $fh $opt if defined $fh; + print { $fh } $opt if defined $fh; $ret .= $opt; } return $ret; diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm index 816b100d0..ffb87c1d7 100644 --- a/scripts/Dpkg/Control/HashCore.pm +++ b/scripts/Dpkg/Control/HashCore.pm @@ -349,7 +349,7 @@ sub output { } # Print it out if ($fh) { - print $fh "$key: $value\n" + print { $fh } "$key: $value\n" or syserr(_g('write error on control data')); } $str .= "$key: $value\n" if defined wantarray; diff --git a/scripts/Dpkg/Control/Info.pm b/scripts/Dpkg/Control/Info.pm index 03875b0dc..654df34c4 100644 --- a/scripts/Dpkg/Control/Info.pm +++ b/scripts/Dpkg/Control/Info.pm @@ -182,7 +182,7 @@ sub output { my $str; $str .= $self->{source}->output($fh); foreach my $pkg (@{$self->{packages}}) { - print $fh "\n"; + print { $fh } "\n"; $str .= "\n" . $pkg->output($fh); } return $str; diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm index bb0689968..356ea8301 100644 --- a/scripts/Dpkg/Deps.pm +++ b/scripts/Dpkg/Deps.pm @@ -551,7 +551,7 @@ sub output { $res .= ' [' . join(' ', @{$self->{arches}}) . ']'; } if (defined($fh)) { - print $fh $res; + print { $fh } $res; } return $res; } @@ -937,7 +937,7 @@ sub output { my ($self, $fh) = @_; my $res = join(', ', map { $_->output() } grep { not $_->is_empty() } $self->get_deps()); if (defined($fh)) { - print $fh $res; + print { $fh } $res; } return $res; } @@ -1042,7 +1042,7 @@ sub output { my ($self, $fh) = @_; my $res = join(' | ', map { $_->output() } grep { not $_->is_empty() } $self->get_deps()); if (defined($fh)) { - print $fh $res; + print { $fh } $res; } return $res; } @@ -1150,7 +1150,7 @@ sub output { my ($self, $fh) = @_; my $res = join(', ', map { $_->output() } grep { not $_->is_empty() } $self->get_deps()); if (defined($fh)) { - print $fh $res; + print { $fh } $res; } return $res; } diff --git a/scripts/Dpkg/ErrorHandling.pm b/scripts/Dpkg/ErrorHandling.pm index 2a622ae7d..623468f5a 100644 --- a/scripts/Dpkg/ErrorHandling.pm +++ b/scripts/Dpkg/ErrorHandling.pm @@ -51,7 +51,7 @@ sub report(@) sub info($;@) { - print $info_fh report(_g('info'), @_) if (!$quiet_warnings); + print { $info_fh } report(_g('info'), @_) if (!$quiet_warnings); } sub warning($;@) @@ -72,7 +72,7 @@ sub error($;@) sub errormsg($;@) { - print STDERR report(_g('error'), @_); + print { *STDERR } report(_g('error'), @_); } sub subprocerr(@) diff --git a/scripts/Dpkg/IPC.pm b/scripts/Dpkg/IPC.pm index 9d18ab22c..b7a29212a 100644 --- a/scripts/Dpkg/IPC.pm +++ b/scripts/Dpkg/IPC.pm @@ -280,7 +280,7 @@ sub spawn { close($opts{error_to_handle}) if exists $opts{error_to_handle}; if ($opts{from_string}) { - print $from_string_pipe ${$opts{from_string}}; + print { $from_string_pipe } ${$opts{from_string}}; close($from_string_pipe); } if ($opts{to_string}) { diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm index 715be6a7b..d0c76d8c7 100644 --- a/scripts/Dpkg/Index.pm +++ b/scripts/Dpkg/Index.pm @@ -333,7 +333,7 @@ sub output { my $str = ''; foreach my $key ($self->get_keys()) { if (defined $fh) { - print $fh $self->get_by_key($key) . "\n"; + print { $fh } $self->get_by_key($key) . "\n"; } if (defined wantarray) { $str .= $self->get_by_key($key) . "\n"; diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index a4fda9b1c..713912366 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -282,19 +282,19 @@ sub output { my @deps = $self->get_dependencies($soname); my $dep_first = shift @deps; $dep_first =~ s/#PACKAGE#/$opts{package}/g if exists $opts{package}; - print $fh "$soname $dep_first\n" if defined $fh; + print { $fh } "$soname $dep_first\n" if defined $fh; $res .= "$soname $dep_first\n" if defined wantarray; foreach my $dep_next (@deps) { $dep_next =~ s/#PACKAGE#/$opts{package}/g if exists $opts{package}; - print $fh "| $dep_next\n" if defined $fh; + print { $fh } "| $dep_next\n" if defined $fh; $res .= "| $dep_next\n" if defined wantarray; } my $f = $self->{objects}{$soname}{fields}; foreach my $field (sort keys %{$f}) { my $value = $f->{$field}; $value =~ s/#PACKAGE#/$opts{package}/g if exists $opts{package}; - print $fh "* $field: $value\n" if defined $fh; + print { $fh } "* $field: $value\n" if defined $fh; $res .= "* $field: $value\n" if defined wantarray; } @@ -313,14 +313,14 @@ sub output { next if not $opts{template_mode} and not $sym->arch_is_concerned($self->get_arch()); # Dump symbol specification. Dump symbol tags only in template mode. - print $fh $sym->get_symbolspec($opts{template_mode}), "\n" if defined $fh; + print { $fh } $sym->get_symbolspec($opts{template_mode}), "\n" if defined $fh; $res .= $sym->get_symbolspec($opts{template_mode}) . "\n" if defined wantarray; # Dump pattern matches as comments (if requested) if ($opts{with_pattern_matches} && $sym->is_pattern()) { for my $match (sort { $a->get_symboltempl() cmp $b->get_symboltempl() } $sym->get_pattern_matches()) { - print $fh '#MATCH:', $match->get_symbolspec(0), "\n" if defined $fh; + print { $fh } '#MATCH:', $match->get_symbolspec(0), "\n" if defined $fh; $res .= '#MATCH:' . $match->get_symbolspec(0) . "\n" if defined wantarray; } } diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm index 3f740678f..7ef524df3 100644 --- a/scripts/Dpkg/Source/Package.pm +++ b/scripts/Dpkg/Source/Package.pm @@ -392,7 +392,7 @@ sub check_signature { timeout => 10); if (WIFEXITED($?)) { my $gpg_status = WEXITSTATUS($?); - print STDERR "$stdout$stderr" if $gpg_status; + print { *STDERR } "$stdout$stderr" if $gpg_status; if ($gpg_status == 1 or ($gpg_status && $self->{options}{require_valid_signature})) { @@ -474,7 +474,7 @@ sub extract { mkdir($srcdir) unless -e $srcdir; open(my $format_fh, '>', $format_file) or syserr(_g('cannot write %s'), $format_file); - print $format_fh $self->{fields}{'Format'} . "\n"; + print { $format_fh } $self->{fields}{'Format'} . "\n"; close($format_fh); } } diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index eae43ba34..e95d730a3 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -390,8 +390,8 @@ sub do_build { } if ($ur) { - printf(STDERR _g('%s: unrepresentable changes to source') . "\n", - $Dpkg::PROGNAME); + printf { *STDERR } _g('%s: unrepresentable changes to source') . "\n", + $Dpkg::PROGNAME; exit(1); } } diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index d1147d006..63751f054 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -221,7 +221,7 @@ sub apply_patches { my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); open(my $applied_fh, '>', $applied) or syserr(_g('cannot write %s'), $applied); - print $applied_fh "# During $opts{usage}\n"; + print { $applied_fh } "# During $opts{usage}\n"; my $timestamp = fs_time($applied); foreach my $patch ($self->get_patches($dir, %opts)) { my $path = File::Spec->catfile($dir, 'debian', 'patches', $patch); @@ -230,7 +230,7 @@ sub apply_patches { $patch_obj->apply($dir, force_timestamp => 1, timestamp => $timestamp, add_options => [ '-E' ]); - print $applied_fh "$patch\n"; + print { $applied_fh } "$patch\n"; } close($applied_fh); } @@ -596,7 +596,7 @@ sub register_patch { my $applied = File::Spec->catfile($dir, 'debian', 'patches', '.dpkg-source-applied'); open(my $applied_fh, '>>', $applied) or syserr(_g('cannot write %s'), $applied); - print $applied_fh "$patch\n"; + print { $applied_fh } "$patch\n"; close($applied_fh) or syserr(_g('cannot close %s'), $applied); } elsif (-e $patch) { unlink($patch) or syserr(_g('cannot remove %s'), $patch); @@ -727,7 +727,7 @@ sub update_debian_source_include_binaries { open(my $incbin_fh, '>>', $incbin_file) or syserr(_g('cannot write %s'), $incbin_file); foreach my $binary (@unknown_binaries) { - print $incbin_fh "$binary\n"; + print { $incbin_fh } "$binary\n"; info(_g('adding %s to %s'), $binary, 'debian/source/include-binaries'); $self->{allowed_binaries}{$binary} = 1; } diff --git a/scripts/Dpkg/Source/Package/V3/Quilt.pm b/scripts/Dpkg/Source/Package/V3/Quilt.pm index cb004af58..814327d1a 100644 --- a/scripts/Dpkg/Source/Package/V3/Quilt.pm +++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm @@ -224,7 +224,7 @@ sub _add_line { my ($file, $line) = @_; open(my $file_fh, '>>', $file) or syserr(_g('cannot write %s'), $file); - print $file_fh "$line\n"; + print { $file_fh } "$line\n"; close($file_fh); } @@ -235,7 +235,7 @@ sub _drop_line { my @lines = <$file_fh>; close($file_fh); open($file_fh, '>', $file) or syserr(_g('cannot write %s'), $file); - print($file_fh $_) foreach grep { not /^\Q$re\E\s*$/ } @lines; + print { $file_fh } $_ foreach grep { not /^\Q$re\E\s*$/ } @lines; close($file_fh); } diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm index 05be28c49..44e393c72 100644 --- a/scripts/Dpkg/Source/Patch.pm +++ b/scripts/Dpkg/Source/Patch.pm @@ -125,7 +125,7 @@ sub add_diff_file { $self->print(*$self->{header}) or syserr(_g('failed to write')); *$self->{empty} = 0; } - print $self $_ or syserr(_g('failed to write')); + print { $self } $_ or syserr(_g('failed to write')); } close($diffgen) or syserr('close on diff pipe'); wait_child($diff_pid, nocheck => 1, @@ -557,8 +557,8 @@ sub apply { error_to_string => \$stderr, ); if ($?) { - print STDOUT $stdout; - print STDERR $stderr; + print { *STDOUT } $stdout; + print { *STDERR } $stderr; subprocerr('LC_ALL=C patch ' . join(' ', @{$opts{options}}) . ' < ' . $self->get_filename()); } diff --git a/scripts/Dpkg/Source/Quilt.pm b/scripts/Dpkg/Source/Quilt.pm index 3958b6dd1..0ece475a2 100644 --- a/scripts/Dpkg/Source/Quilt.pm +++ b/scripts/Dpkg/Source/Quilt.pm @@ -56,7 +56,7 @@ sub setup_db { my $file = $self->get_db_file('.version'); if (not -e $file) { open(my $version_fh, '>', $file) or syserr(_g('cannot write %s'), $file); - print $version_fh "2\n"; + print { $version_fh } "2\n"; close($version_fh); } # The files below are used by quilt to know where patches are stored @@ -65,7 +65,7 @@ sub setup_db { $file = $self->get_db_file('.quilt_patches'); if (not -e $file) { open(my $qpatch_fh, '>', $file) or syserr(_g('cannot write %s'), $file); - print $qpatch_fh "debian/patches\n"; + print { $qpatch_fh } "debian/patches\n"; close($qpatch_fh); } $file = $self->get_db_file('.quilt_series'); @@ -73,7 +73,7 @@ sub setup_db { open(my $qseries_fh, '>', $file) or syserr(_g('cannot write %s'), $file); my $series = $self->get_series_file(); $series = (File::Spec->splitpath($series))[2]; - print $qseries_fh "$series\n"; + print { $qseries_fh } "$series\n"; close($qseries_fh); } } @@ -93,7 +93,7 @@ sub write_db { open(my $applied_fh, '>', $pc_applied) or syserr(_g('cannot write %s'), $pc_applied); foreach my $patch (@{$self->{applied_patches}}) { - print $applied_fh "$patch\n"; + print { $applied_fh } "$patch\n"; } close($applied_fh); } diff --git a/scripts/Dpkg/Substvars.pm b/scripts/Dpkg/Substvars.pm index 8992a2fee..8095a7de4 100644 --- a/scripts/Dpkg/Substvars.pm +++ b/scripts/Dpkg/Substvars.pm @@ -320,7 +320,7 @@ sub output { foreach my $vn (sort keys %{$self->{vars}}) { next if /^(?:(?:dpkg|source|binary):(?:Source-)?Version|Space|Tab|Newline|Arch|Source-Version|F:.+)$/; my $line = "$vn=" . $self->{vars}{$vn} . "\n"; - print $fh $line if defined $fh; + print { $fh } $line if defined $fh; $str .= $line; } return $str; diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index 4601f3f3c..3c0d6433b 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -444,7 +444,7 @@ if (defined($since)) { push @changes_opts, "-v$since" } if (defined($desc)) { push @changes_opts, "-C$desc" } my $chg = "../$pva.changes"; -print STDERR " dpkg-genchanges @changes_opts >$chg\n"; +print { *STDERR } " dpkg-genchanges @changes_opts >$chg\n"; open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts or subprocerr('dpkg-genchanges'); @@ -452,7 +452,7 @@ open my $out_fh, '>', $chg or syserr(_g('write changes file')); my $infiles = my $files = ''; while ($_ = <$changes_fh>) { - print $out_fh $_ or syserr(_g('write changes file')); + print { $out_fh } $_ or syserr(_g('write changes file')); chomp; if (/^Files:/i) { @@ -524,14 +524,14 @@ sub mustsetvar { sub withecho { shift while !$_[0]; - print STDERR " @_\n"; + print { *STDERR } " @_\n"; system(@_) and subprocerr("@_"); } sub signfile { my ($file) = @_; - print STDERR " signfile $file\n"; + print { *STDERR } " signfile $file\n"; my $qfile = quotemeta($file); system("(cat ../$qfile ; echo '') | " . diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index 33046b4d2..72485e8e4 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -113,12 +113,12 @@ if ($bc_value) { } if (@unmet) { - printf STDERR _g('%s: Unmet build dependencies: '), $Dpkg::PROGNAME; - print STDERR join(' ', map { $_->output() } @unmet), "\n"; + printf { *STDERR } _g('%s: Unmet build dependencies: '), $Dpkg::PROGNAME; + print { *STDERR } join(' ', map { $_->output() } @unmet), "\n"; } if (@conflicts) { - printf STDERR _g('%s: Build conflicts: '), $Dpkg::PROGNAME; - print STDERR join(' ', map { $_->output() } @conflicts), "\n"; + printf { *STDERR } _g('%s: Build conflicts: '), $Dpkg::PROGNAME; + print { *STDERR } join(' ', map { $_->output() } @conflicts), "\n"; } exit 1 if @unmet || @conflicts; diff --git a/scripts/dpkg-distaddfile.pl b/scripts/dpkg-distaddfile.pl index 233f12ecd..cca9335af 100755 --- a/scripts/dpkg-distaddfile.pl +++ b/scripts/dpkg-distaddfile.pl @@ -89,14 +89,14 @@ if (open(my $fileslist_fh, '<', $fileslistfile)) { while (<$fileslist_fh>) { s/\n$//; next if m/^(\S+) / && $1 eq $file; - print($fileslistnew_fh "$_\n") + print { $fileslistnew_fh } "$_\n" or syserr(_g('copy old entry to new files list file')); } close $fileslist_fh or syserr(_g('cannot close %s'), $fileslistfile); } elsif ($! != ENOENT) { syserr(_g('read old files list file')); } -print($fileslistnew_fh "$file $section $priority\n") +print { $fileslistnew_fh } "$file $section $priority\n" or syserr(_g('write new entry to new files list file')); close($fileslistnew_fh) or syserr(_g('close new files list file')); rename("$fileslistfile.new", $fileslistfile) diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl index dbc08f194..808218b4a 100755 --- a/scripts/dpkg-genchanges.pl +++ b/scripts/dpkg-genchanges.pl @@ -146,11 +146,11 @@ while (@ARGV) { } elsif (m/^-B$/) { usageerr(_g('cannot combine %s and %s'), $_, '-S') if is_sourceonly; $include = ARCH_DEP; - printf STDERR _g('%s: arch-specific upload - not including arch-independent packages') . "\n", $Dpkg::PROGNAME; + printf { *STDERR } _g('%s: arch-specific upload - not including arch-independent packages') . "\n", $Dpkg::PROGNAME; } elsif (m/^-A$/) { usageerr(_g('cannot combine %s and %s'), $_, '-S') if is_sourceonly; $include = ARCH_INDEP; - printf STDERR _g('%s: arch-indep upload - not including arch-specific packages') . "\n", $Dpkg::PROGNAME; + printf { *STDERR } _g('%s: arch-indep upload - not including arch-specific packages') . "\n", $Dpkg::PROGNAME; } elsif (m/^-S$/) { usageerr(_g('cannot combine %s and %s'), binary_opt, '-S') if is_binaryonly; @@ -447,7 +447,7 @@ if (!is_binaryonly) { $origsrcmsg= _g('binary-only upload - not including any source code'); } -print(STDERR "$Dpkg::PROGNAME: $origsrcmsg\n") +print { *STDERR } "$Dpkg::PROGNAME: $origsrcmsg\n" or syserr(_g('write original source message')) unless $quiet; $fields->{'Format'} = $substvars->get('Format'); diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl index 7e14643fb..5d08a39a7 100755 --- a/scripts/dpkg-gencontrol.pl +++ b/scripts/dpkg-gencontrol.pl @@ -386,7 +386,7 @@ if (open(my $fileslist_fh, '<', $fileslistfile)) { && ($3 eq $pkg_type) && (debarch_eq($2, $fields->{'Architecture'} || '') || debarch_eq($2, 'all')); - print($fileslistnew_fh "$_\n") + print { $fileslistnew_fh } "$_\n" or syserr(_g('copy old entry to new files list file')); } close($fileslist_fh) or syserr(_g('close old files list file')); @@ -398,10 +398,11 @@ $sversion =~ s/^\d+://; $forcefilename //= sprintf('%s_%s_%s.%s', $oppackage, $sversion, $fields->{'Architecture'} || '', $pkg_type); -print($fileslistnew_fh $substvars->substvars(sprintf("%s %s %s\n", - $forcefilename, - $fields->{'Section'} || '-', - $fields->{'Priority'} || '-'))) +print { $fileslistnew_fh } + $substvars->substvars(sprintf("%s %s %s\n", + $forcefilename, + $fields->{'Section'} || '-', + $fields->{'Priority'} || '-')) or syserr(_g('write new entry to new files list file')); close($fileslistnew_fh) or syserr(_g('close new files list file')); rename("$fileslistfile.new", $fileslistfile) diff --git a/scripts/dpkg-mergechangelogs.pl b/scripts/dpkg-mergechangelogs.pl index f773cc616..9eb9fce24 100755 --- a/scripts/dpkg-mergechangelogs.pl +++ b/scripts/dpkg-mergechangelogs.pl @@ -135,7 +135,7 @@ while (1) { if (defined($out_file) and $out_file ne '-') { open(my $out_fh, '>', $out_file) or syserr(_g('cannot write %s'), $out_file); - print $out_fh ((blessed $_) ? "$_" : "$_\n") foreach @result; + print { $out_fh } ((blessed $_) ? "$_" : "$_\n") foreach @result; close($out_fh) or syserr(_g('cannot write %s'), $out_file); } else { print ((blessed $_) ? "$_" : "$_\n") foreach @result; diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 258650624..7129dc2b5 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -464,7 +464,7 @@ if ($stdout) { or syserr(_g("open old varlist file \`%s' for reading"), $varlistfile); while (my $entry = <$old_fh>) { next if $entry =~ m/^\Q$varnameprefix\E:/; - print($new_fh $entry) + print { $new_fh } $entry or syserr(_g("copy old entry to new varlist file \`%s'"), "$varlistfile.new"); } @@ -531,7 +531,7 @@ foreach my $field (reverse @depfields) { my $obj = deps_parse($dep); error(_g('invalid dependency got generated: %s'), $dep) unless defined $obj; $obj->sort(); - print $fh "$varnameprefix:$field=$obj\n"; + print { $fh } "$varnameprefix:$field=$obj\n"; } } @@ -857,7 +857,7 @@ sub find_packages { chomp($_); if (m/^local diversion |^diversion by/) { warning(_g('diversions involved - output may be incorrect')); - print(STDERR " $_\n") + print { *STDERR } " $_\n" or syserr(_g('write diversion info to stderr')); } elsif (m/^([-a-z0-9+.:, ]+): (\/.*)$/) { $cached_pkgmatch{$2} = $pkgmatch->{$2} = [ split(/, /, $1) ]; diff --git a/scripts/t/800_Dpkg_IPC.t b/scripts/t/800_Dpkg_IPC.t index 64c225619..63cd7475d 100644 --- a/scripts/t/800_Dpkg_IPC.t +++ b/scripts/t/800_Dpkg_IPC.t @@ -32,7 +32,7 @@ my $string2; open $tmp_fh, '>', $tmp1_name or die "cannot open $tmp1_name: $!"; -print $tmp_fh $string1; +print { $tmp_fh } $string1; close $tmp_fh; my $pid = spawn(exec => 'cat', diff --git a/scripts/t/850_Dpkg_Compression.t b/scripts/t/850_Dpkg_Compression.t index 6f0e9b090..9f503bbfc 100644 --- a/scripts/t/850_Dpkg_Compression.t +++ b/scripts/t/850_Dpkg_Compression.t @@ -31,9 +31,9 @@ sub test_write { $fh = Dpkg::Compression::FileHandle->new(); open $fh, '>', $filename or die 'open failed'; - print $fh $lines[0]; + print { $fh } $lines[0]; syswrite($fh, $lines[1]); - printf $fh '%s', $lines[2]; + printf { $fh } '%s', $lines[2]; close $fh or die 'close failed'; &$check_result($filename, 'std functions'); diff --git a/src/t/100_dpkg_divert.t b/src/t/100_dpkg_divert.t index d9ccd9a7b..56a64cc28 100644 --- a/src/t/100_dpkg_divert.t +++ b/src/t/100_dpkg_divert.t @@ -51,7 +51,7 @@ sub install_diversions { my ($txt) = @_; open(my $db_fh, '>', "$admindir/diversions") or die "cannot create $admindir/diversions"; - print $db_fh $txt; + print { $db_fh } $txt; close($db_fh); } @@ -60,13 +60,13 @@ sub install_filelist { open(my $fileslist_fh, '>', "$admindir/info/$pkg.list") or die "cannot create $admindir/info/$pkg.list"; for my $file (@files) { - print $fileslist_fh "$file\n"; + print { $fileslist_fh } "$file\n"; } close($fileslist_fh); # Only installed packages have their files list considered. open(my $status_fh, '>>', "$admindir/status") or die "cannot append to $admindir/status"; - print $status_fh <<"EOF"; + print { $status_fh } <<"EOF"; Package: $pkg Status: install ok installed Version: 0 diff --git a/test/100_critic.t b/test/100_critic.t index fdf0c2dda..761a604d3 100644 --- a/test/100_critic.t +++ b/test/100_critic.t @@ -65,6 +65,7 @@ my @policies = qw( InputOutput::ProhibitOneArgSelect InputOutput::ProhibitReadlineInForLoop InputOutput::ProhibitTwoArgOpen + InputOutput::RequireBracedFileHandleWithPrint InputOutput::RequireCheckedOpen InputOutput::RequireEncodingWithUTF8Layer Miscellanea::ProhibitFormats |