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

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.

Replies are listed 'Best First'.
Re^5: Readonly vs ReadonlyX (updated PC-Source + Const::Fast)
by LanX (Saint) on Mar 10, 2023 at 15:08 UTC
    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.)

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

        I don't, it's a rhetorical question.

        Meaning "why don't you use Const::Fast instead of ReadonlyX?".

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

      ;-) 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)