I have now changed remove_header to return the field values removed
and in scalar context the number of fields removed.

--- Headers.pm  2001/04/12 06:50:28     1.41
+++ Headers.pm  2001/11/15 06:17:42     1.42
@@ -170,19 +198,31 @@ sub init_header
 =item $h->remove_header($field,...)
+This function removes the headers fields with the specified names.
-This function removes the headers with the specified names.
+The header field names ($field) are not case sensitive and '_'
+can be used as a replacement for '-'.
+The return value is the values of the fields removed.  In scalar
+context the number of fields removed is returned.
+Note that if you pass in multiple field names then it is generally not
+possible to tell which of the returned values belonged to which field.
 sub remove_header
     my($self, @fields) = @_;
     my $field;
+    my @values;
     foreach $field (@fields) {
        $field =~ tr/_/-/ if $TRANSLATE_UNDERSCORE;
-       delete $self->{lc $field};
+       my $v = delete $self->{lc $field};
+       push(@values, ref($v) ? @$v : $v) if defined $v;
+    return @values;
This change became part of a bigger documentation change.  The full
patch is found here:



Reply via email to