Next | Hook::LexWrap | 4 |
Or design-by-contract
wrap 'wag', pre => sub { unless (UNIVERSAL::isa($_[0], 'Doggie')) { die "wag()'s argument is required to be a Doggie\n"; } unless ($_[0]->is_awake) { die "violated precondition for wag(): Doggie argument is required to be awake\n"; } }, post => sub { unless ($_[0]->consistency_check) { die "Doggie $_[0] failed consistency check on return from wag()\n"; } };
Next | Copyright © 2003 M. J. Dominus |