hsmyers has asked for the wisdom of the Perl Monks concerning the following question:

Today, inspired (or at least prodded) to action by an article in volume 2, issue 3 of The Perl Review on Perl::Critic I did the good trooper thing and installed same on my box of choice. It should be noted that this is version 16, not 17, since I used ppm and ActiveState for the install. Eager to expose myself to a list of my sins I did the obvious, i.e. c:\perlcritic EPD.pm and then hit return. Only to be confronted with Can't locate object method "default_severity" via package "Perl::Critic::Policy::Variables" at C:/Perl/site/lib/Perl/Critic/Config.pm line 89. This suggests an installation problem, not unknown under ActiveState. Question is "Does anyone know the fix?

Update And the winner is Chris Dolan who nailed it in one with the suggestion to move to version 0.17!

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
Re: Perlcritic Problem
by hesco (Deacon) on Jun 21, 2006 at 01:16 UTC
    I haven't used ActiveState for years and am completely unfamiliar with their packaging system. But this seems to suggest that you need also to install: "Perl::Critic::Policy::Variables". Did that come in as a dependency and as a part of Perl::Critic? If so, does it's code include a method (subroutine) called default_severity?

    -- Hugh

    if( $lal && $lol ) { $life++; }
      This is due to a recent regression in Module::Pluggable v3.01. It's mistakenly trying to load a directory as if it were a .pm file. Workarounds: 1) Upgrade to Perl::Critic 0.17, which is now on CPAN. 2) Downgrade to Module::Pluggable 3.0 or 2.97 I've relayed the bug to the Module::Pluggable author. -- Chris Dolan
        Being ever so slightly paranoid, I DL'd 17 just a bit ago, I'll try and install that and give it a shot. Thanks for the tip.

        --hsm

        "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
      Actually there are 76 instances of the method in question with 6 of them in the Variable hierarchy--- so the answer is a definite yup! BTY, good name Hugh, I use it myself; ever notice that most of the rest of the world can't spell and usually mispronounce it?

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re: Perlcritic Problem
by hesco (Deacon) on Jun 21, 2006 at 01:24 UTC
    My own installation of this code provides the following methods in each modules in the Perl::Critic::Policy::Variables directory. Do you have that?

    grep default_severity /usr/local/share/perl/5.8.7/Perl/Critic/Policy/V +ariables/* | sed "s/^.*8.7//" /Perl/Critic/Policy/Variables/ProhibitConditionalDeclarations.pm:sub d +efault_severity { return $SEVERITY_HIGHEST } /Perl/Critic/Policy/Variables/ProhibitLocalVars.pm:sub default_severit +y { return $SEVERITY_LOW } /Perl/Critic/Policy/Variables/ProhibitMatchVars.pm:sub default_severit +y { return $SEVERITY_HIGH } /Perl/Critic/Policy/Variables/ProhibitPackageVars.pm:sub default_sever +ity { return $SEVERITY_MEDIUM } /Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm:sub default_s +everity { return $SEVERITY_LOW } /Perl/Critic/Policy/Variables/ProtectPrivateVars.pm:sub default_severi +ty { return $SEVERITY_MEDIUM } /Perl/Critic/Policy/Variables/RequireInitializationForLocalVars.pm:sub + default_severity { return $SEVERITY_MEDIUM }
    if( $lal && $lol ) { $life++; }
      Yes:
      File c:\Perl\site\lib\Perl\Critic\Policy\Variables\ProhibitConditional +Declarations.pm: File c:\Perl\site\lib\Perl\Critic\Policy\Variables\ProhibitLocalVars.p +m: File c:\Perl\site\lib\Perl\Critic\Policy\Variables\ProhibitMatchVars.p +m: File c:\Perl\site\lib\Perl\Critic\Policy\Variables\ProhibitPackageVars +.pm: File c:\Perl\site\lib\Perl\Critic\Policy\Variables\ProhibitPunctuation +Vars.pm: File c:\Perl\site\lib\Perl\Critic\Policy\Variables\ProtectPrivateVars. +pm: File c:\Perl\site\lib\Perl\Critic\Policy\Variables\RequireInitializati +onForLocalVars.pm:

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
A reply falls below the community's threshold of quality. You may see it by logging in.