perl the complete reference second edition phần 8

Đối với phương thức POST, biến môi trường CONTENT_LENGTH chiều dài của các truy vấn được cung cấp, và nó có thể được sử dụng để đảm bảo rằng bạn đọc số tiền phải của thông tin từ đầu vào tiêu chuẩn Ở đây lý thuyết đề cập đến việc thiết kế khái niệm của hệ thống như một toàn thể, và thực hành liên quan đến mức độ mà lý thuyết | Chapter 24 Cross-Platform Migration Traps 835 Note that the actual test must be done within the BEGIN block so that it is executed at compile rather than run time then by the time compilation reaches the use subs pragma the contents of functions has already been populated with the required information. The definition for chown is then placed into the MyBuiltin package which is defined just like any other package MyBuiltin require Exporter @ISA qw Exporter EXPORT @EXPORT_OK qw chown sub chown print Changed mode return 1 The contents of @EXPORT should be empty since you don t want to import anything as standard. The value of @EXPORT_OK contains the list of built-in functions that you want to support and overload if necessary. Thus when you call use MyBuiltin with a list of unsupported built-in functions you import your own list of replacements. In this example a simple print statement is used to show that the overloading is working. In an actual case you ll probably want to put some real functionality into the functions you want to overload. If you are testing a lot of functions you will need to use loops and references to test the functions you want to overload BEGIN @subtest qw chown exec foreach function @subtest eval function push @functions function if @ FINE-TUNING APPLICATIONS It s not possible in this to optimize the loop by placing the foreach loop within the eval block since you re using each eval invocation to test the existence of each function. This is a performance hit but the overall process improves compatibility and it s one of the trade-offs examined at the beginning of the chapter. This page intentionally left blank. Complete Reference Chapter 25 Distributing Modules and Applications 837 Copyright 2001 The McGraw-Hill Companies Inc. Click Here for Terms of .

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
63    512    2    24-05-2024
3    74    2    24-05-2024
Đã 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.