Just another Perl hacker: Difference between revisions

Content deleted Content added
fix typo
m Reverted 1 edit by 2804:658C:210F:7200:F1D1:56C4:4316:9BE2 (talk) to last revision by Explicit
Tags: Twinkle New redirect Undo Mobile edit Mobile web edit Advanced mobile edit
 
(111 intermediate revisions by 94 users not shown)
Line 1:
#REDIRECT [[Perl#Community]]
'''Just another Perl hacker''', or '''JAPH''', typically refers to a [[Perl]] program which prints "Just another Perl hacker," (the comma is [[canonical]] but is occasionally omitted). Short JAPH programs are often used as [[signature block|signatures]] in online [[Internet forum|forums]], or as [[T-shirt]] designs. The phrase or acronym is also occasionally used (without [[code (computer programming)|code]]) for a signature.
 
{{Rcat shell|
JAPH programs are classically done using extremely [[obfuscated code|obfuscated]] methods, in the spirit of the [[The International Obfuscated C Code Contest|Obfuscated C Contest]]. More recently, as the phenomenon has become so well known, the phrase is sometimes used in ordinary examples (without obfuscation).
{{R to related topic}}
Even more recently the P of '''JAPH''' can also stand for [[Perl 6]], [[parrot virtual machine|Parrot]] or [[Pugs]].
}}
 
The idea of using tiny Perl programs which print a signature ''as a signature'' was originated by [[Randal L. Schwartz]], in his postings to the [[newsgroup]] comp.lang.perl. <ref>Randal L. Schwartz in [[usenet]] message M1HFPVH2JQ.FSF@HALFDOME.HOLDIT.COM explaining the origin of JAPH. Available through google: http://groups.google.com/group/comp.lang.perl.misc/msg/ecc405feeefc120c</ref>
 
==Examples==
 
JAPH program without obfuscation:
 
print "Just another Perl hacker,\n";
 
Embedding JAPH in opaque code:
 
$_='987;s/^(d+)/$1-1/e;$1?eval:print"Just another Perl hacker,"';eval;
 
Decoding JAPH from an [[cryptography|encrypted]] [[string literal]]:
 
$_="krJhruaesrltre c a cnP,ohet";$_.=$1,print$2while s/(..)(.)//;
 
Appearing as if it does something completely unrelated to printing JAPH:
 
$_ = "wftedskaebjgdpjgidbsmnjgc";
tr/a-z/oh, turtleneck Phrase Jar!/; print;
 
Using only Perl [[Keyword (computer)|keywords]] (no [[literal]]s or [[punctuation]]):
 
not exp log srand xor s qq qx xor
s x x length uc ord and print chr
ord for qw q join use sub tied qx
xor eval xor print qq q q xor int
eval lc q m cos and print chr ord
for qw y abs ne open tied hex exp
ref y m xor scalar srand print qq
q q xor int eval lc qq y sqrt cos
and print chr ord for qw x printf
each return local x y or print qq
s s and eval q s undef or oct xor
time xor ref print chr int ord lc
foreach qw y hex alarm chdir kill
exec return y s gt sin sort split
 
Using only [[punctuation]] (no [[alphanumeric]] characters):
 
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
 
[[Perl 6]] carries the tradition. Here an example that demonstrates [[currying]]:
 
sub japh (Str $lang) { say "just another $lang hacker"; }
my &perl6Japh := &japh.assuming("Perl6");
perl6Japh();
 
==Imitations==
 
A different form of imitation would be to solve the exercise in a system outside of [[Perl]]. This example is supposed to be run in a [[Bourne shell]] and will create a [[Computer file|file]] named "Just another Perl Hacker" (on a [[file system]] that supports it) in the current working directory. The [[String (computer science)|string]] to print will be determined by the "basename" command.
 
a="Just another Perl Hacker"
[ -f"$a" ]||
echo "perl -e\"print '\$(basename \"\$0\")'\"">./"$a"
./"$a"
 
i.e. while it is true that (as demanded by the exercise text) "[[Perl]] prints \"Just another Perl Hacker\"", the code requires other software to function, here specifically [[Bourne shell]] and "basename".
 
==Additional information==
===See also===
*[[Obfuscated Perl contest]]
 
===References===
{{FOLDOC}}
<references/>
 
==External links==
*[http://www-106.ibm.com/developerworks/linux/library/l-japh.html Cultured Perl: The Elegance of JAPH]
*[http://www.cpan.org/misc/japh http://www.cpan.org/misc/japh] A collection of JAPHs at [[CPAN]].
*[http://code.eachmapinject.com/japh.pm A basic JAPH]
 
[[Category:Perl]]
[[Category:Phrases]]
 
[[de:Just another Perl hacker]]
[[fr:JAPH]]
[[pl:Just another Perl hacker]]
[[ru:JAPH]]