TAILIEUCHUNG - Embedding Perl in HTML with Mason Chapter 8: Building a Mason Site-P2

Tham khảo tài liệu 'embedding perl in html with mason chapter 8: building a mason site-p2', 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 8 Building a Mason Site-P2 This component is longer than any of the previous ones but not significantly more complicated. Several features are worth noting here. The first is that the menu changes based on whether or not the return value from User- is_logged_in is true. The User object was generated in the syshandler component and may represent either a guest user or a real logged-in user. If a user has logged in she sees options that allow her to create a new project edit any projects for which she may have editing access change her user account information and log out. The link to edit projects appears only if she actually has editing access to one or more projects. Note that we construct all URLs using the lib component which we will examine later. This component handles the construction of properly escaped URLs of arbitrary complexity. Using this component for all URLs would make it easy to add in something like URL-based sessions later on. For the Logout URL we are regenerating the URL and query string if any for the current page. We do this because the component that handles logouts users will redirect the client back to the page where she clicked on the Logout link. Getting back to the menu component we can see that if the user is not logged in we generate a form that POSTs to the user login component. Again we will be passing in the current URL and query string parameters to the login component so that it can send the user back where she came from with either a cookie indicating a successful login or an error message. That error message is handled just above where the form starts where we check the variable login_error. We take advantage of the fact that a POST request can also have a query string in order to put the caller_args hash into the query string where we can be sure that keys and values will be received by the server in the right order. If we put the keys and values in the form itself as .

TỪ KHÓA LIÊN QUAN
Đã 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.