Setting content type.

Bill Moseley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
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
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.