File Coverage

blib/lib/Code/TidyAll/Config/INI/Reader.pm
Criterion Covered Total %
statement 17 17 100.0
branch 3 4 75.0
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             package Code::TidyAll::Config::INI::Reader;
2              
3 27     27   202 use strict;
  27         72  
  27         999  
4 27     27   168 use warnings;
  27         69  
  27         833  
5              
6 27     27   200 use base qw(Config::INI::Reader);
  27         65  
  27         14203  
7              
8             our $VERSION = '0.83';
9              
10             my %multi_value = map { $_ => 1 } qw( ignore inc ok_exit_codes select shebang );
11              
12             sub set_value {
13 18     18 1 3354 my ( $self, $name, $value ) = @_;
14              
15 18 100       63 if ( $multi_value{$name} ) {
16 12         47 $value =~ s/^\s+|\s+$//g;
17 12         18 push @{ $self->{data}{ $self->current_section }{$name} }, split /\s+/, $value;
  12         69  
18 12         111 return;
19             }
20              
21             die qq{cannot list multiple config values for '$name'}
22 6 50       27 if exists $self->{data}{ $self->current_section }{$name};
23              
24 6         57 $self->{data}{ $self->current_section }{$name} = $value;
25             }
26              
27             1;
28              
29             # ABSTRACT: A L<Config::INI::Reader> subclass which can handle a key appearing more than once
30              
31             __END__
32              
33             =pod
34              
35             =encoding UTF-8
36              
37             =head1 NAME
38              
39             Code::TidyAll::Config::INI::Reader - A L<Config::INI::Reader> subclass which can handle a key appearing more than once
40              
41             =head1 VERSION
42              
43             version 0.83
44              
45             =head1 SUPPORT
46              
47             Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>.
48              
49             =head1 SOURCE
50              
51             The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>.
52              
53             =head1 AUTHORS
54              
55             =over 4
56              
57             =item *
58              
59             Jonathan Swartz <swartz@pobox.com>
60              
61             =item *
62              
63             Dave Rolsky <autarch@urth.org>
64              
65             =back
66              
67             =head1 COPYRIGHT AND LICENSE
68              
69             This software is copyright (c) 2011 - 2022 by Jonathan Swartz.
70              
71             This is free software; you can redistribute it and/or modify it under
72             the same terms as the Perl 5 programming language system itself.
73              
74             The full text of the license can be found in the
75             F<LICENSE> file included with this distribution.
76              
77             =cut