1Email::Simple::Header(3U)ser Contributed Perl DocumentatiEomnail::Simple::Header(3)
2
3
4
6 Email::Simple::Header - the header of an Email::Simple message
7
9 version 2.216
10
12 my $email = Email::Simple->new($text);
13
14 my $header = $email->header_obj;
15 print $header->as_string;
16
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
23 new
24 my $header = Email::Simple::Header->new($head, \%arg);
25
26 $head is a string containing a valid email header, or a reference to
27 such a string. If a reference is passed in, don't expect that it won't
28 be altered.
29
30 Valid arguments are:
31
32 crlf - the header's newline; defaults to CRLF
33
34 as_string
35 my $string = $header->as_string(\%arg);
36
37 This returns a stringified version of the header.
38
39 header_names
40 This method returns a list of the unique header names found in this
41 header, in no particular order.
42
43 header_raw_pairs
44 my @pairs = $header->header_raw_pairs;
45 my $first_name = $pairs[0];
46 my $first_value = $pairs[1];
47
48 This method returns a list of all the field/value pairs in the header,
49 in the order that they appear in the header. (Remember: don't try
50 assigning that to a hash. Some fields may appear more than once!)
51
52 header_pairs
53 header_pairs is another name for header_raw_pairs, which was the
54 original name for the method and which you'll see most often. In
55 general, though, it's better to be explicit and use header_raw_pairs.
56 (In Email::MIME, header_str_pairs exists for letting the library do the
57 header decoding for you.)
58
59 header_raw
60 my $first_value = $header->header_raw($field);
61 my $nth_value = $header->header_raw($field, $index);
62 my @all_values = $header->header_raw($field);
63
64 This method returns the value or values of the given header field. If
65 the named field does not appear in the header, this method returns
66 false.
67
68 header
69 This method just calls "header_raw". It's the older name for
70 "header_raw", but it can be a problem because Email::MIME, a subclass
71 of Email::Simple, makes "header" return the header's decoded value.
72
73 header_raw_set
74 $header->header_raw_set($field => @values);
75
76 This method updates the value of the given header. Existing headers
77 have their values set in place. Additional headers are added at the
78 end. If no values are given to set, the header will be removed from to
79 the message entirely.
80
81 header_set
82 header_set is another name for header_raw_set, which was the original
83 name for the method and which you'll see most often. In general,
84 though, it's better to be explicit and use header_raw_set. (In
85 Email::MIME, header_str_set exists for letting the library do the
86 header encoding for you.)
87
88 header_raw_prepend
89 $header->header_raw_prepend($field => $value);
90
91 This method adds a new instance of the name field as the first field in
92 the header.
93
94 crlf
95 This method returns the newline string used in the header.
96
98 · Simon Cozens
99
100 · Casey West
101
102 · Ricardo SIGNES
103
105 This software is copyright (c) 2003 by Simon Cozens.
106
107 This is free software; you can redistribute it and/or modify it under
108 the same terms as the Perl 5 programming language system itself.
109
110
111
112perl v5.28.0 2018-06-06 Email::Simple::Header(3)