| 1 | package Getopt::ArgParse::ActionAppend; | ||||||||||
| 2 | |||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use Getopt::ArgParse::Parser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 33 | ▶ | sub apply { | ||||||||
|
Subroutine
apply: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||
| 10 | 33 | my $self = shift; | |||||||||
| 11 | |||||||||||
| 12 | 33 | my ($spec, $namespace, $values) = @_; | |||||||||
| 13 | |||||||||||
| 14 | 33 | my $v = $namespace->get_attr( $spec->{dest} ); | |||||||||
| 15 | |||||||||||
| 16 | 33 | ▶ | if ($spec->{type} == Getopt::ArgParse::Parser::TYPE_PAIR) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 6 | ▶ | $v = {} unless defined $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | |||||||||||
| 19 | 6 | for my $pair (@$values) { | |||||||||
| 20 | 9 | my ($key, $val) = %$pair; | |||||||||
| 21 | 9 | $v->{$key} = $val; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | } else { | ||||||||||
| 25 | 27 | ▶ | $v = [] unless defined $v; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 27 | push @$v, @$values; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 33 | $namespace->set_attr( $spec->{dest}, $v ); | |||||||||
| 30 | |||||||||||
| 31 | 33 | return ''; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 9 | 1; | |||||||||
| 35 | |||||||||||
| 36 | =head1 AUTHOR | ||||||||||
| 37 | |||||||||||
| 38 | Mytram <mytram2@gmail.com> (original author) | ||||||||||
| 39 | |||||||||||
| 40 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 41 | |||||||||||
| 42 | This software is Copyright (c) 2014 by Mytram. | ||||||||||
| 43 | |||||||||||
| 44 | This is free software, licensed under: | ||||||||||
| 45 | |||||||||||
| 46 | The Artistic License 2.0 (GPL Compatible) | ||||||||||
| 47 | |||||||||||
| 48 | =cut | ||||||||||
| 49 | |||||||||||
| 50 | |||||||||||