assertions

Select assertions in blocks of code
Download

assertions Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Salvador Fandi?o GarcĂ­a
  • Publisher web site:
  • http://search.cpan.org/~salva/

assertions Tags


assertions Description

Select assertions in blocks of code assertions is a Perl module that specifies the tags used to enable and disable the execution of assertion subroutines.An assertion subroutine is declared with the :assertion attribute. This subroutine is not normally executed: it's optimized away by perl at compile-time.The assertions pragma associates to its lexical scope one or several assertion tags. Then, to activate the execution of the assertions subroutines in this scope, these tags must be given to perl via the -A command-line option. For instance, if... use assertions 'foobar';is used, assertions on the same lexical scope will only be executed when perl is called as... perl -A=foobar script.plRegular expressions can also be used within the -A switch. For instance... perl -A='foo.*' script.plwill activate assertions tagged as foo, foobar, foofoo, etc.SYNOPSIS sub assert (&) : assertion { &{$_}() } use assertions 'foo'; assert { print "asserting 'foo'\n" }; { use assertions qw( foo bar ); assert { print "asserting 'foo' and 'bar'\n" }; } { use assertions qw( bar ); assert { print "asserting only 'bar'\n" }; } { use assertions '_ && bar'; assert { print "asserting 'foo' && 'bar'\n" }; } assert { print "asserting 'foo' again\n" }; Requirements: · Perl


assertions Related Software