GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Data::Dumper::Perltidy(3) User Contributed Perl Documentation Data::Dumper::Perltidy(3)

Data::Dumper::Perltidy - Stringify and pretty print Perl data structures.

Use the "Data::Dumper::Perltidy::Dumper()" function to stringify and pretty print a Perl data structure:

    use Data::Dumper::Perltidy;

    ...

    print Dumper $some_data_structure;

"Data::Dumper::Perltidy" encapsulates both "Data::Dumper" and "Perl::Tidy" to provide a function that stringifies a Perl data structure in a pretty printed format. See the documentation for Data::Dumper and Perl::Tidy for further information.

Data::Dumper can be used for, among other things, stringifying complex Perl data structures into a format that is suitable for printing and debugging.

Perl::Tidy can be used to pretty print Perl code in a consistent and configurable manner.

Data::Dumper also provides a certain level of pretty printing via the $Data::Dumper::Indent variable but it isn't quite as nice as the Perl::Tidy output.

Let's look at an example to see how this module can be used. Say you have a complex data structure that you wish to inspect. You can use the "Data::Dumper::Perltidy::Dumper()" function as follows (note that the syntax is the same as Data::Dumper):

    #!/usr/bin/perl -w

    use strict;
    use Data::Dumper::Perltidy;

    my $data = [{ title => 'This is a test header' },{ data_range =>
               [ 0, 0, 3, 9 ] },{ format     => 'bold' }];

    print Dumper $data;

This would print out:

    $VAR1 = [
        { 'title'      => 'This is a test header' },
        { 'data_range' => [ 0, 0, 3, 9 ] },
        { 'format'     => 'bold' }
    ];

By comparison the standard "Data::Dumper::Dumper()" output would be:

    $VAR1 = [
              {
                'title' => 'This is a test header'
              },
              {
                'data_range' => [
                                  0,
                                  0,
                                  3,
                                  9
                                ]
              },
              {
                'format' => 'bold'
              }
            ];

Which isn't too bad but if you are used to Perl::Tidy and the perltidy utility you may prefer the "Data::Dumper::Perltidy::Dumper()" output.

The only function exported by Data::Dumper::Perltidy is "Dumper()" and it is exported automatically.

The "Dumper()" function takes a list of perl structures and returns a stringified and pretty printed form of the values in the list. The values will be named $VARn in the output, where "n" is a numeric suffix.

The Data::Dumper $Data::Dumper:: configuration variable can be used to influence the output where applicable. For further information see the Data::Dumper documentation.

Note: unlike "Data::Dumper::Dumper()" this function doesn't currently return a list of strings in a list context.

I frequently found myself copying the output of "Data::Dumper::Dumper()" into an editor so that I could run "perltidy" on it. This module scratches that itch.

This module doesn't attempt to implement all, or even most, of the functionality of "Data::Dumper". In addition, and possibly more regrettably, it doesn't give access to the huge array of configuration options within "Perl::Tidy".

Patches, with tests and documentation, are welcome.

I may also add an option to use Data::Dumper::Names if available.

John McNamara "jmcnamara@cpan.org"

Please report any bugs or feature requests to "bug-data-dumper-perltidy at rt.cpan.org" or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Dumper-Perltidy>.

The author/maintainer will be notified, and you'll be automatically notified in turn of progress on your bug.

Patches should be accompanied by tests and documentation. It isn't fair to do the fun part and leave the less-fun part to someone else. ;-)

You can find documentation for this module with the perldoc command.

    perldoc Data::Dumper::Perltidy

You can also look for further information at:

  • RT: CPAN's request tracker

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Dumper-Perltidy>

  • CPAN Ratings

    <http://cpanratings.perl.org/d/Data-Dumper-Perltidy>

  • Search CPAN

    <http://search.cpan.org/dist/Data-Dumper-Perltidy/>

You can even email the author if you wish.

The authors and maintainers of Data::Dumper and Perl::Tidy.

The structure of this module was created using Module::Starter.

Copyright 2009 John McNamara, all rights reserved.

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

2009-01-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.