TAILIEUCHUNG - Perl in a Nutshell phần 9

Một biến chứng của viết kịch bản CGI mà khi gỡ lỗi kịch bản, bạn phải vật lộn với môi trường máy chủ web. cung cấp hỗ trợ để gỡ lỗi các tập lệnh trên dòng lệnh. Nếu bạn chạy kịch bản trên dòng lệnh | Chapter 17 The LWP Library The URL object is created like this use URI URL url new URI URL And a header object can be created like this use HTTP Headers hdrs new HTTP Headers Accept text plain User-Agent MegaBrowser Then you can put them all together to make a request use LWP UserAgent This will cover all of them hdrs new HTTP Headers Accept text plain User-Agent MegaBrowser url new URI URL req new HTTP Request GET url hdrs ua new LWP UserAgent resp ua- request req if resp- is_success print resp- content else print resp- message Once the request has been made by the user agent the response from the server is returned as another object described by HTTP Response. This object contains the status code of the request returned headers and the content you requested if successful. In the example is_success checks to see if the request was fulfilled without problems thus outputting the content. If unsuccessful a message describing the server s response code is printed. There are other modules and classes that create useful objects for web clients in LWP but the above examples show the most basic ones. For server applications many of the objects used above become pieces of a server transaction which you either create yourself such as response objects or receive from a client like request objects . Additional functionality for both client and server applications is provided by the HTML module. This module provides many classes for both the creation and interpretation of HTML documents. The rest of this chapter provides information for the LWP HTTP HTML and URI modules. PREVIOUS FTP Configuration with Net Netrc KOMI BOOK INDEX NEXT The LWP Modules Library Home Perl in a Nutshell Learning Perl Learning Perl on Win32 Programming Perl Advanced Perl http documents oreilly perl perlnut 3 of 4 2 7 2001 10 36 52 PM Chapter 17 The LWP Library Programming Perl Cookbook http

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.