| 1 | # Copyrights 2001-2023 by [Mark Overmeer <markov@cpan.org>]. | ||||||||||||||||||||||||||||||||
| 2 | # For other contributors see ChangeLog. | ||||||||||||||||||||||||||||||||
| 3 | # See the manual pages for details on the licensing terms. | ||||||||||||||||||||||||||||||||
| 4 | # Pod stripped from pm file by OODoc 2.03. | ||||||||||||||||||||||||||||||||
| 5 | # This code is part of distribution Mail-Message. Meta-POD processed with | ||||||||||||||||||||||||||||||||
| 6 | # OODoc into POD and HTML manual-pages. See README.md | ||||||||||||||||||||||||||||||||
| 7 | # Copyright Mark Overmeer. Licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | package Mail::Message::Field::URIs; | ||||||||||||||||||||||||||||||||
| 10 | 24 | ▶ | use vars '$VERSION'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 24 | $VERSION = '3.013'; | |||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 24 | ▶ | use base 'Mail::Message::Field::Structured'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 24 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 24 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 24 | ▶ | use URI; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | sub init($) | ||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | { my ($self, $args) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=9 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | 3 | my ($body, @body); | |||||||||||||||||||||||||||||||
| 26 | 3 | ▶ | if($body = delete $args->{body}) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | { @body = ref $body eq 'ARRAY' ? @$body : ($body); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 28 | 3 | ▶ | return () unless @body; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 3 | $self->{MMFU_uris} = []; | |||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 3 | ▶ | if(@body > 1 || ref $body[0]) | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
@body > 1 or ref $body[0]
MC/DC50%1/2
@body > 1 or ref $body[0]
@body > 1
ref $body[0]
Truth table66%2/3
A or B
A= @body > 1B= ref $body[0]
| |||||||||||||||||||||||||||||||||
| 34 | 2 | { $self->addURI($_) foreach @body; | |||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||
| 36 | elsif(defined $body) | ||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | { $body = "<$body>\n" unless index($body, '<') >= 0; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 38 | 1 | $args->{body} = $body; | |||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | 3 | $self->SUPER::init($args); | |||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | sub parse($) | ||||||||||||||||||||||||||||||||
| 45 | 1 | ▶ | { my ($self, $string) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 46 | 1 | my @raw = $string =~ m/\<([^>]+)\>/g; # simply ignore all but <> | |||||||||||||||||||||||||||||||
| 47 | 1 | $self->addURI($_) foreach @raw; | |||||||||||||||||||||||||||||||
| 48 | 1 | $self; | |||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | sub produceBody() | ||||||||||||||||||||||||||||||||
| 52 | 3 | ▶ | { my @uris = sort map { $_->as_string } shift->URIs; | ||||||||||||||||||||||||||||||
|
Subroutine
produceBody: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 53 | 3 | local $" = '>, <'; | |||||||||||||||||||||||||||||||
| 54 | 3 | ▶ | @uris ? "<@uris>" : undef; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||
| 60 | sub addURI(@) | ||||||||||||||||||||||||||||||||
| 61 | 5 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
addURI: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 62 | 5 | ▶ | my $uri = ref $_[0] ? shift : URI->new(@_); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 63 | 5 | ▶ | push @{$self->{MMFU_uris}}, $uri->canonical if defined $uri; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 64 | 5 | delete $self->{MMFF_body}; | |||||||||||||||||||||||||||||||
| 65 | 5 | $uri; | |||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | 6 | ▶ | sub URIs() { @{shift->{MMFU_uris}} } | ||||||||||||||||||||||||||||||
|
Subroutine
URIs: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | sub addAttribute($;@) | ||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | { my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
addAttribute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 74 | 0 | $self->log(ERROR => 'No attributes for URI fields.'); | |||||||||||||||||||||||||||||||
| 75 | 0 | $self; | |||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | #------------------------------------------ | ||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 24 | 1; | |||||||||||||||||||||||||||||||