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

One of the neat features of the OTHER language that is good at handling the CGI environment (PHP), there is a feature where if you set up apache right, and set a file with a .phps extension, it will show the source code with syntax highlighting through html.

Is there anything like this for our beloved perl? If, let's say, I want to showcase some code, is there a code beautifier (or just syntax highlighting really) script for example? Something like:

cat src_script.pl | perl pretty_code.pl > src_script.pls

Surely this has been done... for what better language to parse perl than... perl? :E

"Falling in love with map, one block at a time." - simeon2000

Replies are listed 'Best First'.
Re: PHPS -> perl equivalent?
by davis (Vicar) on Jul 25, 2002 at 14:04 UTC
    Check out perltidy - from perltidy -h
    -html write an html file (see 'man perl2web' for many options) Note: when -html is used, no indentation or formatting are do +ne. Hint: try perltidy -html -css=mystyle.css filename.pl and edit mystyle.css to change the appearance of filename.htm +l. -nnn gives line numbers -pre only writes out <pre>..</pre> code section
    Cheers
    Update: Just tested it, and it does do syntax highlighting - not sure why I thought it didn't.
    davis
    Is this going out live?
    No, Homer, very few cartoons are broadcast live - it's a terrible strain on the animator's wrist
Re: PHPS -> perl equivalent?
by mkmcconn (Chaplain) on Jul 25, 2002 at 19:27 UTC