Welcome to Perl and the Monastery, ymakkapati.

Based on those paths, it sounds like you're trying to install a module into the system Perl using cpan, which is generally not recommended, because it can create conflicts with the packages installed into the system Perl using the package manager, and in case of problems, cleaning this up can become quite difficult. Also, Perl modules should always be installed using their recommended installation procedure, not by copying files into the @INC directories.

Although I am not a CentOS expert (hippo is our resident expert, I believe), I think you should be able to install Perl::Critic (which includes the perlcritic command) by installing the RPM package perl-Perl-Critic using your system's package manager, and I'd also install perl-core to get all the Perl core modules installed as well. Assuming the RPM's dependencies are configured correctly, you should get all the required dependencies installed automatically as well.

If you don't want to modify the system Perl, then the recommended alternatives are: You can install a copy of Perl into your home directory using e.g. perlbrew, into which you can install any CPAN modules you like using cpanm (which I'd recommend) or cpan. The other alternative is local::lib, which lets you install modules to your home directory, but still allows you to use the system Perl (I believe the RPM package for that is perl-local-lib).

By the way, you said "I ... tried to run ./perlcritic". That probably won't work, since the ./ means "run the executable that is in the current directory", which won't find the perlcritic installed in your PATH - you should run the command as simply "perlcritic" (without the ./).


In reply to Re: perlcritic on Linux by haukex
in thread perlcritic on Linux by ymakkapati

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.