in reply to Re: Import constants as scalar instead of bareword sub
in thread Import constants as scalar instead of bareword sub

Another option is the Readonly module, available on CPAN. I've never tried it, but some people recommend it.
  • Comment on Re^2: Import constants as scalar instead of bareword sub

Replies are listed 'Best First'.
Re^3: Import constants as scalar instead of bareword sub
by powerman (Friar) on Nov 02, 2005 at 21:29 UTC
    I've read about it in Perl Best Practices book and I've tried it. It looks very promising (especially with Readonly::XS helper module).

    But Devel::DProf show it's still use tie()ed scalar (and so call FETCH() on each scalar access) even with Readonly::XS installed.

    This was sadly news, because I feel like with Readonly::XS it should just 'mark' SV as read-only and doesn't tie() it. :-(