> So, my questions are:

> 1. Is this a bug?

Yes! ³

> 2. How can a pragma declared in one namespace affect the behaviour of code in a different (and supposedly separate) namespace?

See PerlPragma - such in Perl implemented "module" pragma are normally supposed to set and check the hinthash to restrict actions to the calling scope.

This is only done for bignum itself

But the globals set in Math::BigFloat don't adapt to this.

And no bignum is not setting them back. ²

> 3. Is there a workaround that will allow me to keep the current implementations of my two solutions and run them together in the same test script?

What is a workaround what is a patch?

Please try to prove that unsetting $upgrade and $downgrade solves it. *

If yes, you could patch the importer of the effected modules to reset those flags or even better replace them with getters checking the hinthash.

Tie::Scalar could be an option for this.

In any case please file a bug report!!!

A core pragma sabotaging other namespaces is a very worrying thing.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

updates

footnotes

*) like indicated by AnoMonk here

²) not fixing delegated global flags (import options) in its own unimport

sub unimport { $^H{bignum} = undef; # no longer in + effect overload::remove_constant('binary', '', 'float', '', 'integer'); }

³) because experiencing an unpredictable distant effect from a remote sub-module in the dependency chain is not OK. Especially when caused by a CORE pragma


In reply to Re: Pragma clash across modules: bignum and Math::BigFloat by LanX
in thread Pragma clash across modules: bignum and Math::BigFloat by Athanasius

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.