develooper Front page | perl.beginners | Postings from October 2009

recommendations for run-time assertions

From:
David Christensen
Date:
October 27, 2009 08:40
Subject:
recommendations for run-time assertions
Message ID:
770B8F59D68B450687DFBACF106B559A@p43400e
beginners:

I'm starting on an OO module, and have put some run-time assertion
subroutines into a function library:

	our %EXPORT_TAGS = ( 'all' => [ qw(
	    assert_argument_present
	    assert_arguments_gone
	    assert_class_method_signature
	    assert_defined
	    assert_object_method_signature
	) ] );

Examples of use:

	package Foo;

	sub new
	{
		assert_class_method_signature(__PACKAGE__, \@);

		my $class = shift;

		### rest of default constructor
	}

	sub clone
	{
		assert_object_method_signature(__PACKAGE__, \@);

		my $self = shift;

		### rest of clone constructor
	}

Before I get too far down the garden path, I thought I'd see what else
is out there.  Searching CPAN for "assert" yields 187 hits:

    http://search.cpan.org/search?m=all&q=assert&s=1&n=100


What do the readers use and/or recommend?


TIA,

David




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About