File: Reader.pm

package info (click to toggle)
libcode-tidyall-perl 0.55~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 876 kB
  • ctags: 259
  • sloc: perl: 3,882; lisp: 47; makefile: 25
file content (27 lines) | stat: -rw-r--r-- 618 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package Code::TidyAll::Config::INI::Reader;

use strict;
use warnings;

use base qw(Config::INI::Reader);

our $VERSION = '0.55';

my %multi_value = map { $_ => 1 } qw( ignore select shebang );

sub set_value {
    my ( $self, $name, $value ) = @_;

    if ( $multi_value{$name} ) {
        $value =~ s/^\s+|\s+$//g;
        push @{ $self->{data}{ $self->current_section }{$name} }, split /\s+/, $value;
        return;
    }

    die "cannot list multiple config values for '$name'"
        if exists $self->{data}{ $self->current_section }{$name};

    $self->{data}{ $self->current_section }{$name} = $value;
}

1;