Ah, brilliant!

Thank you.

regards
Torbj�rn

On 4 Mar 2002, Randal L. Schwartz wrote:

> >>>>> "Torbj�rn" == Torbj�rn lindahl <[EMAIL PROTECTED]> writes:
>
> Torbj�rn> All the headers are represented on a line each with a colon, but how do i
> Torbj�rn> reach the info on the first line, ie HTTP/1.0 200 OK
> Torbj�rn> are they represented by some key or do i have to parse the string and
> Torbj�rn> extract them with regexp?
>
> Well, this *is* Perl.  Let's look at the source (perldoc -m HTTP::Response):
>
>     ....
>     sub as_string
>     {
>         require HTTP::Status;
>         my $self = shift;
>         my @result;
>         #push(@result, "---- $self ----");
>         my $code = $self->code;
>         my $status_message = HTTP::Status::status_message($code) || "Unknown code";
>         my $message = $self->message || "";
>
>         my $status_line = "$code";
>         my $proto = $self->protocol;
>         $status_line = "$proto $status_line" if $proto;
>         $status_line .= " ($status_message)" if $status_message ne $message;
>         $status_line .= " $message";
>         push(@result, $status_line);
>     ....
>
> and there you have it.  It constructs it from calls to $self->code
> and $self->message and $self->protocol.  No trivial call.  Maybe Gisle
> could add $self->status_line that factors this out.
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
>

Reply via email to