Function-Parameters icon indicating copy to clipboard operation
Function-Parameters copied to clipboard

Function::Parameters interferes with true

Open schwern opened this issue 10 years ago • 1 comments

CC: @chocolateboy

I found a strange interaction between Function::Parameters and true.pm.

# Foo.pm
package Foo;

use Function::Parameters;
use true;

fun foo() {}

If I load Foo.pm it's fine. But if I load it in a for loop...

$ perl -I ~/tmp/ -we 'for(0..1) { require Foo }'
Foo.pm did not return a true value at -e line 1.

That is very peculiar. Load order of Function::Parameters vs true does not matter. If I change fun foo to sub foo true.pm works again. If I call foo at the end of Foo.pm it works again, despite returning false.

I guess either Function::Parameters is doing something to the opcodes that true isn't expecting, or true is doing something naughty.

schwern avatar Mar 07 '15 17:03 schwern

Data points:

  • doesn't seem to happen with require Foo; require Foo;
  • doesn't seem to happen with DEBUGGING perls
  • doesn't seem to happen with runtime => 1

mauke avatar Mar 09 '15 04:03 mauke

No longer reproducible with the latest version of true. This is most likely the same issue as https://rt.cpan.org/Ticket/Display.html?id=124745, which was fixed in version 1.0.0 of https://github.com/chocolateboy/true.

mauke avatar Mar 31 '23 07:03 mauke