r66175 - in /branches/upstream/libdata-peek-perl/current: ChangeLog MANIFEST META.yml Makefile.PL Peek.pm README t/22_DHexDump.t t/52_DGrow.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Fri Dec 24 05:50:55 UTC 2010


Author: jawnsy-guest
Date: Fri Dec 24 05:50:42 2010
New Revision: 66175

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66175
Log:
[svn-upgrade] new version libdata-peek-perl (0.32)

Added:
    branches/upstream/libdata-peek-perl/current/t/22_DHexDump.t
Modified:
    branches/upstream/libdata-peek-perl/current/ChangeLog
    branches/upstream/libdata-peek-perl/current/MANIFEST
    branches/upstream/libdata-peek-perl/current/META.yml
    branches/upstream/libdata-peek-perl/current/Makefile.PL
    branches/upstream/libdata-peek-perl/current/Peek.pm
    branches/upstream/libdata-peek-perl/current/README
    branches/upstream/libdata-peek-perl/current/t/52_DGrow.t

Modified: branches/upstream/libdata-peek-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/ChangeLog?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/ChangeLog (original)
+++ branches/upstream/libdata-peek-perl/current/ChangeLog Fri Dec 24 05:50:42 2010
@@ -1,3 +1,10 @@
+2010-11-21 0.32 - H.Merijn Brand   <h.m.brand at xs4all.nl>
+
+    * Require perl 5.8.0
+    * DGrow tests for bigger gap
+    * Spell checking
+    * Add DHexDump ()
+
 2010-03-16 0.31 - H.Merijn Brand   <h.m.brand at xs4all.nl>
 
     * Dropped YAML spec to 1.0

Modified: branches/upstream/libdata-peek-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/MANIFEST?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/MANIFEST (original)
+++ branches/upstream/libdata-peek-perl/current/MANIFEST Fri Dec 24 05:50:42 2010
@@ -11,6 +11,7 @@
 t/10_DDumper.t		Tests for DDumper ()
 t/20_DPeek.t		Tests for DPeek ()
 t/21_DDisplay.t		Tests for DDisplay ()
+t/22_DHexDump.t		Tests for DHexDump ()
 t/30_DDump-s.t		Tests for DDump () returning string using _XS
 t/31_DDump-s.t		Tests for DDump () returning string using _IO
 t/40_DDump-h.t		Tests for DDump () returning hash   using _XS

Modified: branches/upstream/libdata-peek-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/META.yml?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/META.yml (original)
+++ branches/upstream/libdata-peek-perl/current/META.yml Fri Dec 24 05:50:42 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                    Data::Peek
-version:                 0.31
+version:                 0.32
 abstract:                Modified and extended debugging facilities
 license:                 perl
 author:              
@@ -10,16 +10,16 @@
 provides:
     Data::Peek:
         file:            Peek.pm
-        version:         0.31
+        version:         0.32
 requires:     
-    perl:                5.006
+    perl:                5.008
     DynaLoader:          0
 recommends:
-    perl:                5.010001
+    perl:                5.012002
 configure_requires:
     ExtUtils::MakeMaker: 0
 build_requires:
-    perl:                5.006
+    perl:                5.008
     Data::Dumper:        0
     Test::Harness:       0
     Test::More:          0

Modified: branches/upstream/libdata-peek-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/Makefile.PL?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/Makefile.PL (original)
+++ branches/upstream/libdata-peek-perl/current/Makefile.PL Fri Dec 24 05:50:42 2010
@@ -2,7 +2,7 @@
 
 # Copyright PROCURA B.V. (c) 2008-2010 H.Merijn Brand
 
-require 5.006; # <- also see postamble at the bottom for META.yml
+require 5.008; # <- also see postamble at the bottom for META.yml
 use strict;
 
 use ExtUtils::MakeMaker;
@@ -91,7 +91,10 @@
 	'leaktest:',
 	q{	sandbox/leaktest $(FULLPERLRUN) "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)},
 	'',
-	'checkmeta:',
+	'spellcheck:',
+	'	pod-spell-check --aspell',
+	'',
+	'checkmeta:	spellcheck',
 	'	perl sandbox/genMETA.pl -c',
 	'',
 	'fixmeta:	distmeta',

Modified: branches/upstream/libdata-peek-perl/current/Peek.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/Peek.pm?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/Peek.pm (original)
+++ branches/upstream/libdata-peek-perl/current/Peek.pm Fri Dec 24 05:50:42 2010
@@ -6,11 +6,11 @@
 use DynaLoader ();
 
 use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK );
-$VERSION   = "0.31";
+$VERSION   = "0.32";
 @ISA       = qw( DynaLoader Exporter );
- at EXPORT    = qw( DDumper DDsort DPeek DDisplay DDump DDual DGrow );
+ at EXPORT    = qw( DDumper DDsort DPeek DDisplay DDump DHexDump DDual DGrow );
 @EXPORT_OK = qw( triplevar );
-$] >= 5.007003 and push @EXPORT, "DDump_IO";
+push @EXPORT, "DDump_IO";
 
 bootstrap Data::Peek $VERSION;
 
@@ -166,6 +166,33 @@
     warn $dump;
     } # DDump
 
+sub DHexDump
+{
+    use bytes;
+    my $off = 0;
+    my @out;
+    my $var = @_ ? $_[0] : $_;
+    defined $var or return;
+    my $str = "$var";	# force stringification
+    for (unpack "(A32)*", unpack "H*", $str) {
+	my @b = unpack "(A2)*", $_;
+	my $out = sprintf "%04x ", $off;
+	$out .= " ".($b[$_]||"  ") for 0 ..  7;
+	$out .= " ";
+	$out .= " ".($b[$_]||"  ") for 8 .. 15;
+	$out .= "  ";
+	$out .= ($_ < 0x20 || $_ >= 0x7f ? "." : chr $_) for map { hex $_ } @b;
+	push @out, $out."\n";
+	$off += 16;
+	}
+
+    wantarray and return @out;
+
+    defined wantarray and return join "", @out;
+
+    warn join "", @out;
+    } # DHexDump
+
 "Indent";
 
 __END__
@@ -184,6 +211,7 @@
  my ($pv, $iv, $nv, $rv, $magic) = DDual ($var [, 1]);
  print DPeek for DDual ($!, 1);
  print DDisplay ("ab\nc\x{20ac}\rdef\n");
+ print DHexDump ("ab\nc\x{20ac}\rdef\n");
 
  my $dump = DDump $var;
  my %hash = DDump \@list;
@@ -298,6 +326,24 @@
 
   "abc\nde\x{20ac}fg"
 
+=head2 DHexDump
+
+=head2 DHexDump ($var)
+
+Show the (stringified) content of a scalar as a hex-dump.  If C<$var>
+is omitted, C<$_> is dumped. Returns C<undef> or an empty list if
+C<$var> (or C<$_>) is undefined.
+
+In void context, the dump is done to STDERR. In scalar context, the
+complete dump is returned as a single string. In list context, the dump
+is returned as lines.
+
+Example
+
+  print DHexDump "abc\x{0a}de\x{20ac}fg";
+
+  0000  61 62 63 0a 64 65 e2 82  ac 66 67                 abc.de...fg
+
 =head2 my ($pv, $iv, $nv, $rv, $hm) = DDual ($var [, $getmagic])
 
 DDual will return the basic elements in a variable, guaranteeing that no
@@ -367,7 +413,7 @@
 
 A very useful module when debugging is C<Devel::Peek>, but is has one big
 disadvantage: it only prints to STDERR, which is not very handy when your
-code wants to inspect variables al a low level.
+code wants to inspect variables at a low level.
 
 Perl itself has C<sv_dump ()>, which does something similar, but still
 prints to STDERR, and only one level deep.
@@ -470,8 +516,7 @@
 =head2 DDump_IO ($io, $var [, $dig_level])
 
 A wrapper function around perl's internal C<Perl_do_sv_dump ()>, which
-makes C<Devel::Peek> completely superfluous. As PerlIO is only available
-perl version 5.7.3 and up, this function is not available in older perls.
+makes C<Devel::Peek> completely superfluous.
 
 Example
 
@@ -561,8 +606,8 @@
 
 =head1 SEE ALSO
 
-L<Devel::Peek(3)>, L<Data::Dumper(3)>, L<Data::Dump(3)>, L<Devel::Dumpvar>,
-L<Data::Dump::Streamer(3)>
+L<Devel::Peek>, L<Data::Dumper>, L<Data::Dump>, L<Devel::Dumpvar>,
+L<Data::Dump::Streamer>
 
 =head1 AUTHOR
 

Modified: branches/upstream/libdata-peek-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/README?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/README (original)
+++ branches/upstream/libdata-peek-perl/current/README Fri Dec 24 05:50:42 2010
@@ -18,12 +18,11 @@
 DPeek () is a wrapper around internals Perl_sv_peek
 
 DDump_IO () is a wrapper around perl's core function do_sv_dump (),
-which acts like sv_dump (), but to a PerlIO stream, which is only
-available in perl 5.8 and higher.
+which acts like sv_dump (), but to a PerlIO stream.
 
 =head1 PREREQUISITES
 
-Perl 5.6.0 and up.
+Perl 5.8.0 and up.
 Some versions of perl on some operating system(s) might not have
 exported the internals (yet). This module won't build then.
 

Added: branches/upstream/libdata-peek-perl/current/t/22_DHexDump.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/t/22_DHexDump.t?rev=66175&op=file
==============================================================================
--- branches/upstream/libdata-peek-perl/current/t/22_DHexDump.t (added)
+++ branches/upstream/libdata-peek-perl/current/t/22_DHexDump.t Fri Dec 24 05:50:42 2010
@@ -1,0 +1,45 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+#use Test::NoWarnings;
+
+use Data::Peek;
+
+is (DHexDump (undef),		undef,			'undef');
+is (DHexDump (""),		"",			'""');
+
+for (split m/##\n/ => test_data ()) {
+    my ($desc, $in, $out) = split m/\n-\n/, $_, 3;
+
+    is (scalar DHexDump ($in), $out,	"HexDump $desc");
+    }
+
+done_testing;
+
+sub test_data
+{
+    return <<"EOTD";
+Single 0
+-
+0
+-
+0000  30                                                0
+##
+Documentation example
+-
+abc\x{0a}de\x{20ac}fg
+-
+0000  61 62 63 0a 64 65 e2 82  ac 66 67                 abc.de...fg
+##
+Binary data
+-
+\x01Great wide open space\x02\x{20ac}\n
+-
+0000  01 47 72 65 61 74 20 77  69 64 65 20 6f 70 65 6e  .Great wide open
+0010  20 73 70 61 63 65 02 e2  82 ac 0a                  space.....
+##
+EOTD
+    } # test_data

Modified: branches/upstream/libdata-peek-perl/current/t/52_DGrow.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-peek-perl/current/t/52_DGrow.t?rev=66175&op=diff
==============================================================================
--- branches/upstream/libdata-peek-perl/current/t/52_DGrow.t (original)
+++ branches/upstream/libdata-peek-perl/current/t/52_DGrow.t Fri Dec 24 05:50:42 2010
@@ -12,19 +12,22 @@
 is (length ($x), 0,		"Initial length = 0");
 my %dd = DDump $x;
 ok ($dd{LEN} <= 16);
-ok (my $l = DGrow ($x, 10000),	"Set to 10000");
+my $len = 10240;
+ok (my $l = DGrow ($x, $len),	"Set to $len");
 is (length ($x), 0,		"Variable content");
-ok ($l >= 10000,		"returned LEN >= 10000");
-ok ($l <= 10240,		"returned LEN <= 10240");
+ok ($l >= $len,			"returned LEN >= $len");
+my $limit = 4 * $len;
+ok ($l <= $limit,		"returned LEN <= $limit");
    %dd = DDump $x;
-ok ($dd{LEN} >= 10000,		"LEN in variable >= 10000");
-ok ($dd{LEN} <= 10240,		"LEN in variable <= 10240");
-ok ($l = DGrow (\$x, 20000),	"Set to 20000");
-ok ($l >= 20000,		"LEN in variable >= 20000");
-ok ($l <= 20480,		"LEN in variable <= 20480");
+ok ($dd{LEN} >= $len,		"LEN in variable >= $len");
+ok ($dd{LEN} <= $limit,		"LEN in variable <= limit");
+ok ($l = DGrow (\$x, $limit),	"Set to $limit");
+ok ($l >= $limit,		"LEN in variable >= $limit");
+($len, $limit) = ($limit, 4 * $limit);
+ok ($l <= $limit,		"LEN in variable <= $limit");
    %dd = DDump $x;
-ok ($dd{LEN} >= 20000,		"LEN in variable >= 20000");
-ok ($dd{LEN} <= 20480,		"LEN in variable <= 20480");
+ok ($dd{LEN} >= $len,		"LEN in variable >= $len");
+ok ($dd{LEN} <= $limit,		"LEN in variable <= $limit");
 is (DGrow ($x, 20), $l,		"Don't shrink");
 
 1;




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