[libconfig-model-dpkg-perl] 04/11: use File::Path to create and delete files in debian/
dod at debian.org
dod at debian.org
Mon Jul 11 18:23:20 UTC 2016
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 366f48b0e3b56a4ecd489557fe82abe89f75d24d
Author: Dominique Dumont <dod at debian.org>
Date: Fri Jul 8 18:53:24 2016 +0200
use File::Path to create and delete files in debian/
---
lib/Config/Model/Backend/Dpkg.pm | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/lib/Config/Model/Backend/Dpkg.pm b/lib/Config/Model/Backend/Dpkg.pm
index 4c6617a..54834fd 100644
--- a/lib/Config/Model/Backend/Dpkg.pm
+++ b/lib/Config/Model/Backend/Dpkg.pm
@@ -100,7 +100,7 @@ sub write {
# write data from leaf element from the node
foreach my $elt ( $node->get_element_name() ) {
- my $file = $dir . $elt;
+ my $file = path($dir)->child($elt);
my $obj = $args{object}->fetch_element( name => $elt );
my $type = $obj->get_type;
@@ -124,15 +124,11 @@ sub write {
if (@v) {
$logger->trace("Dpkg write opening $file to write");
- my $fh = new IO::File;
- $fh->open( $file, '>' ) or die "Cannot open $file:$!";
- $fh->binmode(":utf8");
- $fh->print(@v);
- $fh->close;
+ $file->spew_utf8(@v) ;
}
elsif ($args{auto_delete} and not $skip) {
warn "deleting $file";
- path($dir)->child($file)->remove;
+ $file->remove;
}
}
--
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