Skip Menu |

This queue is for tickets about the String-Boolean CPAN distribution.

Report information
The Basics
Id: 63509
Status: open
Priority: 0/
Queue: String-Boolean

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

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



Subject: Perl's Boolean
Perl has a "Boolean" of sorts in the core, and it would be nice if your boolean function returned that kind of Boolean instead of just a 1 or a 0. In order to make a Boolean, you can just use the not operator !. So false is !1 or !!0 and true is !0 or !!1. This is how you can assign the PL_sv_no and PL_sv_yes to scalars inside Perl.
From: ahernit [...] cpan.org
But true/false of "use boolean" also only returns a 1 or 0. So it is the same. Or do I dont understand you?
In the "boolean" module, it is actually using integers blessed into the "boolean" package. And yes, the author does bless just the number 1 and the number 0. I was just saying that since this module is directly handling out a Boolean from the boolean method, it'd be nice if it handed out the actual Perl core Boolean, in perlguts they discuss the PL_sv_no and PL_sv_yes Boolean values. So perl -e 'print 0' and perl -e 'print !!0' don't do the same thing. True is basically a 1 while false is an empty string. But really it doesn't matter. It was just a suggestion since the module was brand new :) Feel free to ignore it.
Subject: Re: [rt.cpan.org #63509] Perl's Boolean
Date: Sat, 11 Dec 2010 21:19:52 +0100
To: bug-String-Boolean [...] rt.cpan.org
From: Andreas Hernitscheck <tech [...] tool.de>
Hi, I just updated the module using boolean. somehow it makes it more complex because wring a if( is_true($s){} if( is_false($s){} might be wrong, because if() does not use boolan of the module "boolean" ... correct? Am 02.12.2010 01:10, schrieb Douglas Christopher Wilson via RT: Show quoted text
> Queue: String-Boolean > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=63509 > > > In the "boolean" module, it is actually using integers blessed into the > "boolean" package. And yes, the author does bless just the number 1 and > the number 0. I was just saying that since this module is directly > handling out a Boolean from the boolean method, it'd be nice if it > handed out the actual Perl core Boolean, in perlguts they discuss the > PL_sv_no and PL_sv_yes Boolean values. So > > perl -e 'print 0' > and > perl -e 'print !!0' > > don't do the same thing. True is basically a 1 while false is an empty > string. But really it doesn't matter. It was just a suggestion since the > module was brand new :) Feel free to ignore it. >
-- Andreas Hernitscheck E-mail: tech@tool.de Gertrud-Bäumer-Str. 10 80637 Munich, Germany Phone: +49 176 210 16 397 Fax: +49 89 21997682 Konferenz: +49 89 21997662 (PIN: 8000)
Subject: Re: [rt.cpan.org #63509] Perl's Boolean
Date: Sun, 12 Dec 2010 20:58:21 -0500
To: <bug-String-Boolean [...] rt.cpan.org>
From: "Douglas Wilson" <doug [...] somethingdoug.com>
Hm. I'm not sure what you mean exactly. The module boolean will return the number 1 for true and the number 0 for false. This will correctly work with the if construct in Perl. You'll want to see perlsyn for the specifics about Perl's true and false: http://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood The relevant excerpt is: The number 0, the strings '0' and '' , the empty list () , and undef are all false in a boolean context. All other values are true. Negation of a true value by ! or not returns a special false value. When evaluated as a string it is treated as '' , but as a number, it is treated as 0. Show quoted text
-----Original Message----- From: tech via RT Sent: Saturday, December 11, 2010 15:20 To: DOUGDUDE@cpan.org Subject: Re: [rt.cpan.org #63509] Perl's Boolean <URL: http://rt.cpan.org/Ticket/Display.html?id=63509 > Hi, I just updated the module using boolean. somehow it makes it more complex because wring a if( is_true($s){} if( is_false($s){} might be wrong, because if() does not use boolan of the module "boolean" ... correct? Am 02.12.2010 01:10, schrieb Douglas Christopher Wilson via RT:
> Queue: String-Boolean > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=63509 > > > In the "boolean" module, it is actually using integers blessed into the > "boolean" package. And yes, the author does bless just the number 1 and > the number 0. I was just saying that since this module is directly > handling out a Boolean from the boolean method, it'd be nice if it > handed out the actual Perl core Boolean, in perlguts they discuss the > PL_sv_no and PL_sv_yes Boolean values. So > > perl -e 'print 0' > and > perl -e 'print !!0' > > don't do the same thing. True is basically a 1 while false is an empty > string. But really it doesn't matter. It was just a suggestion since the > module was brand new :) Feel free to ignore it. >
-- Andreas Hernitscheck E-mail: tech@tool.de Gertrud-Bäumer-Str. 10 80637 Munich, Germany Phone: +49 176 210 16 397 Fax: +49 89 21997682 Konferenz: +49 89 21997662 (PIN: 8000)