PetaMem has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have questions regarding perl hiliting, xrefing and prettyprinting. They all touch the issue how to handle perlcode in terms of presenting it:

(I develop under Linux using Emacs)

Does anyone know of a good source code tag system for Perl that is able to generate syntax hilited xrefs? Moreover a system (the same system?) that would be able to prettyprint perlcode?

Any hints and oracles appreciated. ;-)

Ciao

Replies are listed 'Best First'.
Re: Perl syntax hilit and folding...
by bikeNomad (Priest) on Jun 22, 2001 at 22:13 UTC
    The new version of VIM (6.0) supports syntax folding. Nick Hibma has written a syntax highlighter for Perl that enables folding on packages and subroutines (but not on any inner blocks); it's at http://www.etla.net/~n_hibma/vim/. It can also do syntax highlighting of pod text at the same time as the Perl.

    As far as xrefs, there are a couple of tags generators for Perl; the "exuberant ctags" that comes with VIM will attempt to do Perl subroutine tagging, but there are a couple of tags generators that will also do more. Michael Schaap <mscha@dogbert.demon.nl> has written one that comes with Vim, as I remember, and I have one here that uses the debugger.

    For prettyprinting existing code, you're on your own. Vim does do a good job (with 6.0ag) of indenting Perl code as you type it. You could probably make a Vim macro that would re-type the Perl code and thereby use the indenting features.

    Vim also supports running Perl internally (if it's compiled that way); this can add some functionality.

    Oh yes, for highlighting for HTML, Vim will also output a colorful HTML version of your code like this:

    use strict;
    package AnySerialPort;
    use vars '@ISA';
    
    BEGIN {
        my %portMap;
        my $oldNew;
        my $onWindows = 0;
    
        if ($^O eq 'MSWin32')   # running on Win32
        {
            $onWindows = 1;
            eval "use Win32::SerialPort";

    update: added bit about HTML highlighting.

Re: Perl syntax hilit and folding...
by holygrail (Scribe) on Jun 22, 2001 at 18:54 UTC
    I heard from a friend that jEdit could do all these things.

    --HolyGrail
Re: Perl syntax hilit and folding...
by Brovnik (Hermit) on Jun 22, 2001 at 20:40 UTC
(bbfu) (web presentation of Perl code) Re: Perl syntax hilit and folding...
by bbfu (Curate) on Jun 23, 2001 at 05:03 UTC

      I would like to show some of my crafts on my Homepage ...

    <SHAMELESS PLUG>
    Well, my Perl Highlighter was made for exactly that. You can see what some of the other monks thought about it here. Maybe it will fit your needs.
    </SHAMELESS PLUG>

    bbfu
    Seasons don't fear The Reaper.
    Nor do the wind, the sun, and the rain.
    We can be like they are.