r67436 - in /branches/upstream/libboolean-perl/current: Changes MANIFEST META.yml README lib/boolean.pm t/autobox.t t/boolean.t

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Sun Jan 16 10:15:53 UTC 2011


Author: periapt-guest
Date: Sun Jan 16 10:15:37 2011
New Revision: 67436

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=67436
Log:
[svn-upgrade] new version libboolean-perl (0.25)

Removed:
    branches/upstream/libboolean-perl/current/t/autobox.t
Modified:
    branches/upstream/libboolean-perl/current/Changes
    branches/upstream/libboolean-perl/current/MANIFEST
    branches/upstream/libboolean-perl/current/META.yml
    branches/upstream/libboolean-perl/current/README
    branches/upstream/libboolean-perl/current/lib/boolean.pm
    branches/upstream/libboolean-perl/current/t/boolean.t

Modified: branches/upstream/libboolean-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libboolean-perl/current/Changes?rev=67436&op=diff
==============================================================================
--- branches/upstream/libboolean-perl/current/Changes (original)
+++ branches/upstream/libboolean-perl/current/Changes Sun Jan 16 10:15:37 2011
@@ -1,3 +1,13 @@
+---
+version: 0.25
+date:    Sat Jan 15 19:05:19 EST 2011
+changes:
+- Fixed a bug caused by Readonly::XS (schwern++)
+- Removed the new methods and autobox methods.
+  They didn't add much except confusion.
+- Documented that you can use isTrue and isFalse as methods.
+- &boolean(1,2,3) now dies like boolean(1,2,3)
+- &boolean() now dies like boolean()
 ---
 version: 0.24
 date:    Thu Jan 13 15:27:09 EST 2011

Modified: branches/upstream/libboolean-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libboolean-perl/current/MANIFEST?rev=67436&op=diff
==============================================================================
--- branches/upstream/libboolean-perl/current/MANIFEST (original)
+++ branches/upstream/libboolean-perl/current/MANIFEST Sun Jan 16 10:15:37 2011
@@ -16,6 +16,5 @@
 MANIFEST			This list of files
 META.yml
 README
-t/autobox.t
 t/boolean.t
 t/export.t

Modified: branches/upstream/libboolean-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libboolean-perl/current/META.yml?rev=67436&op=diff
==============================================================================
--- branches/upstream/libboolean-perl/current/META.yml (original)
+++ branches/upstream/libboolean-perl/current/META.yml Sun Jan 16 10:15:37 2011
@@ -24,4 +24,4 @@
   perl: 5.005003
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.24
+version: 0.25

Modified: branches/upstream/libboolean-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libboolean-perl/current/README?rev=67436&op=diff
==============================================================================
--- branches/upstream/libboolean-perl/current/README (original)
+++ branches/upstream/libboolean-perl/current/README Sun Jan 16 10:15:37 2011
@@ -7,14 +7,7 @@
         do &always if true;
         do &never if false;
 
-        do &maybe if boolean($value)->is_true;
-
-    With autobox:
-
-        use autobox;
-        use boolean;
-
-        do &maybe if $value->is_true;
+        do &maybe if boolean($value)->isTrue;
 
     and:
 
@@ -56,14 +49,14 @@
     This module defines the following functions:
 
     true
-        This function returns a scalar value which should evaluate to true.
+        This function returns a scalar value which will evaluate to true.
         The value is a singleton object, meaning there is only one "true"
         value in a Perl process at any time. You can check to see whether
         the value is the "true" object with the isTrue function described
         below.
 
     false
-        This function returns a scalar value which should evaluate to false.
+        This function returns a scalar value which will evaluate to false.
         The value is a singleton object, meaning there is only one "false"
         value in a Perl process at any time. You can check to see whether
         the value is the "false" object with the isFalse function described
@@ -89,24 +82,11 @@
 METHODS
     Since true and false return objects, you can call methods on them.
 
-    $boolean->is_true
+    $boolean->isTrue
         Same as isTrue($boolean).
 
-    $boolean->is_false
+    $boolean->isFalse
         Same as isFalse($boolean).
-
-  autobox Methods
-    If you use "boolean" with "autobox" you can call the following methods
-    on any scalar:
-
-    $scalar->boolean
-        Same as boolean($scalar).
-
-    $scalar->is_true
-        Same as isTrue(boolean($scalar)).
-
-    $scalar->is_false
-        Same as isFalse(boolean($scalar)).
 
 EXPORTABLES
     By default this module exports the "true", "false" and "boolean"
@@ -116,9 +96,6 @@
 
     :all
         Exports "true", "false", "boolean", "isTrue", "isFalse", "isBoolean"
-
-    :test
-        Exports "isTrue", "isFalse", "isBoolean"
 
 AUTHOR
     Ingy döt Net <ingy at cpan.org>
@@ -131,3 +108,12 @@
 
     See http://www.perl.com/perl/misc/Artistic.html
 
+POD ERRORS
+    Hey! The above document had some coding errors, which are explained
+    below:
+
+    Around line 177:
+        You forgot a '=back' before '=head1'
+
+        You forgot a '=back' before '=head1'
+

Modified: branches/upstream/libboolean-perl/current/lib/boolean.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libboolean-perl/current/lib/boolean.pm?rev=67436&op=diff
==============================================================================
--- branches/upstream/libboolean-perl/current/lib/boolean.pm (original)
+++ branches/upstream/libboolean-perl/current/lib/boolean.pm Sun Jan 16 10:15:37 2011
@@ -2,7 +2,7 @@
 use 5.005003;
 use strict;
 # use warnings;
-$boolean::VERSION = '0.24';
+$boolean::VERSION = '0.25';
 
 my ($true, $false);
 
@@ -26,13 +26,14 @@
 
     my $t = 1;
     my $f = 0;
+    $true  = do {bless \$t, 'boolean'};
+    $false = do {bless \$f, 'boolean'};
+
     if ( $have_readonly ) {
         Readonly::Scalar($t => $t);
         Readonly::Scalar($f => $f);
     }
 
-    $true  = do {bless \$t, 'boolean'};
-    $false = do {bless \$f, 'boolean'};
     $true_val  = overload::StrVal($true);
     $false_val = overload::StrVal($false);
     $bool_vals = {$true_val => 1, $false_val => 1};
@@ -41,42 +42,23 @@
 sub true()  { $true }
 sub false() { $false }
 sub boolean($) {
-    return $false if scalar(@_) == 0;
-    return $true if scalar(@_) > 1;
+    die "Not enough arguments for boolean::boolean" if scalar(@_) == 0;
+    die "Too many arguments for boolean::boolean" if scalar(@_) > 1;
     return not(defined $_[0]) ? false :
     "$_[0]" ? $true : $false;
+}
+sub isTrue($)  {
+    not(defined $_[0]) ? false :
+    (overload::StrVal($_[0]) eq $true_val)  ? true : false;
+}
+sub isFalse($) {
+    not(defined $_[0]) ? false :
+    (overload::StrVal($_[0]) eq $false_val) ? true : false;
 }
 sub isBoolean($) {
     not(defined $_[0]) ? false :
     (exists $bool_vals->{overload::StrVal($_[0])}) ? true : false;
 }
-sub isTrue($)  {
-    not(defined $_[0]) ? false :
-    (overload::StrVal($_[0]) eq $true_val)  ? true : false;
-}
-sub isFalse($) {
-    not(defined $_[0]) ? false :
-    (overload::StrVal($_[0]) eq $false_val) ? true : false;
-}
-
-# Methods
-sub is_true {
-    return isTrue($_[0]);
-}
-sub is_false {
-    return isFalse($_[0]);
-}
-
-# For autobox
-sub SCALAR::boolean {
-    return boolean($_[0]);
-}
-sub SCALAR::is_true {
-    return isTrue(boolean($_[0]));
-}
-sub SCALAR::is_false {
-    return isFalse(boolean($_[0]));
-}
 
 1;
 
@@ -93,14 +75,7 @@
     do &always if true;
     do &never if false;
 
-    do &maybe if boolean($value)->is_true;
-
-With autobox:
-
-    use autobox;
-    use boolean;
-
-    do &maybe if $value->is_true;
+    do &maybe if boolean($value)->isTrue;
 
 and:
 
@@ -148,17 +123,17 @@
 
 =item true
 
-This function returns a scalar value which should evaluate to true. The
+This function returns a scalar value which will evaluate to true. The
 value is a singleton object, meaning there is only one "true" value in a
 Perl process at any time. You can check to see whether the value is the
 "true" object with the isTrue function described below.
 
 =item false
 
-This function returns a scalar value which should evaluate to false. The
-value is a singleton object, meaning there is only one "false" value in a
-Perl process at any time. You can check to see whether the value is the
-"false" object with the isFalse function described below.
+This function returns a scalar value which will evaluate to false. The
+value is a singleton object, meaning there is only one "false" value in
+a Perl process at any time. You can check to see whether the value is
+the "false" object with the isFalse function described below.
 
 =item boolean($scalar)
 
@@ -189,35 +164,15 @@
 
 =over
 
-=item $boolean->is_true
+=item $boolean->isTrue
 
 Same as isTrue($boolean).
 
-=item $boolean->is_false
+=item $boolean->isFalse
 
 Same as isFalse($boolean).
 
-=back
-
-=head2 autobox Methods
-
-If you use C<boolean> with C<autobox> you can call the following methods on any scalar:
-
-=over
-
-=item $scalar->boolean
-
-Same as boolean($scalar).
-
-=item $scalar->is_true
-
-Same as isTrue(boolean($scalar)).
-
-=item $scalar->is_false
-
-Same as isFalse(boolean($scalar)).
-
-=back
+=over
 
 =head1 EXPORTABLES
 
@@ -230,10 +185,6 @@
 =item :all
 
 Exports C<true>, C<false>, C<boolean>, C<isTrue>, C<isFalse>, C<isBoolean>
-
-=item :test
-
-Exports C<isTrue>, C<isFalse>, C<isBoolean>
 
 =back
 

Modified: branches/upstream/libboolean-perl/current/t/boolean.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libboolean-perl/current/t/boolean.t?rev=67436&op=diff
==============================================================================
--- branches/upstream/libboolean-perl/current/t/boolean.t (original)
+++ branches/upstream/libboolean-perl/current/t/boolean.t Sun Jan 16 10:15:37 2011
@@ -1,4 +1,4 @@
-use Test::More tests => 61;
+use Test::More tests => 65;
 use strict;
 use lib 'lib';
 
@@ -87,6 +87,19 @@
 ok $f == 0, 'false == 0';
 
 # boolean()
+eval "boolean()";
+like $@, qr/Not enough arguments for boolean::boolean/,
+    "boolean() has too few args (prototyped)";
+eval "&boolean()";
+like $@, qr/Not enough arguments for boolean::boolean/,
+    "&boolean() has too few args (unprototyped)";
+eval "boolean(1,2,3)";
+like $@, qr/Too many arguments for boolean::boolean/,
+    "boolean(1,2,3) has too many args (prototyped)";
+eval "&boolean(1,2,3)";
+like $@, qr/Too many arguments for boolean::boolean/,
+    "&boolean(1,2,3) has too many args (unprototyped)";
+
 my @t = (0);
 ok isBoolean(boolean(42)), "boolean() returns boolean";
 ok isBoolean(boolean(undef)), "boolean() works with undef";
@@ -118,5 +131,5 @@
     }
 }
 
-ok true->is_true, "true is_true";
-ok false->is_false, "true is_true";
+ok true->isTrue, "true isTrue";
+ok false->isFalse, "false isFalse";




More information about the Pkg-perl-cvs-commits mailing list