develooper Front page | perl.libwww | Postings from January 2006

Setting content type.

Thread Next
From:
Bill Moseley
Date:
January 24, 2006 12:49
Subject:
Setting content type.
Message ID:
20060124204905.GA6156@hank.org
Should content_type be able to take a list?

    use HTTP::Headers;
    use Data::Dumper;

    my $h1 = HTTP::Headers->new;
    my $h2 = HTTP::Headers->new;

    $h1->content_type('text/html; charset=uft8');
    print $h1->as_string;


    $h2->content_type( $h1->content_type );
    print $h2->as_string;

    my @ct = $h1->content_type;
    print Dumper \@ct;

    $h2->content_type( @ct );
    print $h2->as_string;


Generates:

    Content-Type: text/html; charset=uft8
    Content-Type: text/html
    $VAR1 = [
              'text/html',
              'charset=uft8'
            ];
    Content-Type: text/html



-- 
Bill Moseley
moseley@hank.org


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About