in reply to Why is @flds not imported?

it's a compile time vs runtime thing, "use Fields" happens at compile time, but "@EXPORT=qw(@flds)" doesn't happen until runtime, put it in a BEGIN and it works

Replies are listed 'Best First'.
Re^2: Why is @flds not imported?
by perl-diddler (Chaplain) on Sep 24, 2017 at 23:26 UTC
    Well this is annoying. In my original code that I cut down to a "minimal case", I had the assignment to @EXPORT, effectively, in a BEGIN. with another function (and w/different names). I.e.:
    use mem(@EXPORT=qw(@xmission_flds TorFldN)); #... sub TorFldN(;$) { #... }
    References to the function worked as expected, but not the array. FWIW, substituting in use mem(...) also makes the error go away in the reduced-test case, but since that's what was in the original that's not the problem in the original. I'll have to try minimizing it again, but it's more than a bit of a pain as the original is 823 lines long. While I have no problem posting a sanitized version of the original, it references several modules not on CPAN, as well as just being long.

    I'll have to go back to original and try cutting it down again...sigh... unfortunately, this is the problem in "cutting things down" -- I ended up cutting away so much that the original problem goes away and I don't even notice it...

    *sigh*.

    -l