Const-Fast reviews

cpanratings
 

RSS | Module Info | Add a review of Const-Fast

Const-Fast (0.011) *****

I just found this module on CPAN while searching on another topic and was so pleased. Have been using Readonly for years to do constants and as the author of Const::Fast mentions in the documentation Readonly can have some weird behavior due to its internals which I'd become rather familiar with after so long :-)

I just took an entire application and swapped Readonly for Const::Fast and everything worked out-of-the-box, the only additional things I had to fix were things I was doing incorrectly in my code like accidentally autovivifying read-only hash values during tests that Readonly didn't notice :-)

Leandro Hermida - 2012-05-14T07:56:21 (permalink)

4 out of 4 found this review helpful. Was this review helpful to you?  Yes No

Const-Fast (0.011) *****

Very fast, does 90% of what we want it to do (subject to limitations in perl which are documented). Further, the author responded to a bug I filed in RT within 24 hours. Kudos.

Brian Szymanski - 2012-03-06T12:05:09 (permalink)

1 out of 1 found this review helpful. Was this review helpful to you?  Yes No

Const-Fast (0.009) *****

Comparing the three possible ways to define constants (Const::Fast, Readonly, constant) I found Const::Fast to be the best. It is very light and operates directly on Perl's internal SvREADONLY. It adds almost none processing overhead. Readonly is much heavier (its implementation is quite complex) and it has a performance overhead (as its documentation clearly states). The third way, Perl's default standard constant, is annoying when concatenating strings since it doesn't interpolate.

I just converted a project consisting of 75 Perl source code files to use Const::Fast exclusively. It was an easier task than I expected. First I forgot to use "=>" in assigning the value and used "=" instead. This resulted "Type of arg 1 to Const::Fast::const must be one of [$@%]..." errors. After these were fixed I needed to change the code in approx. 15 places to use "exists" to test key presence (see documentation CAVEATS). But these steps were all. I then did some testing to verify that Const::Fast::const actually protects the data and yes, the data is protected: the program dies with "Modification of a read-only value attempted" or "Attempt to access disallowed key '*****' in a restricted hash".

Heikki Siltala - 2011-12-11T14:55:39 (permalink)

5 out of 5 found this review helpful. Was this review helpful to you?  Yes No

Const-Fast (0.005) ****

A replacement for Readonly.

Although I welcome this module, specially if it is much faster than Readonly there are a few things that I would have liked to see in the documentation.

The author writes "I stumbled on some serious issues of Readonly that aren't easily fixable without breaking backwards compatibility in subtle ways" and "Readonly's use of ties is a source of subtle bugs and bad performance". Please, please enlighten us. What are the performance problems, and show us a benchmark so the zillion users don't have to run their own, and tell us about the subtle bugs so we don't fall pray to them. Those get the documentation a miserable two stars.

Then Leon goes: "this module uses the builtin readonly feature of perl". From which version of perl? ah! right, 5.008. that could be in the documentation instead for the source.

Really, wasn't there a way to make this a Readonly update? I'm quite sure Readonly author is not that difficult to work with.

Otherwise a good module, which I came to expect from this author; Check the other goodies he wrote.

نديم الخمير - 2010-09-06T01:37:35 (permalink)

6 out of 7 found this review helpful. Was this review helpful to you?  Yes No
1 hidden unhelpful review