Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • by notbenh (7967) on 2009.04.17 16:02 (#68161)

    You can simply enforce typing:

    use Carp::Assert::More;

    sub recip {
          my ($num) = @_;
          return 1/$num;

    Then write one test to make sure that it works:

    is( recip(2), .5 );

    one to show that it dies correctly:

    dies_ok sub{recip(0)};

    and your done, any bugs that come up later can be tested then.