[libconfig-model-dpkg-perl] 02/07: DpkgSyntax: write_dpkg_text is deprecated in favor of format_dpkg_text

dod at debian.org dod at debian.org
Sat Sep 7 14:56:27 UTC 2013


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.

commit 3e6e338b2bf80ca1cc8904304508827280e8af4b
Author: Dominique Dumont <dod at debian.org>
Date:   Thu Sep 5 08:40:49 2013 +0200

    DpkgSyntax: write_dpkg_text is deprecated in favor of format_dpkg_text
---
 lib/Config/Model/Backend/DpkgSyntax.pm |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/Config/Model/Backend/DpkgSyntax.pm b/lib/Config/Model/Backend/DpkgSyntax.pm
index 5f97269..d7caec6 100644
--- a/lib/Config/Model/Backend/DpkgSyntax.pm
+++ b/lib/Config/Model/Backend/DpkgSyntax.pm
@@ -174,14 +174,21 @@ sub write_dpkg_section {
 }
 
 sub write_dpkg_text {
-     my ($self, $ioh, $text) = @_ ;
+    my ($self, $ioh, $text) = @_ ;
+    carp "write_dpkg_text is deprecated";
+    $ioh->print ( join("\n", $self->format_dpkg_text($ioh,$text)), "\n" );
+}
+sub format_dpkg_text {
+    my ($self, $ioh, $text) = @_ ;
 
     return unless $text ;
     my @lines = split /\n/,$text ;
-    $ioh->print ( ' ' . shift (@lines) . "\n" ) ;
+    my $i = 0 ;
     foreach (@lines) {
-        $ioh->print ( /\S/ ? " $_\n" : " .\n") ;
+        s/^/ /gm;
+        s/^\s*$/ ./gm if $i++; # don't put '.' on first line if emtpy
     }
+    return @lines ;
 }
 
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git



More information about the Pkg-perl-cvs-commits mailing list