++ed by:
MARIOROY

1 PAUSE user

Damian Conway
and 1 contributors

NAME

Data::Dx - Dump data structures with name and point-of-origin

VERSION

This document describes Data::Dx version 0.000006

SYNOPSIS

    use Data::Dx;

    Dx %foo;
    Dx @bar;
    Dx (
        @bar,
        $baz,
    );
    Dx $baz;
    Dx $ref;
    Dx @bar[do{1..2;}];
    Dx 2*3;
    Dx 'a+b';
    Dx 100 * sqrt length $baz;
    Dx $foo{q[;{{{]};

DESCRIPTION

This module provides a simple wrapper around the Data::Dump module.

The Dx keyword data-dumps its arguments, prefaced by a comment line that reports the location from which Dx was invoked.

For example, the code in the SYNOPSIS would produce something like:

    #line 19  demo.pl
    %foo = {
             "foo"    => 1,
             "food"   => 2,
             "fool"   => [1 .. 10],
           }

    #line 20  demo.pl
    @bar = ["b", "a", "r"]


    #line 21  demo.pl
    ( @bar, $baz, ) = ["b", "a", "r", "baz"]


    #line 25  demo.pl
    $baz = "baz"


    #line 26  demo.pl
    $ref = ["b", "a", "r"]


    #line 27  demo.pl
    @bar[do{1..2;}] = ["a", "r"]


    #line 28  demo.pl
    2*3 = 6


    #line 29  demo.pl
    'a+b' = "a+b"


    #line 30  demo.pl
    100 * sqrt length $baz = 173.205080756888


    #line 31  demo.pl
    $foo{q[;{{{]} = undef

If the Term::ANSIColor module is available, the output will also be colour-coded (unless the 'colour' option is specified as false...see below).

INTERFACE

Dx expr

This is the only keyword provided by the module. It is always exported.

Dx can be called with any number of arguments and data-dumps them all. Dx is a keyword, not a function, so it cannot be used as an rvalue and does not return a useful value.

no Data::Dx;

If the module is imported with no instead of use, it still exports the Dx keyword, but as a no-op.

This means that you can leave every Dx in your code but disable them all (or just all of them in a given scope) by changing the original use Data::Dx to no Data::Dx

use Data::Dx { colour => 0 };

If the module is imported with the 'colour' option set false, output is dumped without colouring, even if Term::ANSIColor is available. The option defaults to true.

DIAGNOSTICS

None, apart from those provided by Data::Dump;

CONFIGURATION AND ENVIRONMENT

Data::Dx requires no configuration files or environment variables.

DEPENDENCIES

Requires the Data::Dump and Keyword::Declare modules.

Only works under Perl 5.12 and later (the release in which pluggable keywords were added to Perl).

Does not work under Perl 5.20 (due to problems with regex compilation exposed by the Keyword::Declare module under that release).

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-data-dx@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Damian Conway <DCONWAY@CPAN.org>

LICENCE AND COPYRIGHT

Copyright (c) 2010-2017, Damian Conway <DCONWAY@CPAN.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.