On Mon, Feb 28, 2011 at 12:30 PM, Scott Weisman <[email protected]> wrote:

>
> I don't like Perl constants for just this reason. There are too many corner
> cases that the Perl parser just won't catch. I prefer Readonly, as it uses
> normal variable syntax and works as expected.
>

Exactly.

Although, if I could add a note about Reaonly. You need to install
Readonly::XS to make it much faster and use more correct behavior.

Apparently there's a documented way to just ask Perl to make a scalar
read-only. This can be very easily achieved by using Const::Fast[1], written
by Leon Timmermans. He also explains in the POD why you probably don't want
to use Readonly (even with Readonly::XS).

[1] http://search.cpan.org/perldoc?Const::Fast
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to