|XP is just a number|
The Lighter Side of Perl Culture (Part II): JAPHby eyepopslikeamosquito (Chancellor)
|on Dec 05, 2004 at 06:34 UTC||Need Help??|
In the late 1980s, Portland Oregon's third most famous resident (after Monica Lewinsky and Tonya Harding) was not poring over crusty clothing stains or thumping knees with an iron bar. He was far too busy signing his many usenet posts with:
Just another C hacker,and so on. Perl was new then. And our intrepid usenet hacker loved Perl so much that he insisted on answering requests for Unix shell/sed/awk help with snippets of Perl code. So much so that many posters resorted to inserting "No Perl please" in their posts! Of course, making such a request on usenet is futile and the barrage of Perl snippet responses continued unabated. Indeed, so much did our maverick enjoy this little game, that he formed part of the 2.7% who voted against the formation of a separate comp.lang.perl newsgroup in 1989.
Having got used to signing "Just another ____ hacker," it just seemed normal and natural to continue the tradition by signing his Perl missives with:
Just another Perl hacker,Little did he realize that he was adding a new word to the computing lexicon: the JAPH.
Ironically, in later years, he expressed some regret about his creation because JAPHs seemed at least partly responsible for an over-emphasis on Perl obfuscation and trickiness -- which did not portray Perl as he would have liked (see •Re: Obfuscation has no place in production code).
This, the second installment in the Perl Culture series, focuses on merlyn's little gift to Perl culture: the JAPH.
What is a JAPH?
A JAPH is simply a program that prints "Just another Perl hacker," to stdout. The basic idea is to use this (arbitrary) program specification to highlight interesting language features in the spirit of TMTOWTDI. In deference to its usenet signature origins, JAPHs are usually limited to at most 4 lines, with each line at most 80 characters in length. To delight (and not bore) the reader, a JAPH is expected to employ obscure or surprising or amusing syntax.
Of course, the idea of using an arbitrary canonical program to learn and demonstrate a language is hardly new. See, for example: hello world, 99 Bottles of Beer, FizzBuzz, quines, and the delightful Perl Mongueurs $A++ obfu page. The JAPH, however, is special to Perl lovers because of its long traditions and its uniqueness to Perl.
What was the first JAPH?
As described here, the first JAPH was written by Randal L. Schwartz in 1988 and was simply:
Note the capitalization and trailing comma; they will be put under the microscope in a later section.
According to the CPAN JAPH Archive, the first (mildly) obfuscated JAPH was:
Actually, I notice that this CPAN "JAPH" archive contains many entries that are obfus, not JAPHs!
Did Larry ever write a JAPH?
According to history.perl.org he wrote two!
The first picked a random merlyn post from his news spool, ran the code, but printed "Not " in front of it. I can't find the actual code that did this, however.
Interestingly, the second, created in March 1990, also formed the first Perl poem ever written:
Reading this historic poem aloud, with STDOUT pronounced standard out and $ pronounced dollar, indicates that it's a haiku, containing the trademark 5-7-5 syllables in its three lines. Notice that this Perl 3 code no longer runs with modern perls.
If you know of any other JAPHs penned by Larry, please let us know.
Some Classic JAPHs
Choosing a favourite JAPH depends on personal preference: some folks like JAPHs that break B::Deparse and are almost impossible to decipher; others prefer ones that simply make them laugh. Of the JAPHs I've seen, the one that made me laugh the most is this one:
taken from this June 1998 Unix Review magazine article by merlyn.
The Battle of the JAPH Standards
Lacking an ANSI JAPH standard, the past decade has seen a gripping power struggle for control of the de facto JAPH standard between their inventor, merlyn, and perhaps their greatest promoter, the inimitable Abigail.
On one occasion, upstart Abi claimed the right to change the JAPH standard:
As you might expect, merlyn firmly rebuffed this claim, and has tenaciously defended his original JAPH standard on many other occasions. See, for example: RE: RE: JAPH, •Re: step-by-step JAPH, and here.
How is a JAPH distinct from an obfu?
As argued by BooK in Separated JAPH/Obfuscation sections, there are significant differences in emphasis between JAPHs and obfus. I don't want to enter this debate right now, but might in the next installment, which will focus on obfus.
Other Articles in This Series
Updated April 2006: Added some Abigail JAPH examples.