Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Web-Machine CPAN distribution.

Report information
The Basics
Id: 83326
Status: open
Priority: 0/
Queue: Web-Machine

People
Owner: Nobody in particular
Requestors: DROLSKY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: The docs refer to "true" when they really mean "1"
I'm not sure how many states this applies to, but for is_authorized the docs say "Returning anything other than true will result ...". But this isn't right. Only a return value of 1 is treated as true. Any other true value must either be a valid status code (as a scalar ref) *or* it will be treated as a failure. Only allowing 1 as true seems to be an issue in a few other spots. I'm happy to work on fixing this, but we should figure out the right behavior first. Is this just a doc fix, or does it merit an API change?
Subject: Re: [rt.cpan.org #83326] The docs refer to "true" when they really mean "1"
Date: Thu, 21 Feb 2013 09:01:08 -0500
To: bug-Web-Machine [...] rt.cpan.org
From: Stevan Little <stevan.little [...] iinteractive.com>
On Feb 14, 2013, at 5:19 PM, Dave Rolsky via RT <bug-Web-Machine@rt.cpan.org> wrote: Show quoted text
> Thu Feb 14 17:19:21 2013: Request 83326 was acted upon. > Transaction: Ticket created by DROLSKY > Queue: Web-Machine > Subject: The docs refer to "true" when they really mean "1" > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: DROLSKY@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=83326 > > > > I'm not sure how many states this applies to, but for is_authorized the > docs say "Returning anything other than true will result ...". But this > isn't right. > > Only a return value of 1 is treated as true. Any other true value must > either be a valid status code (as a scalar ref) *or* it will be treated > as a failure. > > Only allowing 1 as true seems to be an issue in a few other spots. > > I'm happy to work on fixing this, but we should figure out the right > behavior first. Is this just a doc fix, or does it merit an API change?
It is a doc fix if anything, there is no other conditions other then "true" (meaning authorized), HTTP status code (could be anything here, 500 error, whatever), or non-true value (meaning unauthorized). Wouldn't be nice if we had real booleans :) - Stevan
Show quoted text
> > It is a doc fix if anything, there is no other conditions other then > "true" (meaning authorized), HTTP status code (could be anything here, > 500 error, whatever), or non-true value (meaning unauthorized).
I am not sure I completely follow this. Right now Web::Machine treats most true values, per Perl's definition, as false. This is an issue as a not insignificant amount of code does things like return a count for an existential function. As such, when using Web::Machine, you need to defensively write things such as "return 1 if $data_strucutre->has_elements()". A better default, I think, would be to treat anything that is not a status code and is not false within Perl as true. This would be far less surprising. Greg
Subject: Re: [rt.cpan.org #83326] The docs refer to "true" when they really mean "1"
Date: Wed, 27 Mar 2013 21:09:09 -0500 (CDT)
To: "Gregory J. Oschwald via RT" <bug-Web-Machine [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Wed, 27 Mar 2013, Gregory J. Oschwald via RT wrote: Show quoted text
> A better default, I think, would be to treat anything that is not a > status code and is not false within Perl as true. This would be far less > surprising.
The problem is that any true value _other_ than 1 is placed in a WWW-Authenticate header. This seems like an ETOOCUTE error. I think it'd be better to just tell people to set the WWW-Authenticate header themself and return false. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/
Subject: Re: [rt.cpan.org #83326] The docs refer to "true" when they really mean "1"
Date: Thu, 28 Mar 2013 08:07:43 -0400
To: bug-Web-Machine [...] rt.cpan.org
From: Stevan Little <stevan.little [...] iinteractive.com>
This is basically a case where I followed the Ruby and Erlang versions to the letter. Fortunately for those two languages they have proper booleans. I am open to fixing this. - Stevan On Mar 27, 2013, at 10:09 PM, "autarch@urth.org via RT" <bug-Web-Machine@rt.cpan.org> wrote: Show quoted text
> Queue: Web-Machine > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=83326 > > > On Wed, 27 Mar 2013, Gregory J. Oschwald via RT wrote: >
>> A better default, I think, would be to treat anything that is not a >> status code and is not false within Perl as true. This would be far less >> surprising.
> > The problem is that any true value _other_ than 1 is placed in a > WWW-Authenticate header. > > This seems like an ETOOCUTE error. I think it'd be better to just tell > people to set the WWW-Authenticate header themself and return false. > > > -dave > > /*============================================================ > http://VegGuide.org http://blog.urth.org > Your guide to all that's veg House Absolute(ly Pointless) > ============================================================*/ >
On Wed Mar 27 19:09:22 2013, autarch@urth.org wrote: Show quoted text
> The problem is that any true value _other_ than 1 is placed in a > WWW-Authenticate header. > > This seems like an ETOOCUTE error. I think it'd be better to just tell > people to set the WWW-Authenticate header themself and return false.
+1