Lwp::useragent Introduction 2

Source: Internet
Author: User

1 #This lwp::useragent is generally used in conjunction with other modules2 #比如:3 #HTTP:: Request4 #HTTP:: Cookies5 #HTTP:: Respose6 #HTTP:: Status7 #LWP:: useragent equivalent to creating a mock browser8  9 #用以下方式创一个浏览器Ten my $useragent= lwp::useragent->new (); One #In general, we do not add the parameters, to the following time to add, or let it use the default values, its default parameters are as follows A   -=pod - KEY DEFAULT the-----------             -------------------- -Agent"libwww-perl/#.###" -Fromundef -Conn_cacheundef +Cookie_jarundef -Default_headers http::headers->New +Local_addressundef Assl_opts {verify_hostname =1 } atMax_sizeundef -Max_redirect7 -Parse_head1 -Protocols_allowedundef -Protocols_forbiddenundef -requests_redirectable ['GET','HEAD'] inTimeout the -=Cut to   +If you want to add parameters, use this form: - my $useragent= Lwp::useragent->new (Agent = ='PERL'); the=pod * In general, we don't have to configure the parameters above him. $ of course, if you want to test, you can use the following code to print the default value, but not necessarily to print properlyPanax Notoginseng=Cut -   the #!/usr/bin/perl-w +  UseStrict; A  UseLWP::useragent; the   + my $ua= lwp::useragent->new (); - Print $ua->agent,"\ n"; $ Print $ua->from,"\ n"; $ Print $ua->conn_cache,"\ n"; - Print $ua->cookie_jar,"\ n"; - Print $ua->default_headers,"\ n"; the Print $ua->local_address,"\ n"; - Print $ua->ssl_opts,"\ n";Wuyi Print $ua->max_size,"\ n"; the Print $ua->max_redirect,"\ n"; - Print $ua->parse_head,"\ n"; Wu Print $ua->protocols_allowed,"\ n"; - Print $ua->protocols_forbidden,"\ n"; About Print $ua->requests_redirectable,"\ n"; $ Print $ua->timeout,"\ n"; -   - #you can see that some values are to be obtained from other modules, like $ua->default_headers, to be built from Http::headers->new

Lwp::useragent Introduction 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.