Constant vs. Readonly

In: Article|Events

6 May 2010

Jobindex hosted the latest Copenhagen Perl Mongers meeting. The topic was Perl::Critic. Henrik Hald Nørgaard from Jobindex gave a nice general presentation on Perl::Critic. During and after there was a lot of discussion on various aspects of Perl::Critic, testing and Perl in general.

Jobindex was also disabling the Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma policy, which is something I always do so after the meeting I sat down and made a write-up of why that is – something I have been meaning to do for a long time.

The problem with the policy is that is recommends using Readonly instead of constants. Readonly variables are nice, but they cannot be used for optimization by the Perl interpreter like constants can, if you for example implement a DEBUG constant.

In addition to the write-up I examined my long TODO list and implemented one of the Perl::Critic policies I have been meaning to implement also for a long time:

- Perl::Critic::Policy::Modules::ProhibitUseLib

I will write more on this policy later and another one, which popped to mind when implementing the first.

- Perl::Critic::Policy::Modules::RequireVersionFormat

Next meeting, the May meeting will be a lightning talk session on testing.

2 Responses to Constant vs. Readonly

Avatar

anon

May 6th, 2010 at 03:09

The last link only goes to a page with a login form.

Avatar

jonasbn

August 11th, 2010 at 10:36

Thanks,

This has been fixed. Permissions was not set correctly – sorry for the inconvenience.

jonasbn

Comment Form

About this blog

This blog acts as a channel for communicating logicLAB’s open source activities. Announcements on open source initiatives, involvements and releases of open source distributions of software products, projects and applications.

Photostream

Calendar

May 2010
M T W T F S S
« Mar   Aug »
 12
3456789
10111213141516
17181920212223
24252627282930
31