Philip Newton wrote:
>
> > Is order important for @HEADERS? Would it be better to have %HEADERS
> > instead that does such auto-formatting?
>
> In my opinion, no, for the reasons given before. Hashes are unordered, and
> if you want to order the keys, you need to know the possibly keys and in
> which order they come. Then, if HTTP/4.2 comes out with the Toast:
> light|medium|dark header, which has to come after the new Breakfast:
> header
Wait, you're both right! ;-)
Personally, I'd like to see a simple version of CGI::header be embedded
in core. HTTP-type headers are widely used in many applications. So you
could have:
@HEADERS = header(content-type => 'text/html',
toast => 'medium', # not too crispy
breakfast => 'yes');
Under normal life, @HEADERS would just be some variable. But the "use
cgi" pragma could simply flush @HEADERS out ahead of time before your
output stream. If @HEADERS is empty, the "use cgi" pragma just prints
out "Content-type: text/html\n\n";
Note that HTTP-style headers are used lots of other places:
@mail_header = header(from => '[EMAIL PROTECTED]',
to => '[EMAIL PROTECTED]');
print $MAILPIPE @mail_header, @mail_message;
So, the formatting of and the auto-printing of cgi headers are really
two separate things.
Ziggy, are you interested in this idea enough (at all?) to stick a note
about the 'header' function into the RFC? Or should I RFC it separately?
-Nate