饶琛琳 > NG-0.001 > HTTP::Client

Download:
NG/NG-0.001.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source   Latest Release: NG-0.001_05

web_get my $url = 'http://www.baidu.com/'; my $content = web_get($url); say "Scalar: " . $content->xml; ^

    my @urls = qw(http://www.baidu.com http://www.sina.com.cn);
    web_get(@urls, sub {
    #web_get($url, sub {
        my ($content, $code, $res_headers) = @_;   # $res_headers 是 SHashtable 类型
        say "HTTP: " . $code;
        say "Body: " . $content->text;
        $res_headers->each(
            sub {
                my ($header_k, $header_v) = @_;
                say "$header_k: $header_v";
            }
        );
    });
syntax highlighting: