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

Given the difficulties for a module to test whether one of its routines could clash with a built-in, the solution is easy:
  1. State clearly in the docs that as from Perl 5.40 there may be a clash with a built-in;
  2. Have Try::Tiny check it is running under Perl 5.40 or later and issue a warning about a possible clash.
And leave it to the programmer to do what is necessary. No need to add unnecessary complexity and fragility to a Tiny::* module.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^6: Try::Tiny and -E
by ikegami (Patriarch) on Jan 05, 2026 at 14:50 UTC

    Does it really make sense to make all Try::Tiny-using application start issuing warnings just by upgrading to Perl 5.40?

    I agree that this shouldn't be for Try::Tiny to address (except in documentation).

      I would prefer a warning rather than have the program crash without a proper explanation.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics

        But programs that use Try::Tiny don't crash just because perl 5.40 is used. What you suggested would make every program that uses Try::Tiny start warning even when there's absolutely no issue.

Re^6: Try::Tiny and -E
by LanX (Saint) on Jan 06, 2026 at 21:14 UTC
    > Have Try::Tiny check it is running under Perl 5.40 or later and issue a warning about a possible clash.

    This:

    • $^V gt v5.40.0

    doesn't make much sense since feature "try" is already available for earlier versions. Furthermore does Perl 5.40 not activate it by default, you still need use v5.40 inside.

    Checking the hinthash of the importing scope for a key feature_try is far more reliable and generates far less false positives.

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