/usr/share/doc/libdata-treedumper-perl/examples/usage.pl is in libdata-treedumper-perl 0.40-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | #! /usr/bin/perl
use strict ;
use warnings ;
use Carp ;
use Data::TreeDumper ;
use Data::TreeDumper::OO ;
use Data::Dumper ;
my $sub = sub {} ;
my %tree =
(
A =>
{
a =>
{
}
, bbbbbb => $sub
, c123 => $sub
, d => \$sub
}
, C => {
b =>
{
a =>
{
a =>
{
}
, b => sub
{
}
, c => 42
}
}
}
, ARRAY => [qw(elment_1 element_2 element_3)]
) ;
my $s = \%tree ;
print Dumper($s) ;
#-------------------------------------------------------------------
# package global setup data
#-------------------------------------------------------------------
$Data::TreeDumper::Useascii = 0 ;
$Data::TreeDumper::Maxdepth = 2 ;
$Data::TreeDumper::Virtualwidth = 80 ;
print Data::TreeDumper::DumpTree($s, "Using package data") ;
print Data::TreeDumper::DumpTree($s, "Using package data with override", MAX_DEPTH => 1, DISPLAY_NUMBER_OF_ELEMENTS_OVER_MAX_DEPTH => 1) ;
#-------------------------------------------------------------------
# OO interface
#-------------------------------------------------------------------
my $dumper = new Data::TreeDumper::OO() ;
$dumper->UseAnsi(1) ;
$dumper->SetMaxDepth(2) ;
$dumper->SetVirtualWidth(80) ;
print $dumper->Dump($s, "Using OO interface") ;
print DumpTrees
(
[$s, "DumpTrees1", MAX_DEPTH => 1]
, [$s, "DumpTrees2", MAX_DEPTH => 2]
, USE_ASCII => 1
) ;
print $dumper->DumpMany
(
[$s, "DumpMany1", MAX_DEPTH => 1]
, [$s, "DumpMany2", MAX_DEPTH => 2, USE_ASCII => 0]
, USE_ASCII => 1
) ;
#-------------------------------------------------------------------
# Renderers
#-------------------------------------------------------------------
# simple ASCII dump
print DumpTree($s, 'ASCII:', RENDERER => 'ASCII') ;
# DHTML rendering
my $dump = DumpTree($s, 'DHTML:', RENDERER => 'DHTML') ;
$| = 1 ;
print "15 first lines of the DHTML dump:\n" ;
print ((split(/(\n)/, $dump))[0 .. 29]) ;
# un existant rendering
DumpTree($s, 'unexistant!', RENDERER => 'UNEXISTANT') ;
|