Rapid debunking of conspiracy theories with Perl

Thursday, 26 April 2007

use Date::Calc "Delta_Days";

my $days = Delta_Days( 2001, 9, 11,    # US
                       2004, 3, 11 );  # Spain

print $days, $/;

912.

digg stumbleupon del.icio.us reddit Fark Technorati Faves

Discussion

Comments


Jen

A missing-the-point comment

What editor do you use for perl? I've always used emacs with cperl-mode, but those don't look like the standard colors for either of emacs' perl modes. Anything you'd suggest?

By Jen on 26 April 2007 · 12:50
comment link · reply to this

Ashley

Re: Rapid debunking of conspiracy theories with Perl

I also use Emacs with cperl-mode—or sometimes perl-mode which indents some things better—but what’s printed up there is dynamically generated from the software which runs the site. I added the code coloring just a couple of days ago.

It uses the wonderful PPI to walk through and add spans around different code tokens. Then it’s just a little CSS to color it (I haven’t settled on a final scheme yet, I’ll probably rip off perldoc.perl.org’s lovely scheme. I was planning on posting a code sample of it but haven’t got to it yet. I want to do a section of nothing but code snippets because I’ve got 1,000+ lying around. That is shaping up and I’ll add something in the sidebar like “New non-journal stuff” when it’s together.

By Ashley on 26 April 2007 · 13:10
comment link · reply to this

Jen

Re: Rapid debunking of conspiracy theories with Perl

Never even heard of PPI. Pretty cool stuff. Isn't it a bad sign for the readability of a language if it isn't possible to parse it without the actual interpreter? But that's just my reaction from reading all the we-will-never-be-perfect stuff... I haven't checked out what PPI can acutally do.

And code snippets would be awesome... I do luvs them snippets.

By Jen on 26 April 2007 · 20:42
comment link · reply to this

Ashley

Re: Rapid debunking of conspiracy theories with Perl

PPI is very, very good at parsing Perl but, like the man said, only perl can parse Perl (meaning, only the actual interpreter can parse the language). This is because Perl is extremely dynamic for things like self-generating code or on the fly namespace manipulation; you might not even know what your program looks like until it’s running, or has been running. This is part of its curse and its charm. Why it’s both so easy and so easy to write badly. I think it’s safe to say I would not be a hacker, of any material cloth, without Perl because I’d never be charmed by any of the other languages.

By Ashley on 26 April 2007 · 22:56
comment link · reply to this

Jen

Re: Rapid debunking of conspiracy theories with Perl

Hmm.. that's odd. On this page there's a link to the next post, "I like insects better than you #26: sweat bee", but as of 11:45 EST, it doesn't seem to exist.

By Jen on 26 April 2007 · 20:45
comment link · reply to this

Ashley

Re: Rapid debunking of conspiracy theories with Perl

:) Sweat bee might be next… I must have broken the search_live ResultSet call—that post is not “live” yet but scheduled to post in the future—when I reordered the arguments earlier to allow for something else. You can have a top secret preview for being so observant: sweat bee.

I’m fiddling lots of little stuff right now to allow for different kinds of hierarchical/tree posts in and outside the “blog” line.

By Ashley on 26 April 2007 · 22:48
comment link · reply to this

anne

Re: Rapid debunking of conspiracy theories with Perl

hierarchical/tree posts........... line ?

By anne on 27 April 2007 · 21:07
comment link · reply to this

Your information (required) Name*
Email*
Website

* Indicates required fields; email is used for validation and is not displayed on the site.

Your comment
Commenting on Rapid debunking of conspiracy theories with Perl
Title

Body is limited to ≈1,000 words. Paragraphs—but not line breaks—are automatically inserted. Valid XHTML is required. These are the allowed tags–

<a href=""></a> <br/> <acronym title=""></acronym> <abbr title=""></abbr> <code></code> <pre></pre> <tt></tt> <ins></ins> <del></del> <hr/> <cite></cite> <b></b> <i></i> <sup></sup> <sub></sub> <strong></strong> <em></em> <h1></h1> <h2></h2> <h3></h3> <q></q> <blockquote></blockquote>