r69059 - in /trunk/libdata-peek-perl: ChangeLog MANIFEST META.yml Makefile.PL Peek.pm Peek.xs README debian/changelog debian/copyright t/11_DDumper.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Feb 19 03:49:01 UTC 2011


Author: jawnsy-guest
Date: Sat Feb 19 03:48:49 2011
New Revision: 69059

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=69059
Log:
Updates copyright information only
IGNORE-VERSION: 0.33-1
* New upstream release

Added:
    trunk/libdata-peek-perl/t/11_DDumper.t
      - copied unchanged from r69058, branches/upstream/libdata-peek-perl/current/t/11_DDumper.t
Modified:
    trunk/libdata-peek-perl/ChangeLog
    trunk/libdata-peek-perl/MANIFEST
    trunk/libdata-peek-perl/META.yml
    trunk/libdata-peek-perl/Makefile.PL
    trunk/libdata-peek-perl/Peek.pm
    trunk/libdata-peek-perl/Peek.xs
    trunk/libdata-peek-perl/README
    trunk/libdata-peek-perl/debian/changelog
    trunk/libdata-peek-perl/debian/copyright

Modified: trunk/libdata-peek-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/ChangeLog?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/ChangeLog (original)
+++ trunk/libdata-peek-perl/ChangeLog Sat Feb 19 03:48:49 2011
@@ -1,3 +1,8 @@
+2011-02-16 0.33 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+    * Added DTidy (): stream DDumper output through Perl::Tidy
+    * Upped copyright to 2011
+
 2010-11-21 0.32 - H.Merijn Brand   <h.m.brand at xs4all.nl>
 
     * Require perl 5.8.0

Modified: trunk/libdata-peek-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/MANIFEST?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/MANIFEST (original)
+++ trunk/libdata-peek-perl/MANIFEST Sat Feb 19 03:48:49 2011
@@ -9,6 +9,7 @@
 t/00_pod.t		Check if pod is valid
 t/01_pod.t		Check if pod covers all
 t/10_DDumper.t		Tests for DDumper ()
+t/11_DDumper.t		Tests for DDumper () using Perl::Tidy
 t/20_DPeek.t		Tests for DPeek ()
 t/21_DDisplay.t		Tests for DDisplay ()
 t/22_DHexDump.t		Tests for DHexDump ()

Modified: trunk/libdata-peek-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/META.yml?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/META.yml (original)
+++ trunk/libdata-peek-perl/META.yml Sat Feb 19 03:48:49 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                    Data::Peek
-version:                 0.32
+version:                 0.33
 abstract:                Modified and extended debugging facilities
 license:                 perl
 author:              
@@ -10,17 +10,19 @@
 provides:
     Data::Peek:
         file:            Peek.pm
-        version:         0.32
+        version:         0.33
 requires:     
     perl:                5.008
     DynaLoader:          0
+    Data::Dumper:        0
 recommends:
-    perl:                5.012002
+    perl:                5.012003
+    Perl::Tidy:          0
 configure_requires:
     ExtUtils::MakeMaker: 0
 build_requires:
     perl:                5.008
-    Data::Dumper:        0
+test_requires:
     Test::Harness:       0
     Test::More:          0
     Test::NoWarnings:    0

Modified: trunk/libdata-peek-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/Makefile.PL?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/Makefile.PL (original)
+++ trunk/libdata-peek-perl/Makefile.PL Sat Feb 19 03:48:49 2011
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# Copyright PROCURA B.V. (c) 2008-2010 H.Merijn Brand
+# Copyright PROCURA B.V. (c) 2008-2011 H.Merijn Brand
 
 require 5.008; # <- also see postamble at the bottom for META.yml
 use strict;
@@ -92,7 +92,7 @@
 	q{	sandbox/leaktest $(FULLPERLRUN) "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)},
 	'',
 	'spellcheck:',
-	'	pod-spell-check --aspell',
+	'	pod-spell-check --aspell --ispell',
 	'',
 	'checkmeta:	spellcheck',
 	'	perl sandbox/genMETA.pl -c',
@@ -134,7 +134,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2008-2010 H.Merijn Brand
+Copyright (C) 2008-2011 H.Merijn Brand
 
 This library is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Modified: trunk/libdata-peek-perl/Peek.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/Peek.pm?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/Peek.pm (original)
+++ trunk/libdata-peek-perl/Peek.pm Sat Feb 19 03:48:49 2011
@@ -6,13 +6,23 @@
 use DynaLoader ();
 
 use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
-$VERSION   = "0.32";
+$VERSION   = "0.33";
 @ISA       = qw( DynaLoader Exporter );
- at EXPORT    = qw( DDumper DDsort DPeek DDisplay DDump DHexDump DDual DGrow );
- at EXPORT_OK = qw( triplevar );
+ at EXPORT    = qw( DDumper DTidy DDsort DPeek DDisplay DDump DHexDump
+		 DDual DGrow );
+ at EXPORT_OK = qw( triplevar :tidy );
 push @EXPORT, "DDump_IO";
 
 bootstrap Data::Peek $VERSION;
+
+our $has_perlio;
+our $has_perltidy;
+
+BEGIN {
+    use Config;
+    $has_perlio   = ($Config{useperlio} || "undef") eq "define";
+    $has_perltidy = eval q{use Perl::Tidy; $Perl::Tidy::VERSION};
+    }
 
 ### ############# DDumper () ##################################################
 
@@ -45,7 +55,8 @@
 	    [ reverse sort                           keys %$r ];
 	    },
     );
-my $_sortkeys = 1;
+my  $_sortkeys = 1;
+our $_perltidy = 0;
 
 sub DDsort
 {
@@ -61,6 +72,11 @@
     foreach my $p (@exp) {
 	exists $sk{$p} and DDsort ($p), next;
 
+	if ($p eq ":tidy") {
+	    $_perltidy = $has_perltidy;
+	    next;
+	    }
+
 	push @etl, $p;
 	}
     __PACKAGE__->export_to_level (1, @etl);
@@ -68,6 +84,8 @@
 
 sub DDumper
 {
+    $_perltidy and goto \&DTidy;
+
     local $Data::Dumper::Sortkeys  = $_sortkeys;
     local $Data::Dumper::Indent    = 1;
     local $Data::Dumper::Quotekeys = 0;
@@ -76,7 +94,7 @@
     local $Data::Dumper::Useqq     = 0;	# I want unicode visible
 
     my $s = Data::Dumper::Dumper @_;
-    $s =~ s/^(\s*)(.*?)\s*=>/sprintf "%s%-16s =>", $1, $2/gme;	# Align =>
+    $s =~ s/^(\s*)(.*?)\s*=>/sprintf "%s%-16s =>", $1, $2/gme;  # Align =>
     $s =~ s/\bbless\s*\(\s*/bless (/gm and $s =~ s/\s+\)([;,])$/)$1/gm;
     $s =~ s/^(?= *[]}](?:[;,]|$))/  /gm;
     $s =~ s/^(\s*[{[]) *\n *(?=\S)(?![{[])/$1   /gm;
@@ -86,14 +104,26 @@
     return $s;
     } # DDumper
 
+sub DTidy
+{
+    $has_perltidy or goto \&DDumper;
+
+    local $Data::Dumper::Sortkeys  = $_sortkeys;
+    local $Data::Dumper::Indent    = 1;
+    local $Data::Dumper::Quotekeys = 1;
+    local $Data::Dumper::Deparse   = 1;
+    local $Data::Dumper::Terse     = 1;
+    local $Data::Dumper::Useqq     = 0;
+
+    my $s = Data::Dumper::Dumper @_;
+    Perl::Tidy::perltidy (source => \$s, destination => \my $t);
+    $s = $t;
+
+    defined wantarray or warn $s;
+    return $s;
+    } # DTidy
+
 ### ############# DDump () ####################################################
-
-our $has_perlio;
-
-BEGIN {
-    use Config;
-    $has_perlio = ($Config{useperlio} || "undef") eq "define";
-    }
 
 sub _DDump_ref
 {
@@ -206,6 +236,7 @@
  use Data::Peek;
 
  print DDumper \%hash;    # Same syntax as Data::Dumper
+ DTidy { ref => $ref };
 
  print DPeek \$var;
  my ($pv, $iv, $nv, $rv, $magic) = DDual ($var [, 1]);
@@ -225,9 +256,12 @@
  close $fh;
  print $dump;
 
- use Data::Peek qw( DGrow triplevar );
+ # Imports
+ use Data::Peek qw( :tidy VNR DGrow triplevar );
  my $x = ""; DGrow ($x, 10000);
  my $tv = triplevar ("\N{GREEK SMALL LETTER PI}", 3, "3.1415");
+ DDsort ("R");
+ DDumper [ $x ]; # use of :tidy make DDumper behave as DTidy
 
 =head1 DESCRIPTION
 
@@ -246,7 +280,9 @@
     $Data::Dumper::Sortkeys = 1;
     $Data::Dumper::Indent   = 1;
 
-And the result is further beautified to meet my needs:
+If C<Data::Peek> is C<use>d with import argument C<:tidy>, the result is
+formatted according to L<Perl::Tidy>, see L<DTidy> below, otherwise the
+result is further beautified to meet my needs:
 
   * quotation of hash keys has been removed (with the disadvantage
     that the output might not be parseable again).
@@ -257,7 +293,8 @@
 
 Example
 
-  print DDumper { ape => 1, foo => "egg", bar => [ 2, "baz", undef ]};
+  $ perl -MDP \
+    -e'DDumper { ape => 1, foo => "egg", bar => [ 2, "baz", undef ]};'
 
   {   ape              => 1,
       bar              => [
@@ -268,6 +305,26 @@
       foo              => 'egg'
       };
 
+=head2 DTidy ($var, ...)
+
+C<DTidy> is an alternative to C<DDumper>, where the output of C<DDumper>
+is formatted using C<Perl::Tidy> (if available) according to your
+C<.perltidyrc> instead of the default behavior, maybe somewhat like (YMMV):
+
+  $ perl -MDP=:tidy \
+    -we'DDumper { ape => 1, foo => "egg", bar => [ 2, "baz", undef ]};'
+  {   'ape' => 1,
+      'bar' => [2, 'baz', undef],
+      'foo' => 'egg'
+      }
+
+If C<Data::Peek> is C<use>d with import argument C<:tidy>, this is the
+default output method for C<DDumper>.
+
+If L<Perl::Tidy> is not available, C<DTidy> will fallback to C<DDumper>.
+
+This idea was shamelessly copied from John McNamara's L<Data::Dumper::Perltidy>.
+
 =head2 DDsort ( 0 | 1 | R | V | VR | VN | VNR )
 
 Set the hash sort algorithm for DDumper. The default is to sort by key value.
@@ -282,13 +339,15 @@
 
 These can also be passed to import:
 
-  $ perl -MDP=VNR -we'DDumper { foo => 1, bar => 2, zap => 3, gum => 13 }'
+  $ perl -MDP=VNR \
+    -we'DDumper { foo => 1, bar => 2, zap => 3, gum => 13 }'
   {   gum              => 13,
       zap              => 3,
       bar              => 2,
       foo              => 1
       };
-  $ perl -MDP=V   -we'DDumper { foo => 1, bar => 2, zap => 3, gum => 13 }'
+  $ perl -MDP=V \
+    -we'DDumper { foo => 1, bar => 2, zap => 3, gum => 13 }'
   {   foo              => 1,
       gum              => 13,
       bar              => 2,
@@ -370,7 +429,7 @@
       "  RV: ", DPeek ($d[3]), "\n";
     }
   
-=head2 my $LEN = DGrow ($pv, $size)
+=head2 my $len = DGrow ($pv, $size)
 
 Fastest way to preallocate space for a PV scalar. Returns the allocated
 length. If $size is smaller than the already allocated space, it will
@@ -388,7 +447,7 @@
  grow 1622943/s 2512%  967%    --
 
 
-=head2 triplevar ($pv, $iv, $nv)
+=head2 my $tp = triplevar ($pv, $iv, $nv)
 
 When making C<DDual ()> I wondered if it were possible to create triple-val
 scalar variables. L<Scalar::Util> already gives us C<dualvar ()>, that creates
@@ -607,7 +666,7 @@
 =head1 SEE ALSO
 
 L<Devel::Peek>, L<Data::Dumper>, L<Data::Dump>, L<Devel::Dumpvar>,
-L<Data::Dump::Streamer>
+L<Data::Dump::Streamer>, L<Data::Dumper::Perltidy>, L<Perl::Tidy>.
 
 =head1 AUTHOR
 
@@ -615,7 +674,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2008-2010 H.Merijn Brand
+Copyright (C) 2008-2011 H.Merijn Brand
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.

Modified: trunk/libdata-peek-perl/Peek.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/Peek.xs?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/Peek.xs (original)
+++ trunk/libdata-peek-perl/Peek.xs Sat Feb 19 03:48:49 2011
@@ -1,4 +1,4 @@
-/*  Copyright (c) 2008-2010 H.Merijn Brand.  All rights reserved.
+/*  Copyright (c) 2008-2011 H.Merijn Brand.  All rights reserved.
  *  This program is free software; you can redistribute it and/or
  *  modify it under the same terms as Perl itself.
  */

Modified: trunk/libdata-peek-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/README?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/README (original)
+++ trunk/libdata-peek-perl/README Sat Feb 19 03:48:49 2011
@@ -56,7 +56,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (c) 2008-2010 H.Merijn Brand.  All rights reserved.
+Copyright (c) 2008-2011 H.Merijn Brand.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.

Modified: trunk/libdata-peek-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/debian/changelog?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/debian/changelog (original)
+++ trunk/libdata-peek-perl/debian/changelog Sat Feb 19 03:48:49 2011
@@ -1,3 +1,12 @@
+libdata-peek-perl (0.33-1) UNRELEASED; urgency=low
+
+  Updates copyright information only
+  IGNORE-VERSION: 0.33-1
+
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Fri, 18 Feb 2011 23:10:53 -0500
+
 libdata-peek-perl (0.32-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/libdata-peek-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-peek-perl/debian/copyright?rev=69059&op=diff
==============================================================================
--- trunk/libdata-peek-perl/debian/copyright (original)
+++ trunk/libdata-peek-perl/debian/copyright Sat Feb 19 03:48:49 2011
@@ -4,7 +4,7 @@
 Name: Data-Peek
 
 Files: *
-Copyright: 2008-2010, H.Merijn Brand <h.m.brand at xs4all.nl>
+Copyright: 2008-2011, H.Merijn Brand <h.m.brand at xs4all.nl>
 License: Artistic or GPL-1+
 
 Files: ppport.h
@@ -14,7 +14,7 @@
 License: Artistic or GPL-1+
 
 Files: debian/*
-Copyright: 2009-2010, Jonathan Yu <jawnsy at cpan.org>
+Copyright: 2009-2011, Jonathan Yu <jawnsy at cpan.org>
  2009, Jeremiah C. Foster <jeremiah at jeremiahfoster.com>
 License: Artistic or GPL-1+
 




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