in reply to Re^2: Readonly vs ReadonlyX
in thread Readonly vs ReadonlyX

As I said you should track down the source and reasoning behind this policy, before overly relying on it.

Furthermore, perlcritic has plenty of config options and severity levels.

TIMTOWTDI.

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^4: Readonly vs ReadonlyX
by rlauer (Novice) on Mar 10, 2023 at 14:51 UTC
    Agreed...and thank you. As I said in the original post blindly following advice is a recipe for problems...and yes I can exclude Readonly from the list of discouraged modules when running perlcritic. Pipelines controlled by corporate security teams however do not encourage (or sometimes even allow) modification of .perlcriticrc. I appreciate the responses, but my opinion of the wisdom of the advice presented in perlcritic is only sometimes relevant and under my control. Moreover this still leaves me with the issue of Readonly vs ReadonlyX clashing.
      My guess by comparing the styles is that the author of ReadonlyX also wrote this PC-policy. (see below, it's from Dan Book)

      And as already explained this module is far newer than PBP.

      Nothing we could do about the cargo-cult policies of your company.

      update

      This seems to be the source of the policy Perl::Critic::Policy::Community::PreferredAlternatives and not PBP!

      • Readonly

        Readonly.pm is buggy and slow. Use Const::Fast or ReadonlyX instead, or the core pragma constant.

      And now I ask myself, what is wrong with Const::Fast ?

      Cheers Rolf
      (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
      Wikisyntax for the Monastery

        Why do you think there's something wrong with Const::Fast? (There is a caveat listed in the docs, though.)

        ;-) I never said that "slow and buggy" came from PBP...I referenced the output of perlcritic from whence it came - what did come from PBP (and yes this is probably old advice) "use constants but don't use constant" - in any event you have shone some light on why Readonly and ReadonlyX clash - thank you so much for your responses! (and yes I wish corporate InfoSec folks had some common sense and realized that not everything spewed out by some analyzer should be taken as gospel)