aboutsummaryrefslogtreecommitdiffstats
path: root/Distribconf.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-30 12:43:20 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-09-30 12:43:20 +0000
commitad3ac793135a809a97707e4a4743c755a37306d6 (patch)
tree7e8d6ad6a6671415f5df55aa99656c59bfd877ef /Distribconf.pm
parent8c72bca81bb7c74c285d2a99c36f7b33e04e1d24 (diff)
downloadrpmtools-ad3ac793135a809a97707e4a4743c755a37306d6.tar
rpmtools-ad3ac793135a809a97707e4a4743c755a37306d6.tar.gz
rpmtools-ad3ac793135a809a97707e4a4743c755a37306d6.tar.bz2
rpmtools-ad3ac793135a809a97707e4a4743c755a37306d6.tar.xz
rpmtools-ad3ac793135a809a97707e4a4743c755a37306d6.zip
Use meaningful return values for DistribConf::load()
Diffstat (limited to 'Distribconf.pm')
-rw-r--r--Distribconf.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/Distribconf.pm b/Distribconf.pm
index 0e269ed..8c7735c 100644
--- a/Distribconf.pm
+++ b/Distribconf.pm
@@ -11,7 +11,7 @@ Distribconf - perl module to get config from a Mandriva Linux distribution tree
use Distribconf;
my $d = Distribconf->new("/path/to/the/distribution/root");
- $d->load() == 0
+ $d->load()
or die "This doesn't seem to be a distribution tree\n";
print $d->getpath(undef, "root") ."\n";
@@ -179,22 +179,19 @@ Finds and loads the configuration of the distrib: locate the path where
information is found; if available loads F<media.cfg>, if available loads
F<hdlists>.
-Returns 0 on success, 1 if no directory containing media information is found,
-2 if no F<media.cfg>, neither F<hdlists> files are found.
+Returns 1 on success, 0 error (that is, if no directory containing media
+information is found, or if no F<media.cfg>, neither F<hdlists> files are
+found).
See also L<loadtree>, L<parse_hdlists> and L<parse_mediacfg>.
=cut
-# TODO return 0 on error like everyone else does
-
sub load {
my ($distrib) = @_;
- $distrib->loadtree() or return 1;
-
- $distrib->parse_mediacfg() || $distrib->parse_hdlists() or return 2;
-
- return 0;
+ $distrib->loadtree() or return 0;
+ $distrib->parse_mediacfg() || $distrib->parse_hdlists() or return 0;
+ return 1;
}
=head2 $distrib->loadtree()