Data-Dumper-GUI
view release on metacpan or search on metacpan
lib/ddGUI/Window.pm view on Meta::CPAN
"=item *\n\nB<< ${\ $attr->name } >>"
. "${\( $attr->has_documentation ? (' - '.$attr->documentation) : '' )}\n\n"
);
if ($attr->has_value($item)) {
$tv->read("${\ Type::Tiny::_dd($attr->get_raw_value($item)) }\n\n");
}
else {
$tv->read("Unset\n\n");
}
}
$tv->read("=back\n\n");
}
sub _build_vars {
my $self = shift;
my $pfx = $Data::Dumper::Varname;
return [
map "\$$pfx$_", 1 .. scalar(@{$self->items})
];
}
sub _prepared_items {
my $self = shift;
$self->_seen({});
my $i = -1;
return [
map { ++$i; $self->_item_to_arrayref($self->vars->[$i], $_, $self->vars->[$i]) } @{ $self->items }
];
}
sub __maybequote {
map {
(/^_*[A-Z][A-Z0-9_]*$/i || /^-_*[A-Z][A-Z0-9_]+$/i)
? $_
: perlstring($_)
} @_
}
sub _item_to_arrayref {
my $self = shift;
my ($label, $item, $path) = @_;
if (!defined($item)) {
return [[ $label, "(undef)", $item, $path ]];
}
if (!ref($item)) {
return [[ $label, perlstring($item), $item, $path ]];
}
if (exists $self->_seen->{ refaddr($item) }) {
my $is = $self->_seen->{ refaddr($item) };
return [[ $label, "= $is", $item, $path ]];
}
$self->_seen->{ refaddr($item) } = $path;
my @internals;
if (reftype($item) eq 'ARRAY') {
my $i = $[-1;
@internals = map { ++$i; $self->_item_to_arrayref("[$i]", $_, "$path\->[$i]") } @$item;
}
if (reftype($item) eq 'HASH') {
@internals = map { $self->_item_to_arrayref("{${\__maybequote($_)}}", $item->{$_}, "$path\->{${\__maybequote($_)}}") } sort keys %$item;
}
if (reftype($item) eq 'SCALAR') {
@internals = $self->_item_to_arrayref("\${...}", $$item, "\${$path}");
}
return [[ $label, '['.ref($item).']', $item, $path ], \@internals, !blessed($item), undef ];
}
1;
__END__
=pod
=encoding utf-8
=head1 NAME
ddGUI::Window - all the Prima stuff for Data::Dumper::GUI
=head1 DESCRIPTION
No user-serviceable parts within.
=head1 BUGS
Please report any bugs to
L<http://rt.cpan.org/Dist/Display.html?Queue=Data-Dumper-GUI>.
=head1 SEE ALSO
L<Data::Dumper::GUI>.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
( run in 2.146 seconds using v1.01-cache-2.11-cpan-5735350b133 )