Well volunteered!

Write a Perl::Critic Policy for various List::* packages

There's an unfortunate thing that can happen with some List::* packages and thats some of the list-operating functions ( ie: all, any , first ) have a nice little bug where to can not actually pass it a list and be blissfully unaware of this.


return any { foobar( $_ ) }

A cursory glance suggests "Sure, that works", when in fact, any will iterate over an empty list seeing if foobar($_) returns true for any of them.... guess thats not very good.

Its a bit hard to solve this problem without LOTS of dark XS magic and even then, you have to patch it into the right list tools.

A Perl Critic policy suite that checks for missing parameters for the various things exported by the various *(ie: List::AllUtils ) package could come in handy.

1 vote
Sign in
Sign in with: Facebook Google
Signed in as (Sign out)
You have left! (?) (thinking…)
Kent Fredric shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Sign in with: Facebook Google
Signed in as (Sign out)
  • Kent Fredric commented  ·   ·  Flag as inappropriate

    Nope, tested prototypes, don't do the trick. You also have to get around odd use cases like

    first { } method() # which is apparently broken by the &@ prototype.

    Like I said, you really *do* have to reach for dark magic to solve this issue normally, and lazyness and "Cant I just do it in perl" and "I can't touch the original code to fix this" and "original code doesn't want XS nasties" ==> Well, the best I can do is create a new package, so I can either re-implement all of List::* myself somehow, or wrap it all myself somehow (ie: create a clone of ::AllUtils with XS nasties )

    Or, it could just be a critic policy. Which works.

Feedback and Knowledge Base