| 1 | package Mail::STS::SSKV; | ||
| 2 | |||
| 3 | 3 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 3 | our $VERSION = '0.03'; # VERSION | |
| 6 | # ABSTRACT: role for semicolon-separated key/value pairs | ||
| 7 | |||
| 8 | 3 | requires 'fields'; | |
| 9 | |||
| 10 | sub new_from_string { | ||
| 11 | 4 | ▶ | my ($class, $string) = @_; |
|
Subroutine
new_from_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 12 | 4 | my %kv = map { split(/=/,$_,2) } split(/\s*;\s*/, $string); | |
| 13 | 4 | return $class->new(%kv); | |
| 14 | } | ||
| 15 | |||
| 16 | sub as_string { | ||
| 17 | 4 | ▶ | my $self = shift; |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 18 | return join(' ', | ||
| 19 | 4 | map { $_."=".$self->$_.";" } grep { defined $self->$_ } @{$self->fields} | |
| 20 | ); | ||
| 21 | } | ||
| 22 | |||
| 23 | 3 | 1; | |
| 24 | |||
| 25 | __END__ | ||
| 26 | |||
| 27 | =pod | ||
| 28 | |||
| 29 | =encoding UTF-8 | ||
| 30 | |||
| 31 | =head1 NAME | ||
| 32 | |||
| 33 | Mail::STS::SSKV - role for semicolon-separated key/value pairs | ||
| 34 | |||
| 35 | =head1 VERSION | ||
| 36 | |||
| 37 | version 0.03 | ||
| 38 | |||
| 39 | =head1 AUTHOR | ||
| 40 | |||
| 41 | Markus Benning <ich@markusbenning.de> | ||
| 42 | |||
| 43 | =head1 COPYRIGHT AND LICENSE | ||
| 44 | |||
| 45 | This software is copyright (c) 2018 by Markus Benning <ich@markusbenning.de>. | ||
| 46 | |||
| 47 | This is free software; you can redistribute it and/or modify it under | ||
| 48 | the same terms as the Perl 5 programming language system itself. | ||
| 49 | |||
| 50 | =cut | ||