Sub::Assert::Nothing - Design-by-contract like pre- and postconditions, etc.


  use Sub::Assert::Nothing;
         yada yada yada;


  Design-by-contract like subroutine pre- and postconditions.


This module is part of the Sub::Assert distribution. Please read the documentation on Sub::Assert. For your convenience, a portion of the docs is reproduced below, but do not expect it to be updated whenever Sub::Assert is updated.

The Sub::Assert module aims at providing design-by-contract like subroutine pre- and postconditions. Furthermore, it allows restricting the subroutine's calling context.

There's one big gotcha with this: It's slow. For every call to subroutines you use assert() with, you pay for the error checking with an extra subroutine call, some memory and some additional code that's executed.

Fortunately, there's a workaround for mature software which does not require you to edit a lot of your code. Instead of use()ing Sub::Assert, you simply use Sub::Assert::Nothing and leave the assertions intact. While you still suffer the calls to assert() once, you won't pay the run-time penalty usually associated with subroutine pre- and postconditions. Of course, you lose the benefits, too, but as stated previously, this is a workaround in case you want the verification at development time, but prefer speed in production without refactoring your code.


Exports the 'assert' subroutine to the caller's namespace.


The implementation of the assert subroutine exported by this package is a no-op.


Steffen Mueller <>


Copyright (C) 2003-2009 Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO



Look for new versions of this module on CPAN or at