NAME

GT::Dumper - Convert Perl data structures into a string.


SYNOPSIS

    use GT::Dumper;
    print Dumper($complex_var);
    print GT::Dumper->dump ( var => '$MYVAR', data => $complex_var);


DESCRIPTION

GT::Dumper by default exports a method Dumper() which will behave similar to Data::Dumper's Dumper(). It differs in that it will only take a single argument, and the variable dumped will be $VAR instead of $VAR1. Also, to provide easier control to change the variable name that gets dumped, you can use:

    GT::Dumper->dump ( var => string, data => yourdata );

and the dump will start with string = instead of $VAR = .


EXAMPLE

    use GT::Dumper;
    my %foo;
    my @bar = (1, 2, 3);
    $foo{alpha} = \@bar;
    $foo{beta} = 'a string';
    print Dumper(\%foo);

This will print:

    $VAR = {
        'beta' => 'a string',
        'alpha' => [
            '1',
            '2',
            '3',
        ],
    };


METHODS/FUNCTIONS

Dumper

Dumper() is exported by default when using GT::Dumper. It takes a single variable and returns a string representation of the variable. The string can then be eval()'ed back into the same data structure.

It takes only one argument - the variable to dump. The return is a string of the form:

$VAR = DATA

where 'DATA' is the actual data structure of the variable. A more powerful and customizable dumping method is the dump method.

dump

dump() provides a more customizable method to dumping a data structure. Through the various options available, listed below, the output of a data structure dump can be formatted in several different ways.

The options are as follows. Only the data option is required.

dump_structure

This is a quick method to do a structure dump. It takes one argument - the data to dump. Calling: $class->dump_structure($DATA); is identical to calling: $class->dump(data => $DATA, structure => 1); See the structure option.


SEE ALSO

the Data::Dumper manpage


MAINTAINER

Jason Rhinelander


COPYRIGHT

Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved. http://www.gossamer-threads.com/


VERSION

Revision: $Id: Dumper.pm,v 1.38 2005/02/18 04:44:33 jagerman Exp $