46 |
46 |
47 foreach (@r) { s/\s*?\n\s+/ /mg; } |
47 foreach (@r) { s/\s*?\n\s+/ /mg; } |
48 return join "" => @r; |
48 return join "" => @r; |
49 } |
49 } |
50 |
50 |
51 sub remove_header_lines { |
51 #sub remove_header_lines { |
52 my $self = shift; |
52 # my $self = shift; |
53 my $pattern = shift // die "Need a pattern!"; |
53 # my $pattern = shift // die "Need a pattern!"; |
54 $DATA{header}{$self} =~ s/^$pattern.*?(?=^\S|\Z)//imsg; |
54 # $DATA{header}{$self} =~ s/^$pattern.*?(?=^\S|\Z)//imsg; |
55 } |
55 #} |
56 |
56 |
57 sub add_header_line { |
57 #sub add_header_line { |
58 my $self = shift; |
58 #my $self = shift; |
59 my $_ = shift; |
59 #my $_ = shift; |
60 $_ .= "\n" unless /\n$/; |
60 #$_ .= "\n" unless /\n$/; |
61 $DATA{header}{$self} .= $_; |
61 #$DATA{header}{$self} .= $_; |
62 } |
62 #} |
63 |
63 |
64 sub header_contents { |
64 sub header_contents { |
65 my $self = shift; |
65 my $self = shift; |
66 my $field = shift // qr/.*/; |
66 my $field = shift // qr/.*/; |
67 |
67 |
126 =item B<new>(file => I<file>) |
126 =item B<new>(file => I<file>) |
127 |
127 |
128 The construcor. The file is opened r/o and read. The file will not be |
128 The construcor. The file is opened r/o and read. The file will not be |
129 closed until the object disappears. |
129 closed until the object disappears. |
130 |
130 |
131 =item @list = B<header_fields>([I<pattern>]) |
131 =item B<header_fields>([I<pattern>]) |
132 |
132 |
133 Return a list of existing header fields, matching the pattern. |
133 Return a list of existing header fields, matching the pattern. |
134 See B<header_contents()> for information about the |
134 See B<header_contents()> for information about the |
135 returned format. (default pattern: /.*/) |
135 returned format. (default pattern: /.*/) |
136 |
136 |
137 |
137 |
138 =item @list = B<header_lines>([I<pattern>]) |
138 =item B<header_lines>([I<pattern>]) |
139 |
139 |
140 Returns the header line matching the I<pattern>. See B<header_contents()> |
140 Returns the header line matching the I<pattern>. See B<header_contents()> |
141 about the returned format. (default pattern: /.*/) |
141 about the returned format. (default pattern: /.*/) |
142 |
142 |
143 =item @list = B<header_contents>([I<pattern>]) |
143 =item B<header_contents>([I<pattern>]) |
144 |
144 |
145 Returns the contents of the header lines matching the pattern. (default |
145 Returns the contents of the header lines matching the pattern. (default |
146 pattern: /.*/) |
146 pattern: /.*/) |
147 |
147 |
148 In list context a list of B<unmodified> header lines is returned. |
148 In list context a list of B<unmodified> header lines is returned. |
151 |
151 |
152 The I<field> has to include the colon ":" or space " ", |
152 The I<field> has to include the colon ":" or space " ", |
153 since it is considered a part of the field name. I<field> is case |
153 since it is considered a part of the field name. I<field> is case |
154 insensitive! |
154 insensitive! |
155 |
155 |
156 =item $scalar = $B<orig_header>() |
156 =item B<orig_header>() |
157 |
157 |
158 Returns the original header as it is. |
158 Returns the original header as it is in a single scalar. |
159 |
159 |
160 =item $body = B<orig_body>() |
160 =item B<orig_body>() |
161 |
161 |
162 Returns the original body as it is. |
162 Returns the original body as it is in a single scalar. |
163 |
163 |
164 =back |
164 =back |
165 |
165 |
166 =head1 AUTHOR |
166 =head1 AUTHOR |
167 |
167 |