Skip Menu |

This queue is for tickets about the Devel-Comments CPAN distribution.

Report information
The Basics
Id: 62599
Status: resolved
Worked: 1.2 hours (75 min)
Priority: 0/
Queue: Devel-Comments

People
Owner: xiong [...] cpan.org (daily)
Requestors: mike [...] stok.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: v1.1.2
Fixed in: (no value)



Subject: Documentation for -ENV does not agree with code.
In the documentation (on CPAN) you say: CONFIGURATION AND ENVIRONMENT ^ Devel::Comments can make use of an environment variable from your shell: Devel_Comments. This variable can be specified either with a true/false value (i.e. 1 or 0) or with the same arguments as may be passed on the use line when loading the module (see "INTERFACE"). The following table summarizes the behaviour: ... In the code around line 386 you look for Smart_Comments in the environment: # Handle intros and env args... while (@_) { my $arg = shift @_; if ($arg =~ m{\A -ENV \Z}xms) { my $env = $ENV{Smart_Comments} || $ENV{SMART_COMMENTS} || $ENV{SmartComments} || $ENV{SMARTCOMMENTS} ; return 0 if !$env; # i.e. if no filtering ABORT if ($env !~ m{\A \s* 1 \s* \Z}xms) { unshift @_, split m{\s+|\s*:\s*}xms, $env; } } else { push @intros, $arg; } } I am not sure what your intent was, so I have not attached a patch. The code and the documentation should agree, and if you want to be compatible with Smart::Comments and use the same environment variable then it should be the documentation which changes.
Thanks for reporting, Mike. That sure is a bug. I'm not quite sure how to fix it -- like you, I'm unsure of my intent. I committed to drop-in replacement compatibility with Smart::Comments throughout v1.x.x which would seem to mean I respect any one of the 4 alternate spellings of 'Smart_Comments' (or at least the one documented for S::C). One reason I forked instead of submitting a patch was that I disagree somewhat with a lot of the overall approach of S::C. That POD documents only $ENV{Smart_Comments} but the code supports 4 variants. I can see *why*; but I don't agree. If S::C supported only what was documented, I'd probably have supported both 'Devel_Comments' and 'Smart_Comments'. I think I felt icky about supporting a total of 8 variants. Complicating this, in my head at least, was that increasing the number of possible use-line arguments demands a new calling syntax and a considerable improvement in argument parsing. I have not done this yet; the argument parser is half the old Conway code and half stuff I jammed in. Therefore, as I did document, you can't use either flat list or named parameter calling syntax for all options. Building a clean argument parser is, I guess, the hot task. But that shouldn't really impede a bugfix for your report. I'm going to say, Mike, that since you're the fellow who took the time to report this, you get to pick. I can rewrite the POD to match the code; rewrite the code to match the POD; or support some other set of environment variables and rewrite both. Any of these is an easy task and I'll be delighted to please you. Thanks again for bringing this up.
Subject: Re: [rt.cpan.org #62599] Documentation for -ENV does not agree with code.
Date: Tue, 2 Nov 2010 21:59:06 -0400
To: bug-Devel-Comments [...] rt.cpan.org
From: Mike Stok <mike [...] stok.co.uk>
On Oct 31, 2010, at 6:45 PM, Xiong Changnian via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=62599 > > > Thanks for reporting, Mike. That sure is a bug. I'm not quite sure how > to fix it -- like you, I'm unsure of my intent. I committed to drop-in > replacement compatibility with Smart::Comments throughout v1.x.x which > would seem to mean I respect any one of the 4 alternate spellings of > 'Smart_Comments' (or at least the one documented for S::C). > > One reason I forked instead of submitting a patch was that I disagree > somewhat with a lot of the overall approach of S::C. That POD documents > only $ENV{Smart_Comments} but the code supports 4 variants. I can see > *why*; but I don't agree. If S::C supported only what was documented, > I'd probably have supported both 'Devel_Comments' and 'Smart_Comments'. > I think I felt icky about supporting a total of 8 variants. > > Complicating this, in my head at least, was that increasing the number > of possible use-line arguments demands a new calling syntax and a > considerable improvement in argument parsing. I have not done this yet; > the argument parser is half the old Conway code and half stuff I jammed > in. Therefore, as I did document, you can't use either flat list or > named parameter calling syntax for all options. Building a clean > argument parser is, I guess, the hot task. But that shouldn't really > impede a bugfix for your report. > > I'm going to say, Mike, that since you're the fellow who took the time > to report this, you get to pick. I can rewrite the POD to match the > code; rewrite the code to match the POD; or support some other set of > environment variables and rewrite both. Any of these is an easy task and > I'll be delighted to please you. > > Thanks again for bringing this up.
My first thought would be to make the $ENV{Smart_Comments} family of environment variables "second class" - only used if there was no $ENV{Devel_Comments} environment variable found. That way people using Devel::Comments as a drop-in would still be able to use it that way, and people wanting to use more advanced features through the environment would start using $ENV{Devel_Comments}. You would only have to upgrade and maintain $ENV{Devel_Comments} with one spelling, and could deprecate $ENV{Smart_Comments} in a later release. To avoid documentation issues I would refer people to Smart::COmments documentation if they want to use the Smart_Comments variable, and you can then develop the functionality of Devel_Comments without worrying about backward compatibility. Well those are my 2 cents, I'll think about it at the weekend some more! Regards, Mike -- Mike Stok <mike@stok.co.uk> http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.
Subject: Re: [rt.cpan.org #62599] Documentation for -ENV does not agree with code.
Date: Sun, 7 Nov 2010 22:07:47 -0500
To: bug-Devel-Comments [...] rt.cpan.org
From: Mike Stok <mike [...] stok.co.uk>
On Oct 31, 2010, at 6:45 PM, Xiong Changnian via RT wrote: Show quoted text
> I'm going to say, Mike, that since you're the fellow who took the time > to report this, you get to pick. I can rewrite the POD to match the > code; rewrite the code to match the POD; or support some other set of > environment variables and rewrite both. Any of these is an easy task and > I'll be delighted to please you. > > Thanks again for bringing this up.
Here's a patch against 1.1.2 which follows up my thinking in my last message. What do you think? Mike

Message body is not shown because sender requested not to inline it.

-- Mike Stok <mike@stok.co.uk> http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.
On 2010-11-07 22:08:00, MIKESTOK wrote: Show quoted text
> Here's a patch against 1.1.2... > What do you think?
Well, first I should say, Great! Then I should apologize for being absent a week. I bought an old car and have not been... focused on anything else. My thinking is that I will stick in your patch and immediately release 1.1.3. By "immediately", I mean this week. Thanks very much.
Resolved; released version 1.1.3 Thanks, Mike Stok!