开发者

how to call a function on a Perl Smart::Comment?

Consider the following Perl code:

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

produces the output:

hello

### ${ \return_hello() }

How could I call the return_hello function right 开发者_如何转开发on the smart comment to get it to print hello?


Looks like Smart::Comments needs a little help to determine that a subroutine should be called. Adding a label seems to work:

### returns: return_hello()

which prints:

### returns: 'hello'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜