Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Pretty Print (perltidy integration)

by LanX (Saint)
on May 28, 2016 at 01:52 UTC ( [id://1164374]=note: print w/replies, xml ) Need Help??


in reply to Pretty Print

Actually there are three questions involved

A) how to do this in a backwards compatible way to still be able to see the unformatted code. (Much posted code is broken, we need a fallback)

B) if syntax highlighting should be added too

C) how to implement this into the process chain

Brainstorm:

A) The only chance I see is an additional displaytype, like this users could switch between raw and formated source

B) perltidy can also produce highlighted code, but startup is slow and would cause a lag

C) patching perltidy to run in a server mode might be a solution.

Alternatives?

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re: Pretty Print (perltidy integration)

Replies are listed 'Best First'.
Re^2: Pretty Print (perltidy integration)
by LanX (Saint) on Sep 17, 2017 at 21:40 UTC
    > B) perltidy can also produce highlighted code, but startup is slow and would cause a lag

    > C) patching perltidy to run in a server mode might be a solution.

    FWIW:

    Actually no patch needed, this code from Perl::Tidy is very fast after initialization (which can take 1-2 secs)

    use Perl::Tidy; # ... # run in a loop reading source and outputting dest my $error = Perl::Tidy::perltidy( argv => $argv, source => \$source_string, destination => \$dest_string, stderr => \$stderr_string, errorfile => \$errorfile_string, + );

    Indenting some lines on laptop took under 0.05 sec and own formatters for "special" html are easily implemented.

    (trying to implement a so called "asynchronous process" interface for emacs now)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164374]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-19 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found