CleanCode Perl Libraries
Multi-Lingual Library Maintainability
available: Perl not available: Java not available: JavaScript available: Certified
Class
not available: Testable
Class
not available: Standalone
Mode
not available: Diagnostic
Enabled


NAME

Data::DumperAbbrev - Data dumper for tables and simple values.


SYNOPSIS

        use Data::DumperAbbrev;
        $dumper = Data::DumperAbbrev->new();
        # concise output
        print $dumper->dump($arrayRef)
        print $dumper->dump($hashRef)
        print $dumper->dump($string)

REQUIRES

Perl5.005, Data::Dumper, Data::Handy


DESCRIPTION

This Data::DumperAbbrev class uses standard Data::Dumper but provides a specialized method to dump abbreviated data structures. It goes beyond the terse option of Data::Dumper by limiting array and hash dumps to a certain number of elements.


CLASS VARIABLES

VERSION

Current version of this class.


CONSTRUCTOR

new

PACKAGE->new(abbreviate)

Creates a Dumper object.

Parameters:

abbreviate - optional; boolean indicating to abbreviate lists or not

Returns:

a newly created object


METHODS

Quick Index: dump, setAbbreviate

setAbbreviate

OBJ->setAbbreviate(abbreviateState)

Sets the boolean abbreviate property of the Dumper object.

Parameters:

abbreviateState - boolean indicating to abbreviate tables and hashes

dump

OBJ->dump(item)

Returns simply formatted copy of the item, possibly abbreviated.

ItemReturns...
UndefinedUNDEF_NAME property (default "(null)")
Empty stringEMPTY_NAME property (default "--")
Stringstring unchanged
Array referenceComma-separated list of array elements.
Hash referenceComma-separated list of hash elements, enclosed i n braces.

If the dumper object has the abbreviate property true, then, for array and hash references, just the first 3 elements in the structure are used.

Parameters:

item - any scalar object

Returns:

simply formatted copy of the item.


BUGS

None


AUTHOR

Michael Sorens


VERSION

$Revision: 8 $ $Date: 2006-12-19 21:13:43 -0800 (Tue, 19 Dec 2006) $


SINCE

CleanCode 0.9


SEE ALSO

Data::Dumper


CleanCode Perl Libraries Copyright © 2001-2008 Michael Sorens - Revised 2008.07.31