Same here. At work, we've recently removed "use constant" from our code and converted to Readonly due to Damian's advice. It's really cleaned up a lot of our code.
Unfortunately, there are some bugs in how Perl handle tie which Readonly exposes. For example, the following prints "no":
#!/usr/bin/perl -l use strict; use warnings; use Readonly; Readonly my $VAR => 'SEARCH'; foreach my $var ($VAR) { print +($var eq $VAR) ? 'yes' : 'no'; }
Clearly that's wrong, but it's related to Perl's tie mechanism and not Readonly. As a workaround:
print +($var.'' eq $VAR.'') ? 'yes' : 'no';That's ugly as sin, but it works :(
Cheers,
Ovid
New address of my CGI Course.
In reply to Re^3: Export Constants Common to Lots of Packages
by Ovid
in thread Export Constants Common to Lots of Packages
by jffry
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |