Steffen Müller > Sub-Assert-1.23 > Sub::Assert::Nothing

Download:
Sub-Assert-1.23.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.23   Source  

NAME ^

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

SYNOPSIS ^

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

ABSTRACT ^

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

DESCRIPTION ^

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.

EXPORT

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

assert

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

AUTHOR ^

Steffen Mueller <smueller@cpan.org>

COPYRIGHT AND LICENSE ^

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

Sub::Assert

perl.

Look for new versions of this module on CPAN or at http://steffen-mueller.net

syntax highlighting: