More CPAN.pm silliness

bart on 2008-03-06T16:56:12

The author used the regex snippet /(?!\n)\Z/ 17 times in the main source, instead of the simpler and equivalent /\z/.

From perlre:

\Z
Match only at end of string, or before newline at the end
\z
Match only at end of string

Duh? In a core module? Doesn't anybody but the maintainers ever check what goes into a core module?


yes

rjbs on 2008-03-06T17:31:47

A lot of people review the code, and bugs still get by. This doesn't look like a bug, it looks like someone chose to use an atom that is, here, equivalent, and that could've been replaced with another one that might've been clearer for some people to skim.

Because it's open sourced software, you were able to find this code that you don't like and complain about it. You're also able to produce and send in a patch, which I'm sure you did. You're also able to watch p5 changesets and notice changes or checkins that you don't like to help them get caught.

5.004

srezic on 2008-03-06T17:48:46

You probably read CPAN.pm's documentation as well and found

CPAN.pm is regularly tested to run under 5.004, 5.005, and assorted newer versions.

And you looked into perl5005delta:

New regular expression constructs
The following new syntax elements are supported:
...
\z

Young whipper snapper!

schwern on 2008-03-06T17:49:47

CPAN.pm was written before \z existed. It came in this patch back in 1998 which is 5.005ish.

Even now CPAN.pm attempts to maintain 5.004 compatibility, so no \z.

Think about things in context a bit, that code is over 12 years old. See for yourself.

Check what?

petdance on 2008-03-06T19:03:46

Doesn't anybody but the maintainers ever check what goes into a core module?

Check what? What exactly would you like these notional code-checkers to check for? Do you have some sort of list of coding standards that all core modules should adhere to? Where can we find it? Where did the list of coding standards come from?