Embedding Perl in HTML with Mason Chapter 2: Components- P1

Tham khảo tài liệu 'embedding perl in html with mason chapter 2: components- p1', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 2 Components- P1 As mentioned in Chapter 1 the basic building block of Mason is called a component. A component consists of text of any sort as well as Masonspecific markup syntax. This chapter briefly introduces some core Mason concepts and then goes into the nitty-gritty of component syntax. In this chapter we ll introduce you to the syntax of Mason components but we won t spend much time on semantics. In most of the sections we refer to other parts of the book where you can find out more about each concept. Mason from 10 000 Feet In order to put Mason into perspective a basic understanding of how Mason processes a request is helpful. Each request is defined by an initial component path and a set of arguments to be passed to that component. Requests are handled by the Interpreter object. You can use it directly or its API can be called by the ApacheHandler or CGIHandler modules provided with Mason. The Interpreter asks the Resolver to fetch the requested component from the filesystem. Then the Interpreter asks the Compiler to create a compiled representation of the component. Mason s compilation process consists of turning Mason source code into Perl code which is then executed in order to create an object representing the component. Mason stores this generated Perl code on disk so that it doesn t need to go through the parsing and compilation process for every request and stores the compiled code in an LRU least recently used cache in memory. Once Mason has an object representing the initial component it creates a request object and tells it to execute that component. The initial component might call several other components during the request. Any output a component generates is sent to STDOUT which is a reasonable default for most environments in which Mason might be used. Of course it is possible to change this default and send output elsewhere. Several parameters can change how elements of this process happen and you can replace the core Mason .

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
16    70    1    21-05-2024
81    94    1    21-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.