summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Changelog/Entry.pm
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2012-12-30 02:49:36 +0100
committerGuillem Jover <guillem@debian.org>2013-04-29 18:45:54 +0200
commitf215ebacf1183e33da3287533c8eec60cc5af418 (patch)
tree458435c1647bf7845cec876d15d8c50d6a4d473e /scripts/Dpkg/Changelog/Entry.pm
parent193cfded7822eab6d63e200037ac86df6ba98521 (diff)
downloaddpkg-f215ebacf1183e33da3287533c8eec60cc5af418.tar.gz
scripts: Do not use "nested" functions as they are global
Even if these functions are defined inside another function, they are still global, make them proper global functions by moving the definition outside of the outter function and mark them explicitly as being private by using an underscore prefix. There's no point in making these anonymous nested functions, as they do not need to access any variable from the outter functions. Fixes Subroutines::ProhibitNestedSubs. Warned-by: perlcritic
Diffstat (limited to 'scripts/Dpkg/Changelog/Entry.pm')
-rw-r--r--scripts/Dpkg/Changelog/Entry.pm17
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/Dpkg/Changelog/Entry.pm b/scripts/Dpkg/Changelog/Entry.pm
index e434103d5..506716d49 100644
--- a/scripts/Dpkg/Changelog/Entry.pm
+++ b/scripts/Dpkg/Changelog/Entry.pm
@@ -81,19 +81,20 @@ filehandle.
=cut
+sub _format_output_block {
+ my $lines = shift;
+ return join('', map { $_ . "\n" } @{$lines});
+}
+
sub output {
my ($self, $fh) = @_;
my $str = '';
- sub _block {
- my $lines = shift;
- return join('', map { $_ . "\n" } @{$lines});
- }
$str .= $self->{header} . "\n" if defined($self->{header});
- $str .= _block($self->{blank_after_header});
- $str .= _block($self->{changes});
- $str .= _block($self->{blank_after_changes});
+ $str .= _format_output_block($self->{blank_after_header});
+ $str .= _format_output_block($self->{changes});
+ $str .= _format_output_block($self->{blank_after_changes});
$str .= $self->{trailer} . "\n" if defined($self->{trailer});
- $str .= _block($self->{blank_after_trailer});
+ $str .= _format_output_block($self->{blank_after_trailer});
print $fh $str if defined $fh;
return $str;
}