Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

cpan source highlighting

by rodd (Scribe)
on Sep 13, 2009 at 16:39 UTC ( [id://795004]=perlmeditation: print w/replies, xml ) Need Help??

Hi,

I just wrote a little javascript "bookmarklet" for Firefox that may be useful for the community. So I'm posting it here (well, on github).

This simple script changes a cpansearch.org source view so that it's syntax highlighted. Besides, it turns package names to links to search.cpan.org.

Why? I just end up reading a lot of source code from the cpan website. I thought a little coloring would make my life easier.

To use it, first try it by opening a source view of a cpan module. Then paste the javascript code in your location bar.

The bookmarklet is kept here. I recommend cpan_sh.js as it puts links on packages that allow you to navigate the CPAN.

cheers,

-rodrigo

Replies are listed 'Best First'.
Re: cpan source highlighting
by Anonymous Monk on Sep 13, 2009 at 17:35 UTC
Re: cpan source highlighting
by hma (Pilgrim) on Sep 15, 2009 at 09:58 UTC
    Very nice! I tried it – and instantly installed the code into the bookmarklet toolbar for easy access. Thanks for posting this, rodrigo!
Re: cpan source highlighting (metacpan)
by toolic (Bishop) on Nov 16, 2011 at 17:57 UTC
    Another option is to use https://metacpan.org, which uses source code syntax highlighting by default.
Re: cpan source highlighting
by leocharre (Priest) on Sep 16, 2009 at 16:08 UTC

    ++ for doing something cool and sharing it with the community.
    That said..

    This is overkill. Javascript sucks.

    Just install already (the source) and use vim to read the source with syntax highlighting turned on.

    Now... what *might* be super duper uber cool... is.... How about you set up a web filter.. that renders code with syntax highlighting?!?!?!??!?!?!!!!!!!!

    So, I would go to http://yoursite.com/render?site=http://cpansearch.perl.org/src/PURDY/CGI-MxScreen-0.103/MxScreen.pm

    And I would get the code with syntax highlighting.

    Very cool. No javascript junk to slow down my browser.

      Just install already (the source) and use vim to read the source with syntax highlighting turned on.

      No way! I always read the source before I install it.

      So, I would go to http://yoursite.com/render

      I do have that web filter url setup at my site. But if I give it to you, I'll also have to send you the check for the bandwidth. :)

        You always read the source before you install.. ?

        Admit it, that's an exageration.
        You did not read the source of the modules you have installed.

        Nobody here has 'always read the source' before they install. You read the docs, you get suggestions from peers on what to use.. You have feel for it.. etc. You can tell when a distro has been cared for, and when it has been thrown up on cpan.

        Every now and then I'll see something on cpan that's obviously been built by someone way cool who knows way more than I do about xyz, but the lack of doc turns me off. The lack of proper distro(ing(?)).

        When I come across a module that's built by someone who doesn't have much out there- if the thing is well documented and the distro has been cared for, I have absolutely no qualm about installing it and trying it out.

        Now, that's me. That was an example of how someone goes about installing stuff.

        Sometimes I snoop at the code, sure. Sometimes because it's someone with class and I admire how they do xyz, or maybe I want to know about the magic of what's going on.

        But for pete's sake- What you're alluding to is actually reading and I assume understanding, code for stuff like DBI, Storable (I think that must have some creepy XS in it, no?)- Smart::Comments, and gosh knows what else. Unless of course you haven't installed DBI, CGI, and HTML::Template because you haven't had the time to read the source yet.

        I take issue with your statement. Because a lot of the people we have here are starting out or maybe never had peers to make suggestions and point out methods of learning and growth- and your suggestion that;

        • a) to see the source with syntax highlighting, you should use this javascript plugin = is merely an option, and in my view for one- a retarded one (and misleading) when you have the tools you need much more readily and reliably available
        • b) you read the source before you install- is ridiculous- unless you are documenting cpan itself and you have a team of monkeys backing you up.

        Now, maybe I am misunderstanding your statements. If so, please excuse me and do clarify.

      JavaScript isn't that bad. It's a nice little language with some nifty concepts.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://795004]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-03-29 14:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found