如何在Perl Smart :: Comment上调用函数?

时间:2011-02-25 16:20:01

标签: perl

考虑以下Perl代码:

use Smart::Comments;
print "${ \return_hello() }\n";
### ${ \return_hello() }
sub return_hello {return 'hello'}

产生输出:

hello

### ${ \return_hello() }

如何才能在智能评论上调用return_hello功能,让其打印hello

1 个答案:

答案 0 :(得分:5)

看起来Smart::Comments需要一些帮助才能确定应该调用子程序。添加标签似乎有效:

### returns: return_hello()

打印:

### returns: 'hello'