assertions - select assertions in blocks of code
sub assert (&) : assertion { &{$_[0]}() } 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" };
The assertions pragma specifies the tags used to enable and disable the execution of assertion subroutines.
assertions
An assertion subroutine is declared with the :assertion attribute. This subroutine is not normally executed : it's optimized away by perl at compile-time.
:assertion
The assertion 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.
assertion
perlrun.
Salvador Fandiño, <sfandino@yahoo.com>
Copyright 2002 by Salvador Fandiño
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Env, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Env
CPAN shell
perl -MCPAN -e shell install Env
For more information on module installation, please visit the detailed CPAN module installation guide.