Arithmetic-PaperAndPencil
view release on metacpan or search on metacpan
doc/documentation.en.md view on Meta::CPAN
string generation, variable `$l_min` would have the successive values
0, -1, -3 and -4 (skipping -2 because we insert two columns in one
go). Yet, during the second HTML string generation, `$l_min` would
have a strange behaviour. When printed from outside the `l2p_lin`
function, I would have values 0, -1, -3 and -4, but when printed from
within the `l2p_lin` function it would always give -4.
Here is the hypothetical explanation. During the first generation,
function `l2p_lin` would use the proper value for `$l_min`, that is,
0, then -1, then -3 and lastly -4. When method `html` ends, function
`l2p_lin` is still alive thanks to the closure mechanism. And thanks
to the same closure mechanism, variable `$l_min` still exists with
value -4 because it is used by `l2p_lin`. Then, method `html` is
called a second time to check CSS usage. This defines a new instance
of variable `$l_min`, initialised to 0. On the other hand, when
reading the definition
```
# Perl
sub l2p_lin($logl) {
my $result = $logl - $l_min;
( run in 1.845 second using v1.01-cache-2.11-cpan-df04353d9ac )