From aac630cc7807f983a90818898c273cbe100de28d Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Sun, 9 Oct 2005 18:05:15 +0000 Subject: - add delvalue() --- lib/MDV/Distribconf/Build.pm | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'lib/MDV/Distribconf') diff --git a/lib/MDV/Distribconf/Build.pm b/lib/MDV/Distribconf/Build.pm index 1d5cb4c..007a6ef 100644 --- a/lib/MDV/Distribconf/Build.pm +++ b/lib/MDV/Distribconf/Build.pm @@ -16,7 +16,7 @@ # # $Id$ -package Distribconf::Build; +package MDV::Distribconf::Build; =head1 NAME @@ -30,10 +30,10 @@ Distribconf::Build - Extension to Distribconf to build configuration use strict; use warnings; -use Distribconf; +use MDV::Distribconf; our @ISA = qw(Distribconf); -our $VERSION = $Distribconf::VERSION; +our $VERSION = $MDV::Distribconf::VERSION; =item Distribconf::Build->new($root_of_distrib) @@ -63,12 +63,28 @@ sub setvalue { return; }; $distrib->{cfg}->newval($media, $var, $val) - or die "Can't set value [$var=$val] for $media\n"; + or warn "Can't set value [$var=$val] for $media\n"; } else { $distrib->{cfg}->AddSection($media); } } +=item $distrib->delvalue($media, $var) + +Delete $var parameter from $media. If $var is not specified, the media is +is deleted. If $media is not specified, $var is remove from global settings. + +=cut + +sub delvalue { + my ($distrib, $media, $var) = @_; + if ($var) { + $distrib->{cfg}->delval($media, $var); + } else { + $distrib->{cfg}->DeleteSection($media); + } +} + =item $distrib->write_hdlists($hdlists) Writes the F file to C<$hdlists>, or if no parameter is given, in -- cgit v1.2.1