in reply to Re^5:Localizing %SIG
in thread Localizing %SIG

I disagree. The purpose of localizing is to create an empty alias of the localized variable, special or not. It makes no sense to distinguish between scalars, arrays or hashes here. For the requirement of orthogonality, localizing special vars should behave in the same way as localizing of ordinary variables, and they should follow the same semantics.

In my eyes it makes no sense to allow localizing $/ and values of %SIG but forbid localizing %ENV, e.g. to reset the environment inside a scope. Even localizing a symbol table like %Foo:: should imho follow the semantics of local and hashes likewise.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^7: Localizing %SIG
by LanX (Saint) on Feb 17, 2016 at 23:35 UTC
    I disagree for practical reasons.

    These are exotic edge cases which were never sufficiently tested. The resulting inconsistencies or bugs were already implemented more than a decade ago.

    I doubt they'll ever be fixed, it's far cheaper to forbid local %SIG

    Localizing %ENV may be useful but localizing %Foo:: is already somewhere in the no-mans-land of undefined behaviour (especially local %main:: )

    Good luck providing patches though ;)

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