in reply to Re^7: Try::Tiny and -E
in thread Try::Tiny and -E

That solution will give both false positives (warn when it shouldn't) and false negatives (not warn when it should). The order loaded will determine if you can get false positives or false negatives, but it you can get false results regardless of the order in which they are loaded. Again, the order in which you load the modules is irrelevant. And that's because you're checking at the wrong time to get consistent results. For that, you need to check when try use is compiled, not when the module is loaded.

Replies are listed 'Best First'.
Re^9: Try::Tiny and -E
by LanX (Saint) on Dec 30, 2025 at 03:17 UTC
    > For that, you need to check when try use is compiled,

    What do you mean?

    > That solution will give both false positives (warn when it shouldn't) and false negatives (not warn when it should).

    Please elaborate or demonstrate those cases.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      What do you mean?

      use feature qw( try ); is a lexically-scoped pragma. The only thing that matter is the hints in effect when the try word is being compiled.

      Please elaborate or demonstrate those cases.

      I already posted the test cases.

        Yes, but I have no idea how this contradicts what I already said.

        If use Try::Tiny sees "feature_try" in the callers hint hash it can (at least) warn.°

        And if use feature "try" sees "try", "catch" or "finally" in the callers stash it can warn.

        Elaborate edge cases for false positives and false negatives please.

        What I suggested are well defined compile-time actions.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        see Wikisyntax for the Monastery

        °) IMHO it should die, but this is open to debate.