--- a/lib/Message/2822.pm Fri Nov 25 15:44:37 2011 +0100
+++ b/lib/Message/2822.pm Wed Jan 04 12:58:40 2012 +0100
@@ -26,7 +26,7 @@
or die "Can't open $DATA{fn}{$self}: $!\n";
local $/ = "";
- chomp($DATA{header}{$self} = <$fh>);
+ chomp($DATA{header}{$self} = <$fh>);
$DATA{body_pos}{$self} = tell($fh);
return $self;
@@ -41,7 +41,9 @@
sub header_lines {
my $self = shift;
my $field = shift // qr/.*/;
- my @r = grep /$field/i => $DATA{header}{$self} =~ /(^\S+?[: ]\s*.*?\n)(?=^\S|\Z)/imsg;
+ my @r =
+ grep /$field/i => $DATA{header}{$self} =~
+ /(^\S+?[: ]\s*.*?\n)(?=^\S|\Z)/imsg;
return @r if wantarray;
foreach (@r) { s/\s*?\n\s+/ /mg; }
@@ -55,14 +57,14 @@
#}
#sub add_header_line {
- #my $self = shift;
- #my $_ = shift;
- #$_ .= "\n" unless /\n$/;
- #$DATA{header}{$self} .= $_;
+#my $self = shift;
+#my $_ = shift;
+#$_ .= "\n" unless /\n$/;
+#$DATA{header}{$self} .= $_;
#}
sub header_contents {
- my $self = shift;
+ my $self = shift;
my $field = shift // qr/.*/;
my @r = map { (split /[: ]/, $_, 2)[1] } $self->header_lines($field);
@@ -72,7 +74,6 @@
return join "" => @r;
}
-
sub orig_header {
my $self = shift;
my $fh = $DATA{fh}{$self};
@@ -121,6 +122,11 @@
=head1 METHODS
+B<Note:> Whenever we mention a I<pattern>, you may pass the pattern
+as "qr/pattern/", giving you any freedom in choosing modifiers and so on, or
+you may pass the pattern simply as a string "pattern", this well then
+silently converted to "qr/pattern/i".
+
=over
=item B<new>(file => I<file>)