Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Keep It Simple, Stupid
 
PerlMonks  

Re: On-the-fly all-languages syntax highlighting

by SavannahLion (Pilgrim)
on Dec 16, 2003 at 02:00 UTC ( #314947=note: print w/ replies, xml ) Need Help??


in reply to On-the-fly all-languages syntax highlighting

You write that your module is slower than the other highlighters. I would like to test it, but I haven't quite gotten far enough with Perl to work out how to time running scripts (it's on my TO-DO list somewhere).

What kind of performance differences are we looking at here? I've been wanting to implement something like this for my website (specifically C/C++ and a custom script), but slogging through pages and pages of search engine results yielded really great color highlighters. But none, so far, that is a Perl script for highlighting other languages.

At one point, I even wondered if I could utilize the B module, but I fear that's too much of a security risk.

----
Is it fair to stick a link to my site here?

Thanks for you patience.


Comment on Re: On-the-fly all-languages syntax highlighting
Re^2: On-the-fly all-languages syntax highlighting
by Aristotle (Chancellor) on Dec 16, 2003 at 07:29 UTC

    See the documentation on the Benchmark module that comes with Perl.

    Using B (probably with some backend such as B::Terse, I canít imagine you want the bare B module) would only be a security issue if you want to highlight code submitted to your site by anyone, and thatís not because of B itself so much as because using B requires Perl to have compiled the code, which is inseparably connected with the possibility of having code run at compile-time.

    Makeshifts last the longest.

      Using B (probably with some backend such as B::Terse, I can't imagine you want the bare B module) would only be a security issue if you want to highlight code submitted to your site by anyone, and that's not because of B itself so much as because using B requires Perl to have compiled the code, which is inseparably connected with the possibly of having code run at compile-time.

      That's exactly the problem I'm worried about. The site is open ended and allows text to be uploaded. I mentioned B since I saw that it appeared to have some C specific routines that might be utilized for what I want. I toyed with that idea for all of 40 seconds when I realized that B is ultimately designed to compile C and that someone might be able to invoke the compiler through some bug somewhere I wasn't aware of. A risk I didn't want to take.

      About Text::VimColor. I looked over the documentation for Text::VimColor and I don't think this is a viable alternative for my needs. The wya I figure it, I suppose I could get away caching the output (I already have stubbed code for exactly that sort of thing), but am I correct in understanding that this module utilizes Vim?

      -----
      Is it fair to stick a link to my site here?

      Thanks for you patience.

        but am I correct in understanding that this module utilizes Vim?

        From Text::VimColor docs:

        Text::VimColor - syntax color text in HTML or XML using Vim

        B is ultimately designed to compile C and that someone might be able to invoke the compiler through some bug somewhere I wasnít aware of.

        UhÖ not exactly. B has nothing to do with C compilation, and even B::CC has no code to invoke a compiler.

        What I was referring to is BEGIN blocks, use, and the like.

        Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-04-18 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (463 votes), past polls