How do I enable PerlCritic support in Komodo IDE 5.1 on Windows? - perl

I'm trying to enable PerlCritic support in Komodo.
The official word from ActiveState, the makers of Komodo IDE 5.1 (Win 32) is:
"To enable PerlCritic support, please install the 'Perl-Critic' and 'criticism' modules."
Well, installing Perl-Critic was a piece of cake:
ppm install Bundle-Perl-Critic
However, I've search every repository in PPM4, (trouchelle and the usual suspects) and they don't seem to have the module called 'criticism'. I've installed lots of modules using CPAN and PPM, but this module proves to be the most elusive so far. Am I missing something here?
Has anyone got any luck enabling PerlCritic support in Komodo 5.1 on Windows? Hope to hear from you. The feature works perfectly in MacOS and Linux though...hmmm.

The criticism module is available on CPAN, and is used as a pragma.
Basically, use of the pragma in your code runs your code through Perl::Critic before each execution, it's an alternative to using the perlcritic command-line tool.
Here's an except from the documentation:
This pragma enforces coding standards
and promotes best-practices by running
your file through Perl::Critic before
every execution. In a production
system, this usually isn't feasible
because it adds a lot of overhead at
start-up. If you have a separate
development environment, you can
effectively bypass the criticism
pragma by not installing Perl::Critic
in the production environment. If
Perl::Critic can't be loaded, then
criticism just fails silently.

ppm install criticism should work with ActivePerl. What error do you
get when you try it?
Once the two modules are installed in the current version of Perl that
Komodo is using, the Perl-Critic options in [Preferences|Language|Perl]
should be enabled.

You still can install modules on ActivePerl with CPAN shell. Of course, you would not be able to install C-based modules if you don't have MSVC (free version is available) or gcc (ppm install gcc), but in your case, criticism is a perl-only modules.
P.S. Which version of ActivePerl do you use?

I downloaded the criticism.pm directly from CPAN - criticism and copied it into the Perl library folder and now it works. However, it didn't work immediately. I had to restart Komodo a few times before the settings took effect. Weird. Anyway, thanks guys for all the suggestions.

Related

Is Active Perl Does Not Support any Extra CPAN Module?

I am using Crimson Editor as a text editor and I think it suports only Active Perl as a compiler. I downloaded some new CPAN modules for emailing etc etc. I added them in Perl library but program still doesn't recognize those modules. Can you please help me? Is Active Perl doesn't support any extra modules? If so, what do you suggest me for Perl compiler?
Is Active Perl doesnt support any extra modules?
It does, but it has its own way of doing it called PPM. Because many Perl modules require Unix tools and a C compiler, these are pre-built for you. Unfortunately these packages are often well behind CPAN release and are often missing CPAN modules altogether.
If so, what do you suggest me for Perl compiler?
On Windows, I'd recommend using Strawberry Perl. It comes with a full environment necessary for building and installing Perl modules, including a C compiler. Then you can install things using the normal CPAN tools like cpan or cpanm.
I am using Chrimson Editor
It doesn't look like that editor has been updated in over 10 years, and it's very Windows specific. I'd suggest an editor like Sublime Text. It's cross-platform, so you're not stuck with a Windows-specific editor, it has good Perl support, and it's kept up to date.
I would also not get too attached to relying on your IDE to do all your compiling and running of code for you. If you do, you're limited to what your IDE supports, and your IDE can get in the way of understanding your tools. Instead, I'd suggest getting used to using the tools directly. Learn how to use Perl on the command line rather than via the IDE.

Problems while installing WWW::Mechanize::Firefox

I am using the windows 8 operating system and I am trying to install the WWW::Mechanize::Firefox module in ActiveState Perl, from CPAN. I have successfully downloaded and installed all the dependencies and also installed the MozRepl module on Firefox. I do not have noScript running on my firefox and hence I am assuming that Javascript is enabled across all files (I am not sure how or where to check that). Here is my error message when I try to install the module.
I also constantly receive this error throughout the installation - "Subroutine-MozRepl-Load Plugins redefined at line 104."
Any help is much appreciated ! Thank you !
EDIT - These are the errors -
As Kim suggested in comments, you will need Mozrepl and Firefox.
Please refer WWW::Mechanize::Firefox::Installation page for detailed instructions on how to install this module.
If you use ActiveStates package manager, you can find some pre-packaged but untested PPMs at https://github.com/Corion/www-mechanize-firefox/downloads .
I needed to use this module on Windows, and couldn't get it running with ActivePerl. So I installed http://strawberryperl.com/ and it worked. This version of perl seems to handle installs form the cpan command line utility better than Activestate, who expect you to use their perl package manager as the default module installer (and don't supply a dmake program). Strawberry Perl also comes with a C compiler so can build modules that are a mixture of Perl and C code.
And make sure mozrepl is running before you try to install.

How do I install Devel::Cover on ActivePerl 5.8.7?

cpan fails with this weird error as follows
Error: Unable to locate installed Perl libraries or Perl source code.
It is recommended that you install perl in a standard location before
building extensions. Some precompiled versions of perl do not contain
these header files, so you cannot build extensions. In such a case,
please build and install your perl from a fresh perl distribution. It
usually solves this kind of problem.
(You get this message, because MakeMaker could not find "D:\fbl_esc_bcd_tb\tools\perl\lib\CORE\perl.h")
Running make test
Make had some problems, maybe interrupted? Won't test
Running make install
Make had some problems, maybe interrupted? Won't install
Problem is I can't install new active perl versions in this environment and the tool I want to coverage on does not run outside this environment.
Short answer: The ActiveState PPM repository has a precompiled version of Devel::Cover you should be able to install.
Long answer: That's not a normal message from MakeMaker so I'm willing to guess its an ActiveState addition, but its probably true. The problem is exactly what the error message says; your distribution is missing some important files, specifically the C header files for Perl, so it cannot compile C code necessary for modules like Devel::Cover. This is often the result of an overzealous sysadmin or packager looking to save a few dozen K of disk space. You could probably take the header files from the 5.8.7 source, copy them into the CORE directory and it will probably work. It won't make anything worse.
I agree with Evan that, assuming this is a Windows machine, you should switch to Strawberry Perl which plays much better with the rest of the Perl community than ActivePerl.
Otherwise, ActiveState is a commercial company and they have paid Perl support. Give them a ring.
Active Perl does not use CPAN. If you want to use CPAN use Strawberry Perl. Active Perl uses binary distribution through its ppm system. There are a few third party repos for it if the official one doesn't have Devel::Cover -- though the official probably has Devel::Cover.
Most people these days are moving to Strawberry and away from AS. In my opinion, it is far more stable and CPAN-friendly, and surely less proprietary. Also, expect to be able to get stable versions of most everything - AS has been known to lag years in many occasions in the official repos. strawberry also comes with its own compiler and build environment so you can even get ::XS versions working with ease.

How do I get Perl::Critic to work with E.P.I.C and eclipse?

I'm running eclipse Galileo with EPIC 0.5.46 and ActiveState ActivePerl 5.10.0, on WinXP SP3.
I just downloaded Perl::Critic using the package manager, and integrated it to eclipse using the appropriate Properties page.
I can run Perl::Critic just fine from my eclipse source context menu; it runs. But it doesn't put any markers in my source code in eclipse... in other words, I can't see its results. (My Perl ain't that good.)
Please, if you tell me to RTFM, please point out which FM to R. Thanks for any pointers.
See this section in the Perl::Critic man page. Until I discovered this note, I lived happily in the delusion that my code was good enough to pass Perl::Critic. And then I installed criticism only to discover the truth :)
You need to add the line use criticism 'gentle'; at the top of your code. Change gentle to brutal if that suits you. Running the script or module inside EPIC then shows Perl::Critic's comments in the console below the code pane.
My EPIC version is 0.6.35 BTW. I use Linux. See last section in this thread for a possible solution with Windows
Upgrade to EPIC 0.6.55 on the testing branch to get Perl::Critic working.
I was using EPIC on Galileo where PerlCritic was working. After installing Kepler Perl::Critic didn't work anymore. After hours I discovered that I had been on the testing branch before, where Perl::Critic works, but the new installation of Kepler put me back to "stable" EPIC 0.5.46 which seems to haven't been updated for a long time.
My config is:
Windows ActivePerl 5.14.2
Perl::Critic 1.121 installed with ppm under "c:\perl\site\bin"
In EPIC preferences, the Perl::Critic location is set to "c:\perl\site\bin\perlcritic"

What's the bare minimum Cygwin install to have DDD running properly on XP?

I’m using the gcc in MinGW that comes with Strawberry Perl, on Windows XP. I’d like to have ddd (the Data Display Debugger) as well but apparently on Windows the simplest way to get ddd is by running Cygwin. So what's the bare minimum of Cygwin I can install to get ddd up and running? I'd prefer if I could run ddd natively on Win32 but that doesn't seem to be an option.
As far as I can tell so far, only the following (with Cygwin DLL release version 1.5.25-15), and allowing setup to install any other packages to meet dependencies.
Base: base-files, grep
Develop: ddd, gdb
Math: gnuplot
Example to get grep working: Just drop the following files from a cygwin bin directory into an appropriate directory...
cyggcc_s-1.dll
cygiconv-2.dll
cygintl-8.dll
cygpcre-0.dll
cygwin1.dll
grep.exe
The Cygwin setup.exe installer resolves dependencies for you. Just run the installer, find and enable ddd, and click Next. It might install some packages you doun't strictly need, but figuring out which ones you can safely omit is probably a waste of time.
Disclaimer: I haven't tried this; I just install eveything.
If you're going for minimalism, you might want a smaller X server than cygwin-x11 (though it's what I use, and I'm quite fond of it). Starwin X-Win32 is actively maintained (though it costs $$ beyond the trial period), and avoids the overhead of installing Cygwin proper; there are other, zero-cost minimal X servers for win32 available, but I don't have linkage immediately available.
As the documentation at x.cygwin.com indicates, the xorg-x11-base package is the bare minimum needed.