Đang chuẩn bị liên kết để tải về tài liệu:
Minimal Perl For UNIX and Linux People 10

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

$ CL_VERBOSE=2 check_links ukeworld.com Got 101 links for ukeworld.com 85 links are unique Checking 'http://ukeworld.com/?D=A': OKAY Checking 'http://ukeworld.com/?M=A': OKAY . BAD: 'https://www.ukeworld.com/ppbutton2.gif', in 'ukeworld.com' $ CL_VERBOSE=3 check_links ukeworld.com # Output edited to fit Got 101 links for ukeworld.com 85 links are unique Checking 'http://ukeworld.com/?D=A': OKAY Type: text/html Size: N/A Server: Apache/1.3.27 . Checking 'http://ukeworld.com/?M=A': OKAY Type: text/html Size: N/A Server: Apache/1.3.27 . . BAD: 'https://www.ukeworld.com/ppbutton2.gif', in 'ukeworld.com' Verbosity level 3 dumps out the data obtained by the head function from the web server, if any; otherwise it reports the link being tested as “BAD”. Now look at the script, which is. | CL_VERBOSE 2 check_links ukeworld.com Got 101 links for ukeworld.com 85 links are unique Checking http ukeworld.com D A OKAY Checking http ukeworld.com M A OKAY . BAD https www.ukeworld.com ppbutton2.gif in ukeworld.com CL_VERBOSE 3 check_links ukeworld.com Output edited to fit Got 101 links for ukeworld.com 85 links are unique Checking http ukeworld.com D A OKAY Type text html Size N A Server Apache 1.3.27 . Checking http ukeworld.com M A OKAY Type text html Size N A Server Apache 1.3.27 . . BAD https www.ukeworld.com ppbutton2.gif in ukeworld.com Verbosity level 3 dumps out the data obtained by the head function from the web server if any otherwise it reports the link being tested as BAD . Now look at the script which is presented in listing 12.4. It begins by importing LWP Simple which exports the head function automatically. It then checks for the variable CL_VERBOSE in the environment if it has a number in it that number is copied to the file-scoped variable VERBOSE so the requested verbosity level can conveniently be determined from anywhere within the program. On Line 25 the lwp-request command obtains the list of links found within the current page and then if tests the True False value of the array @links to determine whether links were found. Many pages contain multiple links to other pages so Line 32 filters the duplicates out of @links we ll come back to this . Listing 12.4 The check_links script 1 usr local bin perl -wl 2 3 use strict 4 use LWP Simple 5 6 my VERBOSE 0 file scope 7 defined ENV CL_VERBOSE and ENV CL_VERBOSE A d and 8 VERBOSE ENV CL_VERBOSE if numeric value assign 9 10 MAIN program 11 foreach my url @ARGV check_link url 12 13 14 END 15 If propeller was last thing written to screen 16 will need n before shell s upcoming prompt to STDERR 17 print STDERR 18 406 CHAPTER 12 Modules and the CPAN 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 sub check_link my

crossorigin="anonymous">
Đã 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.