Re: %header_order membership

Gisle Aas (aas@bergen.sn.no)
12 Aug 1997 14:13:42 +0200


Cliff Wheatley <cwheat@concordia.net> writes:

> I'm using HTTP::Headers to create a header object.  I have a list of
> possible header values; From, Host, If-Modified-Since, etc.  I'd like to
> test to see if they are in %header_order before adding them.  There are
> other values that I don't want added if they don't exist in %header_order.
> I've tried: 
>  
>          if (defined HTTP::Headers::$header_order{$key}) { } 
>  
> This errors out, "bad name".  That's because the hash is lexically scoped,
> right?

True!  It is lexical because it is meant to be private.

>         I didn't see a method that will let me check on header_order
> membership.  Is there another way to do something like above without
> recreating the hash in my package?  TIA. 

The %header_order hash is not fixed either.  As you use HTTP::Headers
objects with non-standard header names we will add them to
%header_order (look at _header_cmp).

I suggest that you just make your own hash with the header names you
want to be legal, or you might try to propose some interface that we
should add to HTTP::Headers.

-- 
Gisle Aas <aas@sn.no>