`# Calculate the length of a segment by taking the square root of the
# differences of the squares of the sum of the x and y coordinates
sub segment_length {
my ($p1, $p2) = @_;
sqrt(($p1->{x} + $p2->{x})**2 - ($p1->{y} + $p2->{y})**2)
}
`
Bug 715: segment_length doesn't calculate the length of segments correctly. Bug 715 closed by holli: Not a bug, subroutine work as I documented it.
`# Return a random integer 1 .. 6 to simulate a die roll.
# Seed the random number generator with the current time before calcul
+ating.
sub roll {
srand(time);
1 + int rand 6;
}
`
Bug 4519: Due to a seeding the random number generator each time, 'roll' isn't producing random results. Bug 4519 closed by holli: Not a bug. I documented the fact it's seeding the random number generator each time.
`# CSS file
span.important {color: green} # Green stands out!
`
Bug 20123: important text should be red. Bug 20123 closed by holli: Not a bug, I documented it to be green.
`my $code = $cgi->param("sql_query");
$dbh->do($code); # This is dangerous.
`
Bug 40385: All the tables have been dropped!. Bug 40385 closed by holli: I documented that it is dangerous, so it's not a bug.
But I guess they are all edge cases as well? |
Comment onRe^5: An Introduction to Literate Programming with perlWEBDownloadCode