← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:14 2021

Filename/usr/local/lib/perl5/site_perl/Mail/AuthenticationResults/Token/String.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sMail::AuthenticationResults::Token::String::::BEGIN@10Mail::AuthenticationResults::Token::String::BEGIN@10
0000s0sMail::AuthenticationResults::Token::String::::BEGIN@5Mail::AuthenticationResults::Token::String::BEGIN@5
0000s0sMail::AuthenticationResults::Token::String::::BEGIN@6Mail::AuthenticationResults::Token::String::BEGIN@6
0000s0sMail::AuthenticationResults::Token::String::::BEGIN@8Mail::AuthenticationResults::Token::String::BEGIN@8
0000s0sMail::AuthenticationResults::Token::String::::isMail::AuthenticationResults::Token::String::is
0000s0sMail::AuthenticationResults::Token::String::::parseMail::AuthenticationResults::Token::String::parse
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Mail::AuthenticationResults::Token::String;
2# ABSTRACT: Class for modelling AuthenticationResults Header parts detected as strings
3
4require 5.008;
5use strict;
6use warnings;
7our $VERSION = '2.20210112'; # VERSION
8use Carp;
9
10use base 'Mail::AuthenticationResults::Token';
11
12
13sub is {
14 my ( $self ) = @_;
15 return 'string';
16}
17
18sub parse {
19 my ($self) = @_;
20
21 my $header = $self->{ 'header' };
22 my $value = q{};
23
24 croak 'Not a string' if $header =~ /^"/;
25 croak 'Not a string' if $header =~ /^\(/;
26
27 # Parse differently if we are post assignment (we are a value) or not (we are likely a key or key part)
28 my $is_value = 0;
29 my $is_first = 0;
30 if ( exists ( $self->{ 'args' }->{ 'last_non_comment_type' } ) ) {
31 if ( $self->{ 'args' }->{ 'last_non_comment_type' }->is() eq 'assignment' ) {
32 if ( $self->{ 'args' }->{ 'last_non_comment_type' }->value() eq '=' ) {
33 $is_value = 1;
34 }
35 }
36 }
37 else {
38 $is_first = 1;
39 }
40
41 while ( length $header > 0 ) {
42 my $first = substr( $header,0,1 );
43 last if $first =~ /\s/;
44 last if $first eq ';';
45 last if $first eq '"' && ! $is_value && ! $is_first;
46 last if $first eq '(' && ! $is_value && ! $is_first;
47 last if $first eq '=' && ! $is_value && ! $is_first;
48 last if $first eq '/' && ! $is_value && ! $is_first;
49 last if $first eq '.' && ! $is_value && ! $is_first;
50
51 $value .= $first;
52 $header = substr( $header,1 );
53 }
54
55 croak 'Not a string' if $value eq q{};
56
57 $self->{ 'value' } = $value;
58 $self->{ 'header' } = $header;
59
60 return;
61}
62
631;
64
65__END__