| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | =head1 NAME | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | Devel::PerlySense::Editor::Emacs - Integration with Emacs | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | =cut | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 6 |  |  | 6 |  | 26 | use strict; | 
|  | 6 |  |  |  |  | 10 |  | 
|  | 6 |  |  |  |  | 186 |  | 
| 15 | 6 |  |  | 6 |  | 22 | use warnings; | 
|  | 6 |  |  |  |  | 17 |  | 
|  | 6 |  |  |  |  | 151 |  | 
| 16 | 6 |  |  | 6 |  | 418 | use utf8; | 
|  | 6 |  |  |  |  | 14 |  | 
|  | 6 |  |  |  |  | 42 |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | package Devel::PerlySense::Editor::Emacs; | 
| 19 | 6 |  |  | 6 |  | 213 | use base "Devel::PerlySense::Editor"; | 
|  | 6 |  |  |  |  | 6 |  | 
|  | 6 |  |  |  |  | 106 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 6 |  |  | 6 |  | 34 | use Spiffy -Base; | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 26 |  | 
| 25 | 6 |  |  | 6 |  | 3867 | use Data::Dumper; | 
|  | 6 |  |  | 6 |  | 8 |  | 
|  | 6 |  |  | 6 |  | 166 |  | 
|  | 6 |  |  |  |  | 23 |  | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 157 |  | 
|  | 6 |  |  |  |  | 21 |  | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 302 |  | 
| 26 | 6 |  |  | 6 |  | 25 | use File::Basename; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 327 |  | 
| 27 | 6 |  |  | 6 |  | 24 | use Graph::Easy; | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 126 |  | 
| 28 | 6 |  |  | 6 |  | 22 | use Text::Table; | 
|  | 6 |  |  |  |  | 9 |  | 
|  | 6 |  |  |  |  | 132 |  | 
| 29 | 6 |  |  | 6 |  | 23 | use List::Util qw/ max first /; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 346 |  | 
| 30 | 6 |  |  | 6 |  | 24 | use POSIX qw/ ceil /; | 
|  | 6 |  |  |  |  | 7 |  | 
|  | 6 |  |  |  |  | 41 |  | 
| 31 | 6 |  |  | 6 |  | 283 | use Path::Class; | 
|  | 6 |  |  |  |  | 14 |  | 
|  | 6 |  |  |  |  | 273 |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 6 |  |  | 6 |  | 25 | use Devel::PerlySense; | 
|  | 6 |  |  |  |  | 8 |  | 
|  | 6 |  |  |  |  | 32 |  | 
| 34 | 6 |  |  | 6 |  | 1211 | use Devel::PerlySense::Class; | 
|  | 6 |  |  |  |  | 11 |  | 
|  | 6 |  |  |  |  | 37 |  | 
| 35 | 6 |  |  | 6 |  | 1142 | use Devel::PerlySense::Util; | 
|  | 6 |  |  |  |  | 7 |  | 
|  | 6 |  |  |  |  | 310 |  | 
| 36 | 6 |  |  | 6 |  | 23 | use Devel::PerlySense::Util::Log; | 
|  | 6 |  |  |  |  | 6 |  | 
|  | 6 |  |  |  |  | 237 |  | 
| 37 | 6 |  |  | 6 |  | 31 | use Devel::PerlySense::Document::Api::Method; | 
|  | 6 |  |  |  |  | 9 |  | 
|  | 6 |  |  |  |  | 49 |  | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =head1 PROPERTIES | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =head1 CLASS METHODS | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =head1 METHODS | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head2 formatOutputDataStructure(rhData) | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | Return stringification of $rhData suited for the Editor. | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =cut | 
| 54 | 3 |  |  | 3 | 1 | 4 | sub formatOutputDataStructure { | 
| 55 | 3 |  |  |  |  | 7 | my ($rhData) = Devel::PerlySense::Util::aNamedArg(["rhData"], @_); | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | #    return q|'(("class-overview" . "Hej baberiba\n [ Class::Accessor ]") ("class-name" . "Class::Accessor") ("message" . "Whatever2"))|; | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 3 |  |  |  |  | 6 | my $keysValues = $self->formatOutputItem($rhData); | 
| 60 |  |  |  |  |  |  |  | 
| 61 | 3 |  |  |  |  | 159 | return qq|'$keysValues|; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =head2 formatOutputItem($item) | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | Return stringification of $item suited for the Editor. $item can be a | 
| 71 |  |  |  |  |  |  | scalar, array ref or hash ref. | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =cut | 
| 74 | 13 |  |  | 13 | 1 | 9 | sub formatOutputItem { | 
| 75 | 13 |  |  |  |  | 10 | my ($value) =  @_; | 
| 76 |  |  |  |  |  |  |  | 
| 77 | 13 |  |  |  |  | 11 | my $output = ""; | 
| 78 | 13 | 100 |  |  |  | 19 | if(ref($value) eq "ARRAY") { | 
|  |  | 100 |  |  |  |  |  | 
| 79 | 1 |  |  |  |  | 1 | $output = "(" . join(" ", map { $self->formatOutputItem($_) } @$value) . ")" | 
|  | 2 |  |  |  |  | 5 |  | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  | elsif(ref($value) eq "HASH") { | 
| 82 | 8 |  |  |  |  | 7 | $output = "(" . join(" ", map { | 
| 83 | 4 |  |  |  |  | 13 | my $key = $_; | 
| 84 | 8 |  |  |  |  | 9 | my $item_value = $value->{$_}; | 
| 85 | 8 |  |  |  |  | 17 | $item_value = $self->formatOutputItem($item_value); | 
| 86 |  |  |  |  |  |  |  | 
| 87 | 8 |  |  |  |  | 15 | $key = $self->renameIdentifier($key); | 
| 88 | 8 |  |  |  |  | 9 | $key = $self->escapeValue($key); | 
| 89 |  |  |  |  |  |  |  | 
| 90 | 8 |  |  |  |  | 20 | qq|("$key" . $item_value)|; | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | } sort keys %$value) . ")"; | 
| 93 |  |  |  |  |  |  | } | 
| 94 |  |  |  |  |  |  | else { | 
| 95 | 8 |  |  |  |  | 10 | $output = $self->escapeValue($value); | 
| 96 | 8 |  |  |  |  | 10 | $output = qq|"$output"|; | 
| 97 |  |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  |  | 
| 99 | 13 |  |  |  |  | 19 | return $output; | 
| 100 |  |  |  |  |  |  | } | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  | ###TODO: escape " and \ and fix newlines | 
| 107 | 16 |  |  | 16 | 0 | 10 | sub escapeValue { | 
| 108 | 16 |  |  |  |  | 13 | my ($value) = (@_); | 
| 109 |  |  |  |  |  |  |  | 
| 110 | 16 |  |  |  |  | 15 | $value =~ s| ([\\"]) |\\$1|gsmx; | 
| 111 |  |  |  |  |  |  |  | 
| 112 | 16 |  |  |  |  | 21 | return $value; | 
| 113 |  |  |  |  |  |  | } | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | 1; | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | __END__ | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | =encoding utf8 | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =head1 AUTHOR | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | Johan Lindström, C<< <johanl[ÄT]DarSerMan.com> >> | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head1 BUGS | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | Please report any bugs or feature requests to | 
| 136 |  |  |  |  |  |  | C<bug-devel-perlysense@rt.cpan.org>, or through the web interface at | 
| 137 |  |  |  |  |  |  | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense>. | 
| 138 |  |  |  |  |  |  | I will be notified, and then you'll automatically be notified of progress on | 
| 139 |  |  |  |  |  |  | your bug as I make changes. | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =head1 ACKNOWLEDGEMENTS | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | Copyright 2005 Johan Lindström, All Rights Reserved. | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 148 |  |  |  |  |  |  | under the same terms as Perl itself. | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | =cut |