diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-03-07 15:33:31 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-03-07 16:40:56 +0200 |
commit | 068dcd502cc83d60c90443127352ec255df442db (patch) | |
tree | d0a970b21d299264f9c61b83a00115a74c8f574b /lib/App/Beam/Config.pm | |
parent | 9dbc51556ad400f03495b3b85b0b5995362cd35c (diff) | |
download | beam-068dcd502cc83d60c90443127352ec255df442db.tar.gz beam-068dcd502cc83d60c90443127352ec255df442db.tar.bz2 |
Implement tar backup
* lib/App/Beam/Config.pm (get): Return dereferenced array and hash
refs.
(__lint): Fix array collection.
* lib/App/Beam.pm (%parameters): Mark unhandled keywords as arrays
(logger): Read from fd, if passed as the first argument.
(logcommand): New method.
* lib/App/Beam/Backend.pm: New file.
* lib/App/Beam/Backend/Tar.pm: New file.
* lib/App/Beam/Backup.pm (run): Assume result OK, unless already set
otherwise.
* lib/App/Beam/Command.pm: New file.
* MANIFEST: Update.
Diffstat (limited to 'lib/App/Beam/Config.pm')
-rw-r--r-- | lib/App/Beam/Config.pm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/App/Beam/Config.pm b/lib/App/Beam/Config.pm index 829e6e3..5e5e7d7 100644 --- a/lib/App/Beam/Config.pm +++ b/lib/App/Beam/Config.pm @@ -733,6 +733,11 @@ sub get { $ref = $ref->{-value}; } } + if (ref($ref) eq 'ARRAY') { + return @$ref + } elsif (ref($ref) eq 'HASH') { + return %$ref; + } return $ref; } @@ -976,7 +981,7 @@ sub flatten { sub __lint { my ($self, $syntax, $vref, @path) = @_; - return unless ref($syntax) eq 'HASH'; + $syntax = {} unless ref($syntax) eq 'HASH'; if (exists($syntax->{section})) { return unless is_section_ref($vref); } else { @@ -984,7 +989,6 @@ sub __lint { } if (exists($syntax->{select}) && !&{$syntax->{select}}($vref, @path)) { - print "IGNORE @path\n"; return; } @@ -992,7 +996,7 @@ sub __lint { $self->_lint($syntax->{section}, $vref, @path); } else { my $val = $vref->{-value}; - my %opts = { locus => $vref->{-locus} }; + my %opts = ( locus => $vref->{-locus} ); if (ref($val) eq 'ARRAY') { if ($syntax->{array}) { @@ -1013,8 +1017,8 @@ sub __lint { $self->{error_count}++; next; } - push @ar, $v; } + push @ar, $v; } $vref->{-value} = \@ar; return; |