in reply to 5.10: Are scoped constants possible?

For constants, perhaps you want Readonly, which can create lexically-scoped constant variables. The constant module just creates subroutines.

As for scoped pragmas, we've had those for awhile (e.g. strict and warnings). Are you looking for new scoped pragmas? feature is new. The old pragmas bigint, bignum, bigrat, less and sort are now lexically scoped. See perldelta for the list of new pragmas.

--
brian d foy <brian@stonehenge.com>
Subscribe to The Perl Review

Replies are listed 'Best First'.
Re^2: 5.10: Are scoped constants possible?
by BrowserUk (Patriarch) on Dec 28, 2007 at 01:36 UTC

    Indirectly you led me to this extract from Perl 5.10 delta

    $^H and %^H

    The implementation of the special variables $^H and %^H has changed, to allow implementing lexical pragmas in pure Perl.

    And that leads to perlpragma which should allow what I want. Thanks.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      If you get this to work with constants, please do post how. It's not really clear to me how I would have to tweak the myint sample given in perlpragma to provide lexically scoped constants.