作者CindyLinz (Cindy Wang)
看板Perl
标题[情报] 作了个 Return::Deep 模组
时间Sat Apr 4 18:54:07 2020
抗疫连假窝在家里写程式,写了一个 perl 模组
功能是可以指定层数,一次 return 出好几层函数的「深return」XD
return 出 eval block 的时候也适用
cpan
https://metacpan.org/pod/Return::Deep
github
https://github.com/CindyLinz/Perl-Return-Deep
use Return::Deep;
sub a {
b();
# never goes here
}
sub b {
deep_ret(2, 'Hi', 42);
}
my @ret = a();
# got ('Hi', 42) here
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 112.121.78.20 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Perl/M.1585997652.A.8AC.html
1F:推 flu: programmer 一种宅居时生产力反而可能提升的职业 (误 04/05 16:32