Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by Aristotle (Chancellor)
on Dec 16, 2003 at 07:29 UTC ( #315000=note: print w/ replies, xml ) Need Help??


in reply to Re: On-the-fly all-languages syntax highlighting
in thread On-the-fly all-languages syntax highlighting

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.


Comment on Re^2: On-the-fly all-languages syntax highlighting
Re: Re^2: On-the-fly all-languages syntax highlighting
by SavannahLion (Pilgrim) on Dec 17, 2003 at 06:16 UTC

    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.

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

        . Oh, OK, I think I understand now. When I read,

        This compiler backend takes Perl source and generates C source code corresponding to the internal structures that perl uses to run your program. When the generated C source is compiled and run, it cuts out the time which perl would have taken to load and parse your program into its internal semi-compiled form.

        That put me under the impression that it generated and compiled C code. I kept wondering about that blurb near the bottom about "some compilers." I just didn't put two and two together, my bad.

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

        Thanks for you patience.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://315000]
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-09-18 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls