diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-19 22:00:30 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-08-19 22:00:30 +0200 |
commit | 462817c30c5ee71c38d55e000ad4a4bc9e31ecf9 (patch) | |
tree | d1324944c24bd63b5abe1c59a7c3a48190ce6402 /lib/SlackBuild | |
parent | a96449bfca2752e6667e3677c5b5a2ea3ab1d8f2 (diff) | |
download | slackbuilder-462817c30c5ee71c38d55e000ad4a4bc9e31ecf9.tar.gz slackbuilder-462817c30c5ee71c38d55e000ad4a4bc9e31ecf9.tar.bz2 |
Use the recent git version of Config::Parser::Ini
* lib/SlackBuild/Config.pm (new): Rewrite as the "mangle" method.
Diffstat (limited to 'lib/SlackBuild')
-rw-r--r-- | lib/SlackBuild/Config.pm | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/lib/SlackBuild/Config.pm b/lib/SlackBuild/Config.pm index 679f1e7..b96a457 100644 --- a/lib/SlackBuild/Config.pm +++ b/lib/SlackBuild/Config.pm @@ -19,28 +19,17 @@ use strict; use warnings; use parent 'Config::Parser::Ini'; use File::Spec; -use feature 'state'; -sub new { - my $class = shift; - state $level; - - $level++; - my $self = $class->SUPER::new(@_); - - if ($level == 1) { - my $rootdir = $self->get(qw(dir root)); - foreach my $kw ($self->names_of('dir')) { - next if $kw eq 'root'; - my $subdir = $self->get('dir', $kw); - unless (File::Spec->file_name_is_absolute($subdir)) { - $self->set('dir', $kw, File::Spec->catfile($rootdir, $subdir)); - } +sub mangle { + my $self = shift; + my $rootdir = $self->get(qw(dir root)); + foreach my $kw ($self->names_of('dir')) { + next if $kw eq 'root'; + my $subdir = $self->get('dir', $kw); + unless (File::Spec->file_name_is_absolute($subdir)) { + $self->set('dir', $kw, File::Spec->catfile($rootdir, $subdir)); } } - - $level--; - return $self; } sub check_dir { |