Ale*_*lex 7 python debugging perl assertions
如何在Perl中检查变量是否具有特定值?是否有命令停止脚本的执行以查找其中的一些变量?
我想知道我是否可以使用Pythonic插入实践:
    assert 0, (foo, bar)
以无debuger的方式调试脚本?
Tel*_*hus 12
快速CPAN搜索建议Carp :: Assert.
请参阅Carp :: Assert:
Run Code Online (Sandbox Code Playgroud)use Carp::Assert; $next_sunrise_time = sunrise(); # Assert that the sun must rise in the next 24 hours. assert(($next_sunrise_time - time) < 24*60*60) if DEBUG; # Assert that your customer's primary credit card is active affirm { my @cards = @{$customer->credit_cards}; $cards[0]->is_active; };
PerlMonks有一个脚本引入了快速断言方法。
速度很重要,因为 Perl 是解释性的,任何内联检查都会影响性能(例如,与简单的 C 宏不同)
我不确定这些东西是否可以直接使用。
好的!这就是我正在寻找的 - PDF 警告:Test-Tutorial.pdf。Test::Harness用于编写 Perl 模块测试。
| 归档时间: | 
 | 
| 查看次数: | 3242 次 | 
| 最近记录: |