Re: Self-testing kwalitee

2005-07-11 Thread Adam Kennedy
Nik Clayton wrote: Having been a little more prolific on the module front recently I'm interesting in making sure that my own modules pass the kwalitee tests. Preferably before I put them on CPAN. But poking through qa.perl.org I can't find anywhere that these tests are actually rigorously

Re: Self-testing kwalitee

2005-07-11 Thread Adam Kennedy
Note: The last kwalitee test, the one related to Devel::Cover, is considered dangerous by a non-trivial percentage of the community, and there's been a lot of debate on whether it should be removed. Sorry, I should have said Pod::Test::Coverage. Regardless, it executes code. I wonder how it

Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Shlomi Fish
In HTML::Widgets::NavMenu I have the following code: sub get_coords_while_skipping_skips { my $self = shift; my $callback = shift; my $coords = shift || $self-get_current_coords(); # line 571 Now when I run the tests with Devel::Cover it reports the following for line 571 in the

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Yuval Kogman
On Mon, Jul 11, 2005 at 19:27:52 +0300, Shlomi Fish wrote: my $coords = shift; if (!$coords) { $coords = $self-get_current_coords(); } A work around: $coords = scalar(@_) ? shift : $self-get_current_coords(); I should also note that I have many my @coords = @{shift

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Jérôme Fenal
2005/7/11, Yuval Kogman [EMAIL PROTECTED]: Coverage reporting is not done for the pretty colors - a human reads it, and says OK, this is logical, get_current_coords always returns a true value. It's not a race for greens and percentages. otherwise it should be called golf... :) -- Jérôme

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Michael G Schwern
On Mon, Jul 11, 2005 at 07:38:57PM +0300, Yuval Kogman wrote: So what should I do to eliminate it? Maybe Just Nothing The issue is that you can't special case get_current_coords to be truish, as far as Devel::Cover is concerned - it might not be. Any fix that could be thought up is

Re: Self-testing kwalitee

2005-07-11 Thread Ricardo SIGNES
* Adam Kennedy [EMAIL PROTECTED] [2005-07-11T10:10:31] Note: The last kwalitee test, the one related to Devel::Cover, is considered dangerous by a non-trivial percentage of the community, and there's been a lot of debate on whether it should be removed. Sorry, I should have said

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Yuval Kogman
On Mon, Jul 11, 2005 at 13:17:48 -0700, Michael G Schwern wrote: On Mon, Jul 11, 2005 at 07:38:57PM +0300, Yuval Kogman wrote: I'll make the same argument no broken windows argument here that I do about warnings and tests: elminate all warnings, even if they are dubious. Ensure all tests

Re: AnnoCPAN and a wiki POD idea

2005-07-11 Thread Ivan Tubert-Brohman
Adrian Howard wrote: On 8 Jul 2005, at 20:08, Adam Kennedy wrote: [snip] There's no way to get a listing of the annotations for a given author id, or even for a given dist. So I'm reduced to manually looking through a thousand odd web pages to find potential changes or improvements to the

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Paul Johnson
On Mon, Jul 11, 2005 at 01:17:48PM -0700, Michael G Schwern wrote: On Mon, Jul 11, 2005 at 07:38:57PM +0300, Yuval Kogman wrote: So what should I do to eliminate it? Maybe Just Nothing The issue is that you can't special case get_current_coords to be truish, as far as Devel::Cover

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread David Golden
Michael G Schwern wrote: What's missing is a way to let Devel::Cover know that a bit of coverage is not necessary. The first way to do this which pops into my mind is a comment. my $foo = $bar || default(); # DC ignore X|0 I posted an item about this usage of the || operator the

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Michael G Schwern
On Mon, Jul 11, 2005 at 11:22:51PM +0200, Paul Johnson wrote: my $foo = $bar || default(); # DC ignore X|0 Hey, Devel::Cover! Ignore the case where the right side of this logic is false. I wasn't particularly happy with the idea of needing to change the source code just to

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Yuval Kogman
On Mon, Jul 11, 2005 at 17:33:26 -0400, David Golden wrote: Want.pm seems to imply that this might be possible, but I don't know the guts of Perl well enough. Want looks into the opcode tree and looks for context thingies inside it, so it should be possible as far as I understand from

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Michael G Schwern
On Mon, Jul 11, 2005 at 05:33:26PM -0400, David Golden wrote: http://rt.cpan.org/NoAuth/Bug.html?id=11304 My suggestion turns on the question of whether it's possible to differentiate the context between a true boolean context ( foo() if $p || $q ) and a pseudo-boolean context that is

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Paul Johnson
On Mon, Jul 11, 2005 at 02:54:19PM -0700, Michael G Schwern wrote: On Mon, Jul 11, 2005 at 11:22:51PM +0200, Paul Johnson wrote: my $foo = $bar || default(); # DC ignore X|0 Hey, Devel::Cover! Ignore the case where the right side of this logic is false. I wasn't

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread David Golden
Michael G Schwern wrote: my $foo = $p || $q is not boolean. I'm not even sure you can call it pseudo-boolean without understanding the surrounding code. How do you know that $q can never be false? The other examples in the ticket play out the same way: bless {}, ref $class || $class; $class

Re: Self-testing kwalitee

2005-07-11 Thread Adam Kennedy
Ricardo SIGNES wrote: * Adam Kennedy [EMAIL PROTECTED] [2005-07-11T10:10:31] Note: The last kwalitee test, the one related to Devel::Cover, is considered dangerous by a non-trivial percentage of the community, and there's been a lot of debate on whether it should be removed. Sorry, I should

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Michael G Schwern
On Mon, Jul 11, 2005 at 07:43:24PM -0400, David Golden wrote: I think this is a coverage vs correctness distinction. The idea that I was trying to convey is that while these expressions use a boolean operator for a shortcut, they aren't really about truth vs. falsity of the overall

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread leif . eriksen
[EMAIL PROTECTED] wrote: Michael G Schwern wrote: you're right that the case of $class being false may be of interest, but that's not what this common idiom actually does. The code will blithely pass a false value to bless (with potentially unexpected results depending on whether

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Jim Cromie
Paul Johnson wrote: On Mon, Jul 11, 2005 at 02:54:19PM -0700, Michael G Schwern wrote: On Mon, Jul 11, 2005 at 11:22:51PM +0200, Paul Johnson wrote: my $foo = $bar || default(); # DC ignore X|0 Hey, Devel::Cover! Ignore the case where the right side of this logic is false.

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread chromatic
On Tue, 2005-07-12 at 10:46 +1000, [EMAIL PROTECTED] wrote: I'd say this idiom is one of the ones I am most often affected by in the work I do for the Kwalitee project - the my$class = ref$proto||$proto; idiom in constructors. I usually do the following 1. Add code to handle the 'both

Re: [Maybe Spam] Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread leif . eriksen
[EMAIL PROTECTED] wrote: On Tue, 2005-07-12 at 10:46 +1000, [EMAIL PROTECTED] wrote: 1. Add code to handle the 'both false' case, similiar to my $class = ref $proto || $proto; warn 'wrong calling convention for Class::Constructor::new - try Class::Constructor-new' and return

Re: Devel::Cover Problem: testing || for a default value.

2005-07-11 Thread Michael G Schwern
On Mon, Jul 11, 2005 at 08:28:01PM -0600, Jim Cromie wrote: 1. emit a text version of the coverage failures which a. has same info as html details - ie line# conditionals, code b. starts with a comment. 2. use that 'exact' format as your ignore directive a. except that # means its entirely

Test::Cmd -- Recommended?

2005-07-11 Thread Ian Langworth
On 7/8/05, James E Keenan [EMAIL PROTECTED] wrote: One other curiosum: As a result of my Phalanx work, I've gotten in the habit of using File::Temp to create 'anonymous' directories and files in which to conduct testing. This is one of the many features of Test::Cmd, which I a was about to

Re: Test::Cmd -- Recommended?

2005-07-11 Thread Michael G Schwern
On Mon, Jul 11, 2005 at 10:56:36PM -0400, Ian Langworth wrote: This is one of the many features of Test::Cmd, which I a was about to recommend. However, I remember being discouraged from using it, but I'm not sure from where or whom. Does anyone use Test::Cmd? Are there features in it that