加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-16 06:19:35 所属栏目:大数据 来源:网络整理
导读:如果这些块存在于Mason组件中,那么执行顺序是什么? %args %init %一次 %共享 %attr %标志 解决方法 该列表中有两种不同的块. “可执行”块,包含可执行的perl代码,以及包含键值对的非可执行块(与perl哈希不同). 可执行块 %一次 This block is execute
如果这些块存在于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,其中复制(和修改)了上述部分内容.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读