1Email::Simple::Header(3U)ser Contributed Perl DocumentatiEomnail::Simple::Header(3)
2
3
4

NAME

6       Email::Simple::Header - the header of an Email::Simple message
7

VERSION

9       version 2.218
10

SYNOPSIS

12         my $email = Email::Simple->new($text);
13
14         my $header = $email->header_obj;
15         print $header->as_string;
16

DESCRIPTION

18       This method implements the headers of an Email::Simple object.  It is a
19       very minimal interface, and is mostly for private consumption at the
20       moment.
21

PERL VERSION

23       This library should run on perls released even a long time ago.  It
24       should work on any version of perl released in the last five years.
25
26       Although it may work on older versions of perl, no guarantee is made
27       that the minimum required version will not be increased.  The version
28       may be increased for any reason, and there is no promise that patches
29       will be accepted to lower the minimum required perl.
30

METHODS

32   new
33         my $header = Email::Simple::Header->new($head, \%arg);
34
35       $head is a string containing a valid email header, or a reference to
36       such a string.  If a reference is passed in, don't expect that it won't
37       be altered.
38
39       Valid arguments are:
40
41         crlf - the header's newline; defaults to CRLF
42
43   as_string
44         my $string = $header->as_string(\%arg);
45
46       This returns a stringified version of the header.
47
48   header_names
49       This method returns a list of the unique header names found in this
50       header, in no particular order.
51
52   header_raw_pairs
53         my @pairs = $header->header_raw_pairs;
54         my $first_name  = $pairs[0];
55         my $first_value = $pairs[1];
56
57       This method returns a list of all the field/value pairs in the header,
58       in the order that they appear in the header.  (Remember: don't try
59       assigning that to a hash.  Some fields may appear more than once!)
60
61   header_pairs
62       header_pairs is another name for header_raw_pairs, which was the
63       original name for the method and which you'll see most often.  In
64       general, though, it's better to be explicit and use header_raw_pairs.
65       (In Email::MIME, header_str_pairs exists for letting the library do the
66       header decoding for you.)
67
68   header_raw
69         my $first_value = $header->header_raw($field);
70         my $nth_value   = $header->header_raw($field, $index);
71         my @all_values  = $header->header_raw($field);
72
73       This method returns the value or values of the given header field.  If
74       the named field does not appear in the header, this method returns
75       false.
76
77   header
78       This method just calls "header_raw".  It's the older name for
79       "header_raw", but it can be a problem because Email::MIME, a subclass
80       of Email::Simple, makes "header" return the header's decoded value.
81
82   header_raw_set
83         $header->header_raw_set($field => @values);
84
85       This method updates the value of the given header.  Existing headers
86       have their values set in place.  Additional headers are added at the
87       end.  If no values are given to set, the header will be removed from to
88       the message entirely.
89
90   header_set
91       header_set is another name for header_raw_set, which was the original
92       name for the method and which you'll see most often.  In general,
93       though, it's better to be explicit and use header_raw_set.  (In
94       Email::MIME, header_str_set exists for letting the library do the
95       header encoding for you.)
96
97   header_raw_prepend
98         $header->header_raw_prepend($field => $value);
99
100       This method adds a new instance of the name field as the first field in
101       the header.
102
103   header_rename
104         $header->header_rename($field, $new_name, $nth);
105
106       This renames the named field to the new name.  If $nth is given, only
107       the nth instance of the field will be renamed.  It is fatal to rename
108       an instance that does not exist.  The first instance of a header is the
109       0th.
110
111       If $nth is omitted, all instances of the header are renamed.
112
113       When picking headers to rename, $field is matched case insensitively.
114       So, given this header:
115
116           happythoughts: yes
117           HappyThoughts: so many
118           hapPyThouGhts: forever
119
120       Then this code...
121
122           $header->rename_header('happythoughts', 'Delights');
123
124       ...will result in this:
125
126           Delights: yes
127           Delights: so many
128           Delights: forever
129
130       Headers may be rewrapped as a result of renaming.
131
132   crlf
133       This method returns the newline string used in the header.
134

AUTHORS

136       •   Simon Cozens
137
138       •   Casey West
139
140       •   Ricardo SIGNES <cpan@semiotic.systems>
141
143       This software is copyright (c) 2003 by Simon Cozens.
144
145       This is free software; you can redistribute it and/or modify it under
146       the same terms as the Perl 5 programming language system itself.
147
148
149
150perl v5.38.0                      2023-07-20          Email::Simple::Header(3)
Impressum