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