r59651 - in /trunk/libdata-dump-perl: Changes MANIFEST META.yml Makefile.PL README debian/changelog lib/Data/Dump.pm t/dump.t t/tied.t

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Mon Jun 21 10:08:21 UTC 2010


Author: eloy
Date: Mon Jun 21 10:08:11 2010
New Revision: 59651

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=59651
Log:
new upstream version

Modified:
    trunk/libdata-dump-perl/Changes
    trunk/libdata-dump-perl/MANIFEST
    trunk/libdata-dump-perl/META.yml
    trunk/libdata-dump-perl/Makefile.PL
    trunk/libdata-dump-perl/README
    trunk/libdata-dump-perl/debian/changelog
    trunk/libdata-dump-perl/lib/Data/Dump.pm
    trunk/libdata-dump-perl/t/dump.t
    trunk/libdata-dump-perl/t/tied.t

Modified: trunk/libdata-dump-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/Changes?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/Changes (original)
+++ trunk/libdata-dump-perl/Changes Mon Jun 21 10:08:11 2010
@@ -1,3 +1,41 @@
+2010-06-12  Gisle Aas <gisle at ActiveState.com>
+
+   Release 1.17
+
+   Fix dump of "1\n" (the newline was lost) [RT#56595]
+
+   Start using the range operator to shorten list dumps.
+   For instance dump(1,2,3,4,5) now returns '(1 .. 5)'.
+
+   CODE references now dumped as 'sub { ... }'.
+   Potetential compatibility issue as perl-5.12 or better
+   to eval such strings.
+
+   Fix how multiline hash values are indented.
+
+   Make indentation configurable
+
+   Improved documentation
+
+
+
+2010-06-09  Gisle Aas <gisle at ActiveState.com>
+
+   Release 1.16
+
+   Add support for filter callbacks
+      - filters can modify how selected objects are dumped
+
+   Various enhancements to how/when hash keys are quoted
+      - don't quote keywords
+      - don't quote words prefixed with "-"
+      - don't quote long identifier keys
+      - quote all hash keys if one needs quoting for better alignment
+
+   Use case-insensitive sorting for hash keys
+
+
+
 2009-07-26  Gisle Aas <gisle at ActiveState.com>
 
    Release 1.15

Modified: trunk/libdata-dump-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/MANIFEST?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/MANIFEST (original)
+++ trunk/libdata-dump-perl/MANIFEST Mon Jun 21 10:08:11 2010
@@ -1,13 +1,17 @@
 Changes
 lib/Data/Dump.pm
 lib/Data/Dump/Trace.pm
+lib/Data/Dump/Filtered.pm
+lib/Data/Dump/FilterContext.pm
 Makefile.PL
 MANIFEST
 README
 t/dd.t
 t/dump.t
 t/eval.t
+t/filtered.t
 t/glob.t
+t/hash.t
 t/quote-unicode.t
 t/quote.t
 t/ref.t

Modified: trunk/libdata-dump-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/META.yml?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/META.yml (original)
+++ trunk/libdata-dump-perl/META.yml Mon Jun 21 10:08:11 2010
@@ -1,20 +1,27 @@
 --- #YAML:1.0
 name:               Data-Dump
-version:            1.15
-abstract:           ~
-author:  []
-license:            unknown
+version:            1.17
+abstract:           Pretty printing of data structures
+author:
+    - Gisle Aas <gisle at activestate.com>
+license:            perl
 distribution_type:  module
 configure_requires:
     ExtUtils::MakeMaker:  0
 build_requires:
-    ExtUtils::MakeMaker:  0
-requires:  {}
+    Test:  0
+requires:
+    perl:    5.006
+    Symbol:  0
+resources:
+    repository:  http://github.com/gisle/data-dump
 no_index:
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.55_02
+generated_by:       ExtUtils::MakeMaker version 6.56
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4
+recommends:
+    MIME::Base64:  0

Modified: trunk/libdata-dump-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/Makefile.PL?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/Makefile.PL (original)
+++ trunk/libdata-dump-perl/Makefile.PL Mon Jun 21 10:08:11 2010
@@ -2,6 +2,47 @@
 use ExtUtils::MakeMaker;
 
 WriteMakefile(
-   NAME         => "Data::Dump",
+   NAME => "Data::Dump",
    VERSION_FROM => "lib/Data/Dump.pm",
+   ABSTRACT_FROM => "lib/Data/Dump.pm",
+   AUTHOR => 'Gisle Aas <gisle at activestate.com>',
+   LICENSE => "perl",
+   MIN_PERL_VERSION => 5.006,
+   PREREQ_PM => {
+       Symbol => 0,
+   },
+   META_MERGE => {
+       resources => {
+	   repository => 'http://github.com/gisle/data-dump',
+       },
+       recommends => {
+	   'MIME::Base64' => 0,
+       },
+   },
+   BUILD_REQUIRES => {
+       Test => 0,
+   },
 );
+
+BEGIN {
+    # compatibility with older versions of MakeMaker
+    my $developer = -d "eg";
+    my %mm_req = (
+        LICENCE => 6.31,
+        META_MERGE => 6.45,
+        META_ADD => 6.45,
+        MIN_PERL_VERSION => 6.48,
+        BUILD_REQUIRES => 6.45,
+    );
+    undef(*WriteMakefile);
+    *WriteMakefile = sub {
+        my %arg = @_;
+        for (keys %mm_req) {
+            unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) {
+                warn "$_ $@" if $developer;
+                delete $arg{$_};
+            }
+        }
+        ExtUtils::MakeMaker::WriteMakefile(%arg);
+    };
+}

Modified: trunk/libdata-dump-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/README?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/README (original)
+++ trunk/libdata-dump-perl/README Mon Jun 21 10:08:11 2010
@@ -34,7 +34,7 @@
     The "Data::Dump" module is written by Gisle Aas <gisle at aas.no>, based on
     "Data::Dumper" by Gurusamy Sarathy <gsar at umich.edu>.
 
-     Copyright 1998-2000,2003-2004,2008 Gisle Aas.
+     Copyright 1998-2010 Gisle Aas.
      Copyright 1996-1998 Gurusamy Sarathy.
 
     This library is free software; you can redistribute it and/or modify it

Modified: trunk/libdata-dump-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/debian/changelog?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/debian/changelog (original)
+++ trunk/libdata-dump-perl/debian/changelog Mon Jun 21 10:08:11 2010
@@ -1,3 +1,9 @@
+libdata-dump-perl (1.17-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Krzysztof Krzyżaniak (eloy) <eloy at debian.org>  Mon, 21 Jun 2010 12:07:36 +0200
+
 libdata-dump-perl (1.15-2) UNRELEASED; urgency=low
 
   * Update jawnsy's email address

Modified: trunk/libdata-dump-perl/lib/Data/Dump.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/lib/Data/Dump.pm?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/lib/Data/Dump.pm (original)
+++ trunk/libdata-dump-perl/lib/Data/Dump.pm Mon Jun 21 10:08:11 2010
@@ -7,43 +7,16 @@
 require Exporter;
 *import = \&Exporter::import;
 @EXPORT = qw(dd ddx);
- at EXPORT_OK = qw(dump pp quote);
-
-$VERSION = "1.15";
+ at EXPORT_OK = qw(dump pp dumpf quote);
+
+$VERSION = "1.17";
 $DEBUG = 0;
 
 use overload ();
-use vars qw(%seen %refcnt @dump @fixup %require $TRY_BASE64);
+use vars qw(%seen %refcnt @dump @fixup %require $TRY_BASE64 @FILTERS $INDENT);
 
 $TRY_BASE64 = 50 unless defined $TRY_BASE64;
-
-my %is_perl_keyword = map { $_ => 1 }
-qw( __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD BEGIN CORE
-DESTROY END EQ GE GT INIT LE LT NE abs accept alarm and atan2 bind
-binmode bless caller chdir chmod chomp chop chown chr chroot close
-closedir cmp connect continue cos crypt dbmclose dbmopen defined
-delete die do dump each else elsif endgrent endhostent endnetent
-endprotoent endpwent endservent eof eq eval exec exists exit exp fcntl
-fileno flock for foreach fork format formline ge getc getgrent
-getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin
-getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid
-getpriority getprotobyname getprotobynumber getprotoent getpwent
-getpwnam getpwuid getservbyname getservbyport getservent getsockname
-getsockopt glob gmtime goto grep gt hex if index int ioctl join keys
-kill last lc lcfirst le length link listen local localtime lock log
-lstat lt m map mkdir msgctl msgget msgrcv msgsnd my ne next no not oct
-open opendir or ord pack package pipe pop pos print printf prototype
-push q qq qr quotemeta qw qx rand read readdir readline readlink
-readpipe recv redo ref rename require reset return reverse rewinddir
-rindex rmdir s scalar seek seekdir select semctl semget semop send
-setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent
-setservent setsockopt shift shmctl shmget shmread shmwrite shutdown
-sin sleep socket socketpair sort splice split sprintf sqrt srand stat
-study sub substr symlink syscall sysopen sysread sysseek system
-syswrite tell telldir tie tied time times tr truncate uc ucfirst umask
-undef unless unlink unpack unshift untie until use utime values vec
-wait waitpid wantarray warn while write x xor y);
-
+$INDENT = "  " unless defined $INDENT;
 
 sub dump
 {
@@ -51,6 +24,8 @@
     local %refcnt;
     local %require;
     local @fixup;
+
+    require Data::Dump::FilterContext if @FILTERS;
 
     my $name = "a";
     my @dump;
@@ -92,7 +67,7 @@
 
     if (%refcnt || %require) {
 	$out .= ";\n";
-	$out =~ s/^/  /gm;  # indent
+	$out =~ s/^/$INDENT/gm;
 	$out = "do {\n$out}";
     }
 
@@ -117,13 +92,18 @@
     print $out;
 }
 
+sub dumpf {
+    require Data::Dump::Filtered;
+    goto &Data::Dump::Filtered::dump_filtered;
+}
+
 sub _dump
 {
     my $ref  = ref $_[0];
     my $rval = $ref ? $_[0] : \$_[0];
     shift;
 
-    my($name, $idx, $dont_remember) = @_;
+    my($name, $idx, $dont_remember, $pclass, $pidx) = @_;
 
     my($class, $type, $id);
     if (overload::StrVal($rval) =~ /^(?:([^=]+)=)?([A-Z]+)\(0x([^\)]+)\)$/) {
@@ -137,6 +117,50 @@
 	$type = "REF" if $ref eq "REF";
     }
     warn "\$$name(@$idx) $class $type $id ($ref)" if $DEBUG;
+
+    my $out;
+    my $comment;
+    my $hide_keys;
+    if (@FILTERS) {
+	my $pself = "";
+	$pself = fullname("self", [@$idx[$pidx..(@$idx - 1)]]) if $pclass;
+	my $ctx = Data::Dump::FilterContext->new($rval, $class, $type, $ref, $pclass, $pidx, $idx);
+	my @bless;
+	for my $filter (@FILTERS) {
+	    if (my $f = $filter->($ctx, $rval)) {
+		if (my $v = $f->{object}) {
+		    local @FILTERS;
+		    $out = _dump($v, $name, $idx, 1);
+		    $dont_remember++;
+		}
+		if (defined(my $c = $f->{bless})) {
+		    push(@bless, $c);
+		}
+		if (my $c = $f->{comment}) {
+		    $comment = $c;
+		}
+		if (defined(my $c = $f->{dump})) {
+		    $out = $c;
+		    $dont_remember++;
+		}
+		if (my $h = $f->{hide_keys}) {
+		    if (ref($h) eq "ARRAY") {
+			$hide_keys = sub {
+			    for my $k (@$h) {
+				return 1 if $k eq $_[0];
+			    }
+			    return 0;
+			};
+		    }
+		}
+	    }
+	}
+	push(@bless, "") if defined($out) && !@bless;
+	if (@bless) {
+	    $class = shift(@bless);
+	    warn "More than one filter callback tried to bless object" if @bless;
+	}
+    }
 
     unless ($dont_remember) {
 	if (my $s = $seen{$id}) {
@@ -154,8 +178,15 @@
 	$seen{$id} = [$name, $idx];
     }
 
-    my $out;
-    if ($type eq "SCALAR" || $type eq "REF" || $type eq "REGEXP") {
+    if ($class) {
+	$pclass = $class;
+	$pidx = @$idx;
+    }
+
+    if (defined $out) {
+	# keep it
+    }
+    elsif ($type eq "SCALAR" || $type eq "REF" || $type eq "REGEXP") {
 	if ($ref) {
 	    if ($class && $class eq "Regexp") {
 		my $v = "$rval";
@@ -188,14 +219,14 @@
 	    }
 	    else {
 		delete $seen{$id} if $type eq "SCALAR";  # will be seen again shortly
-		my $val = _dump($$rval, $name, [@$idx, "\$"]);
+		my $val = _dump($$rval, $name, [@$idx, "\$"], 0, $pclass, $pidx);
 		$out = $class ? "do{\\(my \$o = $val)}" : "\\$val";
 	    }
 	} else {
 	    if (!defined $$rval) {
 		$out = "undef";
 	    }
-	    elsif ($$rval =~ /^-?[1-9]\d{0,9}$/ || $$rval eq "0") {
+	    elsif ($$rval =~ /^-?[1-9]\d{0,9}\z/ || $$rval eq "0") {
 		$out = $$rval;
 	    }
 	    else {
@@ -213,7 +244,7 @@
     elsif ($type eq "GLOB") {
 	if ($ref) {
 	    delete $seen{$id};
-	    my $val = _dump($$rval, $name, [@$idx, "*"]);
+	    my $val = _dump($$rval, $name, [@$idx, "*"], 0, $pclass, $pidx);
 	    $out = "\\$val";
 	    if ($out =~ /^\\\*Symbol::/) {
 		$require{Symbol}++;
@@ -229,7 +260,7 @@
 		next if $k eq "SCALAR" && ! defined $$gval;  # always there
 		my $f = scalar @fixup;
 		push(@fixup, "RESERVED");  # overwritten after _dump() below
-		$gval = _dump($gval, $name, [@$idx, "*{$k}"]);
+		$gval = _dump($gval, $name, [@$idx, "*{$k}"], 0, $pclass, $pidx);
 		$refcnt{$name}++;
 		my $gname = fullname($name, $idx);
 		$fixup[$f] = "$gname = $gval";  #XXX indent $gval
@@ -241,7 +272,7 @@
 	my $tied = tied_str(tied(@$rval));
 	my $i = 0;
 	for my $v (@$rval) {
-	    push(@vals, _dump($v, $name, [@$idx, "[$i]"], $tied));
+	    push(@vals, _dump($v, $name, [@$idx, "[$i]"], $tied, $pclass, $pidx));
 	    $i++;
 	}
 	$out = "[" . format_list(1, $tied, @vals) . "]";
@@ -256,31 +287,38 @@
 	my $kstat_sum2 = 0;
 
 	my @orig_keys = keys %$rval;
+	if ($hide_keys) {
+	    @orig_keys = grep !$hide_keys->($_), @orig_keys;
+	}
 	my $text_keys = 0;
 	for (@orig_keys) {
 	    $text_keys++, last unless /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/;
 	}
 
 	if ($text_keys) {
-	    @orig_keys = sort @orig_keys;
+	    @orig_keys = sort { lc($a) cmp lc($b) } @orig_keys;
 	}
 	else {
 	    @orig_keys = sort { $a <=> $b } @orig_keys;
 	}
 
+	my $quote;
 	for my $key (@orig_keys) {
-	    my $val = \$rval->{$key};
-	    $key = quote($key) if $is_perl_keyword{$key} ||
-		                  !($key =~ /^[a-zA-Z_]\w{0,19}\z/ ||
-				    $key =~ /^-?[1-9]\d{0,8}\z/
-				    );
-
+	    next if $key =~ /^-?[a-zA-Z_]\w*\z/;
+	    next if $key =~ /^-?[1-9]\d{0,8}\z/;
+	    $quote++;
+	    last;
+	}
+
+	for my $key (@orig_keys) {
+	    my $val = \$rval->{$key};  # capture value before we modify $key
+	    $key = quote($key) if $quote;
 	    $kstat_max = length($key) if length($key) > $kstat_max;
 	    $kstat_sum += length($key);
 	    $kstat_sum2 += length($key)*length($key);
 
 	    push(@keys, $key);
-	    push(@vals, _dump($$val, $name, [@$idx, "{$key}"], $tied));
+	    push(@vals, _dump($$val, $name, [@$idx, "{$key}"], $tied, $pclass, $pidx));
 	}
 	my $nl = "";
 	my $klen_pad = 0;
@@ -310,20 +348,21 @@
 	    }
 	}
 	$out = "{$nl";
-	$out .= "  # $tied$nl" if $tied;
+	$out .= "$INDENT# $tied$nl" if $tied;
 	while (@keys) {
 	    my $key = shift @keys;
 	    my $val = shift @vals;
-	    my $pad = " " x ($klen_pad + 6);
-	    $val =~ s/\n/\n$pad/gm;
-	    $key = " $key" . " " x ($klen_pad - length($key)) if $nl;
-	    $out .= " $key => $val,$nl";
+	    my $vpad = $INDENT . (" " x ($klen_pad ? $klen_pad + 4 : 0));
+	    $val =~ s/\n/\n$vpad/gm;
+	    my $kpad = $nl ? $INDENT : " ";
+	    $key .= " " x ($klen_pad - length($key)) if $nl;
+	    $out .= "$kpad$key => $val,$nl";
 	}
 	$out =~ s/,$/ / unless $nl;
 	$out .= "}";
     }
     elsif ($type eq "CODE") {
-	$out = 'sub { "???" }';
+	$out = 'sub { ... }';
     }
     else {
 	warn "Can't handle $type data";
@@ -332,6 +371,12 @@
 
     if ($class && $ref) {
 	$out = "bless($out, " . quote($class) . ")";
+    }
+    if ($comment) {
+	$comment =~ s/^/# /gm;
+	$comment .= "\n" unless $comment =~ /\n\z/;
+	$comment =~ s/^#[ \t]+\n/\n/;
+	$out = "$comment$out";
     }
     return $out;
 }
@@ -386,11 +431,39 @@
     my $paren = shift;
     my $comment = shift;
     my $indent_lim = $paren ? 0 : 1;
+    if (@_ > 3) {
+	# can we use range operator to shorten the list?
+	my $i = 0;
+	while ($i < @_) {
+	    my $j = $i + 1;
+	    my $v = $_[$i];
+	    while ($j < @_) {
+		# XXX allow string increment too?
+		if ($v eq "0" || $v =~ /^-?[1-9]\d{0,9}\z/) {
+		    $v++;
+		}
+		elsif ($v =~ /^"([A-Za-z]{1,3}\d*)"\z/) {
+		    $v = $1;
+		    $v++;
+		    $v = qq("$v");
+		}
+		else {
+		    last;
+		}
+		last if $_[$j] ne $v;
+		$j++;
+	    }
+	    if ($j - $i > 3) {
+		splice(@_, $i, $j - $i, "$_[$i] .. $_[$j-1]");
+	    }
+	    $i++;
+	}
+    }
     my $tmp = "@_";
     if ($comment || (@_ > $indent_lim && (length($tmp) > 60 || $tmp =~ /\n/))) {
 	my @elem = @_;
-	for (@elem) { s/^/  /gm; }   # indent
-	return "\n" . ($comment ? "  # $comment\n" : "") .
+	for (@elem) { s/^/$INDENT/gm; }
+	return "\n" . ($comment ? "$INDENT# $comment\n" : "") .
                join(",\n", @elem, "");
     } else {
 	return join(", ", @_);
@@ -479,17 +552,17 @@
 
 =head1 SYNOPSIS
 
- use Data::Dump qw(dump ddx);
+ use Data::Dump qw(dump);
 
  $str = dump(@list);
  @copy_of_list = eval $str;
 
  # or use it for easy debug printout
- ddx localtime;
+ use Data::Dump; dd localtime;
 
 =head1 DESCRIPTION
 
-This module provide functions that takes a list of values as their
+This module provide a few functions that traverse their
 argument and produces a string as its result.  The string contains
 Perl code that, when C<eval>ed, produces a deep copy of the original
 arguments.
@@ -502,7 +575,7 @@
 
 Produces:
 
-    (1, [2, 3], { 4 => 5 })
+    "(1, [2, 3], { 4 => 5 })"
 
 If you dump just a little data, it is output on a single line. If
 you dump data that is more complex or there is a lot of it, line breaks
@@ -548,7 +621,8 @@
 
 It differs from C<dump($string)> in that it will quote even numbers and
 not try to come up with clever expressions that might shorten the
-output.
+output.  If a non-scalar argument is provided then it's just stringified
+instead of traversed.
 
 =item dd( ... )
 
@@ -563,13 +637,43 @@
 number where it was called.  This is meant to be useful for debug
 printouts of state within programs.
 
+=item dumpf( ..., \&filter )
+
+Short hand for calling the dump_filtered() function of L<Data::Dump::Filtered>.
+This works like dump(), but the last argument should be a filter callback
+function.  As objects are visited the filter callback is invoked and it
+can modify how the objects are dumped.
+
 =back
 
+=head1 CONFIGURATION
+
+There are a few global variables that can be set to modify the output
+generated by the dump functions.  It's wise to localize the setting of
+these.
+
+=over
+
+=item $Data::Dump::INDENT
+
+This holds the string that's used for indenting multiline data structures.
+It's default value is "  " (two spaces).  Set it to "" to suppress indentation.
+Setting it to "| " makes for nice visuals even if the dump output then fails to
+be valid Perl.
+
+=item $Data::Dump::TRY_BASE64
+
+How long must a binary string be before we try to use the base64 encoding
+for the dump output.  The default is 50.  Set it to 0 to disable base64 dumps.
+
+=back
+
 
 =head1 LIMITATIONS
 
-Code references will be displayed as simply 'sub { "???" }' when
-dumped. Thus, C<eval>ing them will not reproduce the original routine.
+Code references will be dumped as C<< sub { ... } >>. Thus, C<eval>ing them will
+not reproduce the original routine.  The C<...>-operator used will also require
+perl-5.12 or better to be evaled.
 
 If you forget to explicitly import the C<dump> function, your code will
 core dump. That's because you just called the builtin C<dump> function
@@ -583,23 +687,24 @@
 are shared with Sarathy's module.
 
 The C<Data::Dump> module provides a much simpler interface than
-C<Data::Dumper>.  No OO interface is available and there are no
-configuration options to worry about (yet :-).  The other benefit is
+C<Data::Dumper>.  No OO interface is available and there are fewer
+configuration options to worry about.  The other benefit is
 that the dump produced does not try to set any variables.  It only
 returns what is needed to produce a copy of the arguments.  This means
-that C<dump("foo")> simply returns C<"foo">, and C<dump(1..5)> simply
-returns C<(1, 2, 3, 4, 5)>.
+that C<dump("foo")> simply returns C<'"foo"'>, and C<dump(1..3)> simply
+returns C<'(1, 2, 3)'>.
 
 =head1 SEE ALSO
 
-L<Data::Dumper>, L<Storable>
+L<Data::Dump::Filtered>, L<Data::Dump::Trace>, L<Data::Dumper>, L<JSON>,
+L<Storable>
 
 =head1 AUTHORS
 
 The C<Data::Dump> module is written by Gisle Aas <gisle at aas.no>, based
 on C<Data::Dumper> by Gurusamy Sarathy <gsar at umich.edu>.
 
- Copyright 1998-2000,2003-2004,2008 Gisle Aas.
+ Copyright 1998-2010 Gisle Aas.
  Copyright 1996-1998 Gurusamy Sarathy.
 
 This library is free software; you can redistribute it and/or

Modified: trunk/libdata-dump-perl/t/dump.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/t/dump.t?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/t/dump.t (original)
+++ trunk/libdata-dump-perl/t/dump.t Mon Jun 21 10:08:11 2010
@@ -2,12 +2,13 @@
 
 use strict;
 use Test qw(plan ok);
-plan tests => 23;
+plan tests => 30;
 
 use Data::Dump qw(dump);
 
 ok(dump(), "()");
 ok(dump("abc"), qq("abc"));
+ok(dump("1\n"), qq("1\\n"));
 ok(dump(undef), "undef");
 ok(dump(0), "0");
 ok(dump(1234), "1234");
@@ -16,8 +17,14 @@
 ok(dump(-33), "-33");
 ok(dump(-1.5), "\"-1.5\"");
 ok(dump("0123"), qq("0123"));
-ok(dump(1..5), "(1, 2, 3, 4, 5)");
-ok(dump([1..5]), "[1, 2, 3, 4, 5]");
+ok(dump(1..2), "(1, 2)");
+ok(dump(1..3), "(1, 2, 3)");
+ok(dump(1..4), "(1 .. 4)");
+ok(dump(1..5,6,8,9), "(1 .. 6, 8, 9)");
+ok(dump(1..5,4..8), "(1 .. 5, 4 .. 8)");
+ok(dump([-2..2]), "[-2 .. 2]");
+ok(dump(["a0" .. "z9"]), qq(["a0" .. "z9"]));
+ok(dump(["x", 0, 1, 2, 3, "a", "b", "c", "d"]), qq(["x", 0 .. 3, "a" .. "d"]));
 ok(dump({ a => 1, b => 2 }), "{ a => 1, b => 2 }");
 ok(dump({ 1 => 1, 2 => 1, 10 => 1 }), "{ 1 => 1, 2 => 1, 10 => 1 }");
 ok(dump({ 0.14 => 1, 1.8 => 1, -0.5 => 1 }), qq({ "-0.5" => 1, "0.14" => 1, "1.8" => 1 }));
@@ -53,4 +60,4 @@
 
 # stranger stuff
 ok(dump({ a => \&Data::Dump::dump, aa => do {require Symbol; Symbol::gensym()}}),
-   "do {\n  require Symbol;\n  { a => sub { \"???\" }, aa => Symbol::gensym() };\n}");
+   "do {\n  require Symbol;\n  { a => sub { ... }, aa => Symbol::gensym() };\n}");

Modified: trunk/libdata-dump-perl/t/tied.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-dump-perl/t/tied.t?rev=59651&op=diff
==============================================================================
--- trunk/libdata-dump-perl/t/tied.t (original)
+++ trunk/libdata-dump-perl/t/tied.t Mon Jun 21 10:08:11 2010
@@ -58,10 +58,7 @@
 ok(nl(dump(\@array)), <<EOT);
 [
   # tied MyTie
-  "v0",
-  "v1",
-  "v2",
-  "v3",
+  "v0" .. "v3",
 ]
 EOT
 




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