After switching to Function::Parameters, I noticed Perl::Critic no longer worked. For example, for the old fashioned
sub foo { $_[0] + 1 }
perlcritic -1 outputs
Always unpack @_ first at line 22, column 1. See page 178 of PBP. (S +everity: 4) Subroutine "foo" does not end with "return" at line 22, column 1. See + page 197 of PBP. (Severity: 4)

but for the equivalent

use Function::Parameters; fun foo ($x) { $x + 1 }
it doesn't say anything.

I've found a partial workaround: running perlcritic on the output of B::Deparse instead of the source itself. It reports lots of sins committed by Function::Parameters themselves (e.g. Magic variable "$^H" should be assigned as "local" at line 14, column 44. See pages 81,82 of PBP.) but seems to work.

Unfortunately, it gets more complex when Types::Standard are added to the mix.

use Function::Parameters; use Types::Standard qw( Num ); fun foo (Num $x) { $x + 1 }
The code doesn't look much more complicated, but running perl -MO=Deparse on it just hangs. Output of strace ends with endlessly repeating lines:
mmap(NULL, 192512, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1 +, 0) = 0x7fe772fdf000 mremap(0x7fe771772000, 532480, 536576, MREMAP_MAYMOVE) = 0x7fe77177200 +0 brk(0x49ac000) = 0x49ac000 brk(0x49cd000) = 0x49cd000 mremap(0x7fe771772000, 536576, 540672, MREMAP_MAYMOVE) = 0x7fe77177200 +0 brk(0x49ee000) = 0x49ee000 brk(0x49ed000) = 0x49ed000 brk(0x4a0e000) = 0x4a0e000 brk(0x4a2f000) = 0x4a2f000 mremap(0x7fe771772000, 540672, 544768, MREMAP_MAYMOVE) = 0x7fe77177200 +0 ...
The perl process seems to grow in memory very slowly at the same time.

Has anyone succeeded in linting a code that uses the above mentioned modules? Tips, tricks, suggestions welcome.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

In reply to Function::Parameters, Types::Standard, and Perl::Critic by choroba

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.