如果这些块存在于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,其中复制(和修改)了上述部分内容.