Web Client Programming with Perl-Chapter 7: Graphical Examples with Perl/Tk- P4

Tham khảo tài liệu 'web client programming with perl-chapter 7: graphical examples with perl/tk- p4', công nghệ thông tin, quản trị web phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 7 Graphical Examples with Perl Tk- P4 Check if Servers Are up webping For the last example we ll build a GUI interface that will allow us to check and see if several web sites are running at pre-specified intervals. Since this action is very similar to the UNIX ping command we call it webping. This application would be useful to a web administrator who had to keep track of many different web sites and wanted to know when one was down or not responding. We ll be utilizing the LWP Simple module to actually ping each site. The code to check a site s status is as follows where site is a string containing a standard URL like http content head site if content Site is UP. else Site is DOWN. While that s pretty simple we have to have some way to set site to a URL. It s not very efficient to have to type a new site on the command line each time we want to verify the status of a site. In order to make our GUI useful we want to add some basic features to it. A place to manually enter URLs would be nice and a display of the sites we have checked and their status would be useful. Having the program automatically perform an update on each of the sites in the list every 30 minutes or so would be extremely useful. In that same vein specifying the interval would also be easier than editing the source code any time we decide to change how often the ping happens. After we build a list of sites it would be nice for the program to remember them and bring them up automatically the next time we start the program. Here s the final code with most of the mentioned features represented usr bin perl -w Webping A program that will detect and report whether a web site is up. usage webping -a -i minutes -f filename -- -geometry. -a starts prog in autoping mode from beginning. -i Sets the autoping interval to int -f Uses filename instead of .webping_sites as site list -- is necessary to separate webping s options from the Window Manager options. Allows us to utilize GetOptions

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.