Blair Zajac <[EMAIL PROTECTED]> writes:

> Gisle Aas wrote:
> > 
> > Blair Zajac <[EMAIL PROTECTED]> writes:
> > 
> > > I'm working on some code where it would be handy to know the number of
> > > removed HTTP headers with the HTTP::Headers->remove_header method.  Here's
> > > a small patch returns the number of deleted headers.
> > 
> > Would it make more sense to have it return the removed headers like
> > Perl's delete does for hashes?
> > 
> > Or we could have it return the count in scalar context and the removed
> > headers in list context.  Hmmm...
> 
> That would work great.

Did you actually need the number for you application or just something
that indicates that some headers where removed?

I'm thinking of making it return the same thing as the 'header'
function does.  That means that it would in scalar context just join
the removed header values together with ", " as separator.

I would like to be able to do:

   if (my $v = $header->remove_header("Foo")) {
        $header->push_header("X-Foo", $v);
   }

Will this behaviour work for you?

> >   my $f = delete $self->{$field};
> >   $removed += ref($f) ? @$_ : 1;
> 
> Make that @$f.

Oh, yes.

Regards,
Gisle

Reply via email to