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

Ways to address this:


As you might have noticed, -E isn't forward compatible. Your program would have worked with 5.38, but it doesn't with 5.40. If it's not a throwaway program, it's safer to use

-e'use v5.xx; ...'
or
-Mv5.xx -e'...'
instead of
-E'...' # XXX Not forward-compatible.

Replies are listed 'Best First'.
Re^4: Try::Tiny and -E
by atcroft (Abbot) on Dec 30, 2025 at 01:42 UTC

    You *could* also do this:
    perl -MTry::Tiny -E 'Try::Tiny::try { 1 / 0 } Try::Tiny::catch { print $_ };'
    which (as expected) generates:
    Illegal division by zero at -E line 1.

    Hope that helps.

Re^4: Try::Tiny and -E
by 1nickt (Canon) on Dec 29, 2025 at 11:31 UTC

    Thank you.


    The way forward always starts with a minimal test.