perl – 组件中Mason块的执行顺序是什么

perl – 组件中Mason块的执行顺序是什么,第1张

概述如果这些块存在于Mason组件中,那么执行顺序是什么? >%args >%init >%一次 >%共享 >%attr >%标志 该列表中有两种不同的块. “可执行”块,包含可执行的perl代码,以及包含键值对的非可执行块(与perl哈希不同). 可执行块 <%一次> This block is executed whenever the component is loaded into memor 如果这些块存在于Mason组件中,那么执行顺序是什么?

>%args
>%init
>%一次
>%共享
>%attr
>%标志

解决方法 该列表中有两种不同的块. “可执行”块,包含可执行的perl代码,以及包含键值对的非可执行块(与perl哈希不同).

可执行块

<%一次>

This block is executed whenever the component is loaded into memory.
It is executed before any other block.

<%共享>

This block is executed once per request. It is executed before the <%init> block.

<%的init>

This block is executed every time the component is called. It is executed before any other code except for code in <%once> or <%shared> blocks.

不可执行块

<%ARGS>

This block is used to declare the arguments that a component expects.
In addition,it can also be used to specify a default value if none is
given when the component is called.

<%标志>

This block is used to declare special Mason flags,which are used to
affect the component’s behavior. Currently,there is only one flag
defined,inherit.

<%ATTR>

This block is used to declare arbitrary key-value pairs. Unlike the
<%flags> block,the contents are not used by Mason but may be used in
your code.

有关更多信息,请参阅Mason book,其中复制(和修改)了上述部分内容.

总结

以上是内存溢出为你收集整理的perl – 组件中Mason块的执行顺序是什么全部内容,希望文章能够帮你解决perl – 组件中Mason块的执行顺序是什么所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/1245124.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-07
下一篇2022-06-07

发表评论

登录后才能评论

评论列表(0条)

    保存