r67407 - in /trunk/libboolean-perl: ./ debian/ inc/Module/Install/ lib/ t/

carnil at users.alioth.debian.org carnil at users.alioth.debian.org
Fri Jan 14 20:46:15 UTC 2011


Author: carnil
Date: Fri Jan 14 20:46:09 2011
New Revision: 67407

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=67407
Log:
* Add myself to Uploaders.
* New upstream release
* debian/copyright: Refresh upstream copyright years.

Added:
    trunk/libboolean-perl/inc/Module/Install/VersionCheck.pm
      - copied unchanged from r67404, branches/upstream/libboolean-perl/current/inc/Module/Install/VersionCheck.pm
    trunk/libboolean-perl/t/autobox.t
      - copied unchanged from r67404, branches/upstream/libboolean-perl/current/t/autobox.t
Modified:
    trunk/libboolean-perl/Changes
    trunk/libboolean-perl/MANIFEST
    trunk/libboolean-perl/META.yml
    trunk/libboolean-perl/Makefile.PL
    trunk/libboolean-perl/README
    trunk/libboolean-perl/debian/changelog
    trunk/libboolean-perl/debian/control
    trunk/libboolean-perl/debian/copyright
    trunk/libboolean-perl/inc/Module/Install/AckXXX.pm
    trunk/libboolean-perl/inc/Module/Install/ManifestSkip.pm
    trunk/libboolean-perl/lib/boolean.pm
    trunk/libboolean-perl/t/boolean.t

Modified: trunk/libboolean-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/Changes?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/Changes (original)
+++ trunk/libboolean-perl/Changes Fri Jan 14 20:46:09 2011
@@ -1,3 +1,12 @@
+---
+version: 0.24
+date:    Thu Jan 13 15:27:09 EST 2011
+changes:
+- @Schwern++ found out how to make true and false immutable.
+  Kudos to #strategicdata++.
+- Document the boolean() function.
+- Added is_true and is_false methods.
+- Added boolean, is_true, and is_false autobox methods
 ---
 version: 0.23
 date:    Thu Sep 16 19:27:54 PDT 2010

Modified: trunk/libboolean-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/MANIFEST?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/MANIFEST (original)
+++ trunk/libboolean-perl/MANIFEST Fri Jan 14 20:46:09 2011
@@ -8,6 +8,7 @@
 inc/Module/Install/ManifestSkip.pm
 inc/Module/Install/Metadata.pm
 inc/Module/Install/ReadmeFromPod.pm
+inc/Module/Install/VersionCheck.pm
 inc/Module/Install/Win32.pm
 inc/Module/Install/WriteAll.pm
 lib/boolean.pm
@@ -15,5 +16,6 @@
 MANIFEST			This list of files
 META.yml
 README
+t/autobox.t
 t/boolean.t
 t/export.t

Modified: trunk/libboolean-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/META.yml?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/META.yml (original)
+++ trunk/libboolean-perl/META.yml Fri Jan 14 20:46:09 2011
@@ -17,8 +17,11 @@
   directory:
     - inc
     - t
+recommends:
+  Readonly: 0
+  autobox: 0
 requires:
   perl: 5.005003
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.23
+version: 0.24

Modified: trunk/libboolean-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/Makefile.PL?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/Makefile.PL (original)
+++ trunk/libboolean-perl/Makefile.PL Fri Jan 14 20:46:09 2011
@@ -4,6 +4,10 @@
 all_from        'lib/boolean.pm';
 readme_from;
 manifest_skip;
+version_check;
 ack_xxx;
 
+recommends      'Readonly';
+recommends      'autobox';
+
 WriteAll;

Modified: trunk/libboolean-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/README?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/README (original)
+++ trunk/libboolean-perl/README Fri Jan 14 20:46:09 2011
@@ -6,6 +6,15 @@
 
         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;
 
     and:
 
@@ -34,14 +43,6 @@
     This module provides basic Boolean support, by defining two special
     objects: "true" and "false".
 
-IMPLEMENTATION NOTE
-    Version 0.20 is a complete rewrite from version 0.12. The old version
-    used XS and had some fundamental flaws. The new version is pure Perl and
-    is more correct. The new version depends on overload.pm to make the true
-    and false objects return 1 and 0 respectively.
-
-    The "null" support found in 0.12 was also removed as superfluous.
-
 RATIONALE
     When sharing data between programming languages, it is important to
     support the same group of basic types. In Perlish programming languages,
@@ -68,6 +69,10 @@
         the value is the "false" object with the isFalse function described
         below.
 
+    boolean($scalar)
+        Casts the scalar value to a boolean value. If $scalar is true, it
+        returns "boolean::true", otherwise it returns "boolean::false".
+
     isTrue($scalar)
         Returns "boolean::true" if the scalar passed to it is the
         "boolean::true" object. Returns "boolean::false" otherwise.
@@ -81,13 +86,36 @@
         "boolean::true" or "boolean::false" object. Returns "boolean::false"
         otherwise.
 
+METHODS
+    Since true and false return objects, you can call methods on them.
+
+    $boolean->is_true
+        Same as isTrue($boolean).
+
+    $boolean->is_false
+        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" and "false" functions.
+    By default this module exports the "true", "false" and "boolean"
+    functions.
 
     The module also defines these export tags:
 
     :all
-        Exports "true", "false", "isTrue", "isFalse", "isBoolean"
+        Exports "true", "false", "boolean", "isTrue", "isFalse", "isBoolean"
 
     :test
         Exports "isTrue", "isFalse", "isBoolean"
@@ -96,7 +124,7 @@
     Ingy döt Net <ingy at cpan.org>
 
 COPYRIGHT
-    Copyright (c) 2007, 2008, 2010. Ingy döt Net.
+    Copyright (c) 2007, 2008, 2010, 2011. Ingy döt Net.
 
     This program is free software; you can redistribute it and/or modify it
     under the same terms as Perl itself.

Modified: trunk/libboolean-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/debian/changelog?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/debian/changelog (original)
+++ trunk/libboolean-perl/debian/changelog Fri Jan 14 20:46:09 2011
@@ -1,8 +1,14 @@
-libboolean-perl (0.23-2) UNRELEASED; urgency=low
+libboolean-perl (0.24-1) unstable; urgency=low
 
+  [ Ansgar Burchardt ]
   * Update my email address.
 
- -- Ansgar Burchardt <ansgar at debian.org>  Mon, 01 Nov 2010 11:16:19 +0100
+  [ Salvatore Bonaccorso ]
+  * Add myself to Uploaders.
+  * New upstream release
+  * debian/copyright: Refresh upstream copyright years.
+
+ -- Salvatore Bonaccorso <carnil at debian.org>  Fri, 14 Jan 2011 21:46:03 +0100
 
 libboolean-perl (0.23-1) unstable; urgency=low
 

Modified: trunk/libboolean-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/debian/control?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/debian/control (original)
+++ trunk/libboolean-perl/debian/control Fri Jan 14 20:46:09 2011
@@ -4,7 +4,8 @@
 Build-Depends: debhelper (>= 7)
 Build-Depends-Indep: perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Ansgar Burchardt <ansgar at debian.org>
+Uploaders: Ansgar Burchardt <ansgar at debian.org>,
+ Salvatore Bonaccorso <carnil at debian.org>
 Standards-Version: 3.9.1
 Homepage: http://search.cpan.org/dist/boolean/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libboolean-perl/

Modified: trunk/libboolean-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/debian/copyright?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/debian/copyright (original)
+++ trunk/libboolean-perl/debian/copyright Fri Jan 14 20:46:09 2011
@@ -4,7 +4,7 @@
 Source: http://search.cpan.org/dist/boolean/
 
 Files: *
-Copyright: 2007-2010, Ingy döt Net <ingy at cpan.org>
+Copyright: 2007-2011, Ingy döt Net <ingy at cpan.org>
 License: Artistic or GPL-1+
 
 Files: inc/*

Modified: trunk/libboolean-perl/inc/Module/Install/AckXXX.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/inc/Module/Install/AckXXX.pm?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/inc/Module/Install/AckXXX.pm (original)
+++ trunk/libboolean-perl/inc/Module/Install/AckXXX.pm Fri Jan 14 20:46:09 2011
@@ -8,7 +8,7 @@
 
 use vars qw($VERSION @ISA);
 BEGIN {
-    $VERSION = '0.10';
+    $VERSION = '0.11';
     @ISA     = 'Module::Install::Base';
 }
 

Modified: trunk/libboolean-perl/inc/Module/Install/ManifestSkip.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/inc/Module/Install/ManifestSkip.pm?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/inc/Module/Install/ManifestSkip.pm (original)
+++ trunk/libboolean-perl/inc/Module/Install/ManifestSkip.pm Fri Jan 14 20:46:09 2011
@@ -8,7 +8,7 @@
 
 use vars qw($VERSION @ISA);
 BEGIN {
-    $VERSION = '0.12';
+    $VERSION = '0.14';
     @ISA     = 'Module::Install::Base';
 }
 
@@ -18,7 +18,7 @@
     my $self = shift;
     return unless $self->is_admin;
 
-    print "Updating $skip_file\n";
+    print "manifest_skip\n";
 
     my $keepers;
     if (-e $skip_file) {
@@ -69,7 +69,7 @@
 ^todo
 ^ToDo$
 ## avoid OS X finder files
-^\.DS_Store$
+\.DS_Store$
 ## skip komodo project files
 \.kpf$
 ## ignore emacs and vim backup files

Modified: trunk/libboolean-perl/lib/boolean.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/lib/boolean.pm?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/lib/boolean.pm (original)
+++ trunk/libboolean-perl/lib/boolean.pm Fri Jan 14 20:46:09 2011
@@ -2,7 +2,7 @@
 use 5.005003;
 use strict;
 # use warnings;
-$boolean::VERSION = '0.23';
+$boolean::VERSION = '0.24';
 
 my ($true, $false);
 
@@ -22,14 +22,22 @@
 my ($true_val, $false_val, $bool_vals);
 
 BEGIN {
-    $true  = do {bless \(my $t = 1), 'boolean'};
-    $false = do {bless \(my $f = 0), 'boolean'};
+    my $have_readonly = eval { require Readonly };
+
+    my $t = 1;
+    my $f = 0;
+    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};
 }
 
-# use XXX;
 sub true()  { $true }
 sub false() { $false }
 sub boolean($) {
@@ -51,6 +59,25 @@
     (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;
 
 =encoding utf8
@@ -65,6 +92,15 @@
 
     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;
 
 and:
 
@@ -94,15 +130,6 @@
 This module provides basic Boolean support, by defining two special
 objects: C<true> and C<false>.
 
-=head1 IMPLEMENTATION NOTE
-
-Version 0.20 is a complete rewrite from version 0.12. The old version
-used XS and had some fundamental flaws. The new version is pure Perl and
-is more correct. The new version depends on overload.pm to make the
-true and false objects return 1 and 0 respectively.
-
-The "null" support found in 0.12 was also removed as superfluous.
-
 =head1 RATIONALE
 
 When sharing data between programming languages, it is important to
@@ -133,6 +160,11 @@
 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)
+
+Casts the scalar value to a boolean value. If C<$scalar> is true, it
+returns C<boolean::true>, otherwise it returns C<boolean::false>.
+
 =item isTrue($scalar)
 
 Returns C<boolean::true> if the scalar passed to it is the
@@ -151,9 +183,45 @@
 
 =back
 
+=head1 METHODS
+
+Since true and false return objects, you can call methods on them.
+
+=over
+
+=item $boolean->is_true
+
+Same as isTrue($boolean).
+
+=item $boolean->is_false
+
+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
+
 =head1 EXPORTABLES
 
-By default this module exports the C<true> and C<false> functions.
+By default this module exports the C<true>, C<false> and C<boolean> functions.
 
 The module also defines these export tags:
 
@@ -161,7 +229,7 @@
 
 =item :all
 
-Exports C<true>, C<false>, C<isTrue>, C<isFalse>, C<isBoolean>
+Exports C<true>, C<false>, C<boolean>, C<isTrue>, C<isFalse>, C<isBoolean>
 
 =item :test
 
@@ -175,7 +243,7 @@
 
 =head1 COPYRIGHT
 
-Copyright (c) 2007, 2008, 2010. Ingy döt Net.
+Copyright (c) 2007, 2008, 2010, 2011. Ingy döt Net.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Modified: trunk/libboolean-perl/t/boolean.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libboolean-perl/t/boolean.t?rev=67407&op=diff
==============================================================================
--- trunk/libboolean-perl/t/boolean.t (original)
+++ trunk/libboolean-perl/t/boolean.t Fri Jan 14 20:46:09 2011
@@ -1,4 +1,4 @@
-use Test::More tests => 55;
+use Test::More tests => 61;
 use strict;
 use lib 'lib';
 
@@ -108,7 +108,15 @@
 eval 'true(())'; ok $@, "Can't pass values to true/false";
 eval 'false(undef)'; ok $@, "Can't pass values to true/false";
 
-# my $c = true;
-# $$c = 0;
-# ok $c ? 1 : 0, "true is imutable";
+# Check that true is immutable
+SKIP: {
+    skip "Need Readonly to make truth immutable", 4 if !eval { require Readonly };
+    for my $bool (true, false) {
+        my $truthiness = !!$bool;
+        ok !eval { $$bool = 0; 1 }, "truth is forever";
+        is $bool, $truthiness, "imutable";
+    }
+}
 
+ok true->is_true, "true is_true";
+ok false->is_false, "true is_true";




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