Steven Haryanto > Data-Dump-Partial > Data::Dump::Partial

Download:
Data-Dump-Partial-0.05.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.05   Source  

NAME ^

Data::Dump::Partial - Dump data structure compactly and potentially partially

VERSION ^

version 0.05

SYNOPSIS ^

 use Data::Dump::Partial qw(dump_partial dumpp);

 dump_partial([1, "some long string", 3, 4, 5, 6, 7]);
 # prints something like: [1, "some long st...", 3, 4, 5, ...]

 # specify options
 dumpp($data, $more_data, {max_total_len => 50, max_keys => 4});

 # mask passwords specified in hash key values
 dumpp({auth_info=>{user=>"steven", password=>"secret"}, foo=>1, bar=>2},
       {mask_keys_regex=>qr/\Apass\z|passw(or)?d/i});
 # prints something like:
 # {auth_info=>{user=>"steven", password=>"***"}, foo=>1, bar=>2}

DESCRIPTION ^

FUNCTIONS ^

dump_partial(..., $opts)

Dump one more data structures compactly and potentially partially. Uses Data::Dump::Filtered as the backend.

By compactly, it means all indents and comments and newlines are removed, so the output all fits in one line.

By partially, it means only up to a certain amount of data are dumped/shown: string longer than a certain length will be truncated (with "..." appended in the end), array more than a certain number of elements will be truncated, and hash containing more than a certain number of pairs will be truncated. The total length of dump is also limited. When truncating hash you can specify which keys to discard/preserve first. You can also mask certain hash key values (for example, to avoid exposing passwords in dumps).

$opts is a hashref, optional only when there is one data to dump, with the following known keys:

dumpp

An alias for dump_filtered().

FAQ ^

What is the point/purpose of this module?

Sometimes you want to dump a data structure, but need it to be short, more than need it to be complete, for example when logging to log files or database.

Is the dump result eval()-able? Will the dump result eval() to produce the original data?

Sometimes it is/will, sometimes it does/will not if it gets truncated.

SEE ALSO ^

Data::Dump::Filtered

HOMEPAGE ^

Please visit the project's homepage at https://metacpan.org/release/Data-Dump-Partial.

SOURCE ^

Source repository is at https://github.com/sharyanto/perl-Data-Dump-Partial.

BUGS ^

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Dump-Partial

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR ^

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: