Devel::PerlySense::Editor::Emacs - Integration with Emacs


Devel-PerlySense documentation Contained in the Devel-PerlySense distribution.

Index


Code Index:

NAME

Top

Devel::PerlySense::Editor::Emacs - Integration with Emacs

DESCRIPTION

Top

PROPERTIES

Top

CLASS METHODS

Top

METHODS

Top

formatOutputDataStructure(rhData)

Return stringification of $rhData suited for the Editor.

formatOutputItem($item)

Return stringification of $item suited for the Editor. $item can be a scalar, array ref or hash ref.

AUTHOR

Top

Johan Lindström, <johanl[ÄT]DarSerMan.com>

BUGS

Top

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.

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


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__