perlcritic -1 outputssub foo { $_[0] + 1 }
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
it doesn't say anything.use Function::Parameters; fun foo ($x) { $x + 1 }
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.
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:use Function::Parameters; use Types::Standard qw( Num ); fun foo (Num $x) { $x + 1 }
The perl process seems to grow in memory very slowly at the same time.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 ...
Has anyone succeeded in linting a code that uses the above mentioned modules? Tips, tricks, suggestions welcome.
In reply to Function::Parameters, Types::Standard, and Perl::Critic by choroba
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |