TAILIEUCHUNG - Embedding Perl in HTML with Mason Chapter 6: The Lexer, Compiler, Resolver, and Interpreter Objects

Tham khảo tài liệu 'embedding perl in html with mason chapter 6: the lexer, compiler, resolver, and interpreter objects', 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 6 The Lexer Compiler Resolver and Interpreter Objects Now that you re familiar with Mason s basic syntax and some of its more advanced features it s time to explore the details of how the various pieces of the Mason architecture work together to process components. By knowing the framework well you can use its pieces to your advantage processing components in ways that match your intentions. In this chapter we ll discuss four of the persistent objects in the Mason framework the Interpreter Resolver Lexer and Compiler. These objects are created once in a mod_perl setting they re typically created when the server is starting up and then serve many Mason requests each of which may involve processing many Mason components. Each of these four objects has a distinct purpose. The Resolver is responsible for all interaction with the underlying component source storage mechanism which is typically a set of directories on a filesystem. The main job of the Resolver is to accept a component path as input and return various properties of the component such as its source time of last modification unique identifier and so on. The Lexer is responsible for actually processing the component source code and finding the Mason directives within it. It interacts quite closely with the Compiler which takes the Lexer s output and generates a Mason component object suitable for interpretation at runtime. The Interpreter ties the other three objects together. It is responsible for taking a component path and arguments and generating the resultant output. This involves getting the component from the resolver compiling it then caching the compiled version so that next time the interpreter encounters the same component it can skip the resolving and compiling phases. Figure 6-1 illustrates the relationship between these four objects. The Interpreter has a Compiler and a Resolver and the Compiler has a Lexer. Figure 6-1. The Interpreter and its cronies Passing Parameters to Mason Classes

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.