| Devel-PerlySense documentation | Contained in the Devel-PerlySense distribution. |
Devel::PerlySense::Editor::Emacs - Integration with Emacs
Return stringification of $rhData suited for the Editor.
Return stringification of $item suited for the Editor. $item can be a scalar, array ref or hash ref.
Johan Lindström, <johanl[ÄT]DarSerMan.com>
Please report any bugs or feature requests to
bug-devel-perlysense@rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
Copyright 2005 Johan Lindström, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Devel-PerlySense documentation | Contained in the Devel-PerlySense distribution. |
use strict; use warnings; package Devel::PerlySense::Editor::Emacs; use base "Devel::PerlySense::Editor"; our $VERSION = '0.01'; use Spiffy -Base; use Data::Dumper; use File::Basename; use Graph::Easy; use Text::Table; use List::Util qw/ max first /; use POSIX qw/ ceil /; use Path::Class; use Devel::PerlySense; use Devel::PerlySense::Class; use Devel::PerlySense::Util; use Devel::PerlySense::Util::Log; use Devel::PerlySense::Document::Api::Method;
sub formatOutputDataStructure { my ($rhData) = Devel::PerlySense::Util::aNamedArg(["rhData"], @_); # return q|'(("class-overview" . "Hej baberiba\n [ Class::Accessor ]") ("class-name" . "Class::Accessor") ("message" . "Whatever2"))|; my $keysValues = $self->formatOutputItem($rhData); return qq|'$keysValues|; }
sub formatOutputItem { my ($value) = @_; my $output = ""; if(ref($value) eq "ARRAY") { $output = "(" . join(" ", map { $self->formatOutputItem($_) } @$value) . ")" } elsif(ref($value) eq "HASH") { $output = "(" . join(" ", map { my $key = $_; my $item_value = $value->{$_}; $item_value = $self->formatOutputItem($item_value); $key = $self->renameIdentifier($key); $key = $self->escapeValue($key); qq|("$key" . $item_value)|; } sort keys %$value) . ")"; } else { $output = $self->escapeValue($value); $output = qq|"$output"|; } return $output; } ###TODO: escape " and \ and fix newlines sub escapeValue { my ($value) = (@_); $value =~ s| ([\\"]) |\\$1|gsmx; return $value; } 1; __END__