davidj has asked for the wisdom of the Perl Monks concerning the following question:
While this seems to work for me, it also seems a bit clunky (and not very robust).use strict; use constant DEBUG => 1; # many lines of code here &assert($val, $var1, $var2) if DEBUG; # many lines of code here sub assert() { my $test = shift; my (@vars) = @_; # test $test for condition # if test condition is true # do something with @vars (usually dump them) print "would you like to abort: "; my $ans = <STDIN>; exit if $ans =~ m/y/i; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: C/C++ type assert() in Perl?
by herveus (Prior) on Jun 09, 2004 at 17:01 UTC | |
by waswas-fng (Curate) on Jun 09, 2004 at 17:39 UTC | |
by jdavidboyd (Friar) on Jun 10, 2004 at 23:59 UTC | |
by waswas-fng (Curate) on Jun 17, 2004 at 16:50 UTC | |
|
Re: C/C++ type assert() in Perl?
by Arunbear (Prior) on Jun 09, 2004 at 17:06 UTC | |
|
Re: C/C++ type assert() in Perl?
by Ovid (Cardinal) on Jun 09, 2004 at 20:07 UTC | |
|
Re: C/C++ type assert() in Perl? (see perl 5.9.1)
by grinder (Bishop) on Jun 09, 2004 at 20:28 UTC | |
|
Re: C/C++ type assert() in Perl?
by blueAdept (Beadle) on Jun 09, 2004 at 19:17 UTC | |
|
Re: C/C++ type assert() in Perl?
by ChrisS (Monk) on Jun 09, 2004 at 21:28 UTC |