in reply to Re: An example of programming by contract
in thread An example of programming by contract
Personally I either wouldn't have the test, or else I would make the test be an RE pattern. eg:die "Gotcha!" if validate_integer("not an integer");
sub is_integer { $_[0] =~ /^-?\d+\z/; }
|
|---|