1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Movable Type 5.2.3" />
8 <link rel="stylesheet" href="http://defaria.com/blogs/Status/styles-site.css" type="text/css" />
9 <link rel="alternate" type="application/atom+xml" title="Atom" href="http://defaria.com/blogs/Status/atom.xml" />
10 <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://defaria.com/blogs/Status/index.xml"$>" />
12 <title>Status for Andrew DeFaria: April 8, 2012 - April 14, 2012 Archives</title>
14 <link rel="start" href="http://defaria.com/blogs/Status/" title="Home" />
15 <link rel="prev" href="http://defaria.com/blogs/Status/archives/week_2012_02_12.html" title="February 12, 2012 - February 18, 2012" />
16 <link rel="next" href="http://defaria.com/blogs/Status/archives/week_2012_05_06.html" title="May 6, 2012 - May 12, 2012" />
18 <body class="layout-one-column">
20 <div id="container-inner" class="pkg">
23 <div id="banner-inner" class="pkg">
24 <h1 id="banner-header"><a href="http://defaria.com/blogs/Status/" accesskey="1">Status for Andrew DeFaria</a></h1>
25 <h2 id="banner-description">Searchable status reports and work log</h2>
30 <div id="pagebody-inner" class="pkg">
32 <div id="alpha-inner" class="pkg">
34 <p class="content-nav">
35 <a href="http://defaria.com/blogs/Status/archives/week_2012_02_12.html">« February 12, 2012 - February 18, 2012</a> |
36 <a href="http://defaria.com/blogs/Status/">Main</a>
37 | <a href="http://defaria.com/blogs/Status/archives/week_2012_05_06.html">May 6, 2012 - May 12, 2012 »</a>
42 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
43 xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
44 xmlns:dc="http://purl.org/dc/elements/1.1/">
46 rdf:about="http://defaria.com/blogs/Status/archives/week_2012_04_08.html#entry-000751"
47 trackback:ping="http://defaria.com/mt/mt-tb.cgi/115"
48 dc:title="Perl::Critic"
49 dc:identifier="http://defaria.com/blogs/Status/archives/week_2012_04_08.html#entry-000751"
51 dc:description="OK, I'm a nerd and I'm pretty passionate about Perl. But in my defense this is my business and my chosen career - it is what I went to school for way back in the day. So I listen to..."
53 dc:date="2012-04-11T13:38:27-06:00" />
58 <h2 class="date-header">April 11, 2012</h2>
60 <div class="entry" id="entry-751">
61 <h3 class="entry-header">Perl::Critic</h3>
62 <div class="entry-content">
63 <div class="entry-body">
64 <p>OK, I'm a nerd and I'm pretty passionate about Perl. But in my defense this is my business and my chosen career - it is what I went to school for way back in the day. So I listen to podcasts about many topics including technology. One podcast I listen to regularly is <a href="http://twit.tv/show/floss-weekly">FLOSS Weekly</a> with <a href="https://en.wikipedia.org/wiki/Randal_Schwartz">Randal Schwartz</a>. Randal wrote <a href="http://www.amazon.com/Learning-Perl-Randal-L-Schwartz/dp/1449303587">Learning Perl</a> among other Perl books and he had on <a href="http://search.cpan.org/~thaljef/">Jeffery Thalhammer</a> who talked about his creation <a href="http://www.perlcritic.org/">Perl::Critic</a>. For those who may be interested the Perl::Critic episode is <a href="http://twit.tv/show/floss-weekly/189">here</a>.</p>
66 <p>The easiest way you can try out Perl::Critic by going to <a href="http://www.perlcritic.org/">http://www.perlcritic.org/</a>. You can even evaluate your own Perl scripts by using the Choose File and set your severity level. You can start with gentle but I usually do harsh as that's in the middle.</p>
68 <p>Perl::Critic is a static analyzer that finds inconsistencies and possible errors in your Perl code as well as tries to enforce best practices as written about in <a href="http://shop.oreilly.com/product/9780596001735.do">Perl Best Practices</a> by Damian Conway. Perl::Critic is implemented as a CPAN module. There is also a command line (<a href="http://search.cpan.org/%7Eschwigon/Benchmark-Perl-Formance-Cargo-0.03/lib/auto/Benchmark/Perl/Formance/Cargo/PerlCritic/perlcritic">/usr/bin/perlcritic</a>) that allows you to run perlcritic on your code from the command line. But the web page is better because it provides links to explanations of why Perl::Critic thinks what it complains about is a problem as well as tells you how to fix it.</p>
70 <p>Now, of course, critiquing your code is highly subjective and you may not agree with the rational for why Perl::Critic flags this as a problem. Perl::Critic is very tunable - you can set settings in ~/.perlcriticrc to say "We don't want you, Perl::Critic, to flag this as a problem".</p>
72 <p>If you use <a href="https://eclipse.org/">Eclipse</a> as your IDE and have <a href="http://www.epic-ide.org/">EPIC, the Eclipse Perl Integration plugin</a>, and have <a href="http://cygwin.com/">Cygwin</a> installed with <a href="http://search.cpan.org/%7Eschwigon/Benchmark-Perl-Formance-Cargo-0.03/lib/auto/Benchmark/Perl/Formance/Cargo/PerlCritic/perlcritic">perlcritic</a> installed too, you can configure Eclipse to use Perl::Critic directly in the editor and flag errors as you code which you can then fix.</p>
74 <p>For example, you can see the little triangle with "!" in it relates to the line in the Problems tab at the bottom which says that I've defined $value but never used it.</p>
76 <img src="/blogs/Status/images/Eclipse.png">
78 <p class="entry-footer">
79 <span class="post-footers">Posted by at 1:38 PM</span> <span class="separator">|</span> <a class="permalink" href="http://defaria.com/blogs/Status/archives/000751.html">Permalink</a>
81 | <a href="http://defaria.com/blogs/Status/archives/000751.html#trackback">TrackBacks (0)</a>