Updated with Tizen:Base source codes
[toolchains/perl-WWW-Curl.git] / t / new / 02header-callback.t
1 use strict;
2 use Test::More tests => 1;
3 use WWW::Curl::Easy;
4
5 my $header;
6
7 sub header_callback {
8     my $chunk = shift;
9     $header .= $chunk;
10     return length $chunk;
11 }
12
13 SKIP: {
14     skip 'You need to set CURL_TEST_URL', 1 unless $ENV{CURL_TEST_URL};
15     my $curl = new WWW::Curl::Easy;
16     $curl->setopt( CURLOPT_URL,            $ENV{CURL_TEST_URL} );
17     $curl->setopt( CURLOPT_HEADERFUNCTION, \&header_callback );
18     $curl->perform;
19     ok($header);
20 }