Acme-EyeDrops
view release on metacpan or search on metacpan
lib/Acme/EyeDrops.pm view on Meta::CPAN
).( '{'^'[').('`'|'!').('`'|'.').('{'^'['). (((
'`' ))|'/').('`'|',').('`'|'$').("\{"^ '[' ).(
'[' ^'(').('`'|'(').('`'|'/').('`'|'%') .(( '!'
)). '\\",\\"'.('{'^'/').('`'|'(').("\`"| '%' ).(
'[' ^')').('`'|'%').('{'^'[').('`'|"\!").( '['^ ')'
).( '`'|'%').('{'^'[').('`'|'.').('`'|'/').( "\{"^ '['
).( '`'^'!').('`'|'-').('`'|'%').('['^"\)").( ('`')| ')'
).( '`'|'#').('`'|'!').('`'|'.').('{'^'[').('`'| ')').('`' |((
'.' ))).('`'|'&').('`'| ')').('`'|'$').('`'| '%'
).( '`'|',').(('[')^ '(').('{'^'['). (((
'`' ))|')').("\`"| '.').(('{')^ '['
).( '`'^('"')).( '`'|'!'). (((
'`' ))|("'")).( ('`')| '('
).( '`'|"\$").( "\`"| '!'
).( '`'|"\$"). ('!\\",\\"').( '{'^',').("\`"| '%') .+(
'{' ^('[')).( ( '`')|'(' ) .('`' |((
'!' ))).('['^'-' ) . ( ( '`')|'%').('{'^ '['
).( '['^'/') . ( ( ( '`'))| '('
).( '`'|'%') . +( ( ( ( '`'))) |((
'-' ))).('{' ^ ( ( ( '['))) ).(
'[' ^'(').( '['^'.').('[' ^')').('['^')'). +( (( '`'
))| '/'). ( ( ( '['
))^ ( ( ( ( ( '.'
))) ) ) ) . (((
'`' ) ) | ( '.'
)). ( ( ( ( ( '`'
))) ) |+ '$'). +( ( '`'
)|+ ( ( ( '%'
))) ) . (((
'`' ) ) | '$'
).( ( ( ( '{'
))) ^'[').('`' | ( ( ')'
))) . ('`'|'.').('{' ^ '['
).( ( '[') ^'/' ) . ( '`'
|(( ( ( (( ( ( '('
))) ) )) )))
.+( ( (( '`' ) ))|
'%' ).('`'|')').( ( '['
)^+ ( ')')).('{'^ ( '['
)). ( '['
^(( ( ( '/'
))) ) ).(
'`' | '!'
).( ( ( '`'
))| ( ( '.'
))) . ( '`'
|(( ( ( '+'
))) )).('['^'(' ).+
'!' .((
'\\')).'",\\"'.('`'^')').('{'^'[').('['^'(').('['^'+').('`'|'%').('`'|
'!').('`'|'+').('{'^'[').('`'|'"').('`'|'%').('['^'/').('['^'/').('`'|
'%').('['^')').('{'^'[').('`'^'%').('`'|'.').('`'|"'").('`'|',').('`'|
')').('['^'(').('`'|'(').('{'^'[').('['^'/').('`'|'(').('`'|'!').('`'|
'.').('{'^'[').('['^'/').('`'|'(').('`'|')').('['^'(').('{'^'[').('['^
'-').('`'|')').('`'|',').('`'|',').('`'|'!').('`'|')').('`'|'.').('{'^
'[').('`'^'"').('['^'.').('['^'(').('`'|'(').'!\\")['.('['^')').("\`"|
'!').('`'|'.').('`'|'$').'('.('^'^('`'|'*')).')],\\$/"})');$:='.'^'~';
=head2 99 Bottles of Beer
The web site F<http://www.99-bottles-of-beer.net/> features programs
to display the lyrics of the famous I<99 bottles of beer> song in
over 700 different computer languages.
Over the years, many different Perl solutions have been proposed.
On December 25 1998, for instance, Damian Conway suggested using his
Lingua::EN::Inflect module:
use Lingua::EN::Inflect 'inflect';
$n=shift||99;
print inflect<<BURP while $n;
NO(bottle of beer,$n) on the wall, NO(bottle of beer,$n)!
Take one down, pass it around,
NO(bottle of beer,@{[--$n]}) on the wall.
BURP
During May 2003, the two leading Perl golfers of that era, Ton Hospel and
Mtv Europe, produced the shortest known Perl solution:
sub
b{[@b=(abs||No,bottle."s"x!!++$_,of,beer),on,the,wall]}print
"@{+b},\n@b,\nTake one down, pass it around,\n@{+b}.\n"
for-pop||-99..-1
Some years later I noticed that this program can be further shortened
by changing C<"s"> to C<'s'> and embedding the C<sub> inside the first
C<@{}> block like so:
@{sub b{[@b=(abs||No,bottle.'s'x!!++$_,of,beer),on,the,wall]}b}
This saves a stroke because the first C<+b> in the original is replaced
by a bald C<b>.
Elegant though this solution is, they may have felt a little gobsmacked
when the world's leading I<HQ9+> golfer, Casey West, uncorked a one
stroke solution (C<9>) in that surreal programming language.
To produce a solution shaped like a row of beer bottles, run this:
use Acme::EyeDrops qw(sightly get_eye_string hjoin_shapes);
my $ninety_nine = <<'BURP';
$==pop||99;--$=;sub
_{($;=($=||No)." bottle"."s"x!!--$=." of beer")." on the wall"}
print+_,", $;!
Take one down, pass it around,
",_,"!
"while++$=
BURP
chop($ninety_nine); $ninety_nine =~ s/\nprint/print/;
print sightly( { Regex => 1,
Compact => 1,
ShapeString => hjoin_shapes(2,
(get_eye_string('bottle2'))x6),
SourceString => $ninety_nine } );
producing:
''=~( '(?{' .('`' |'%') .('[' ^'-')
.('`' |'!') .('`' |',') .'"'. '\\$'
.'==' .('[' ^'+') .('`' |'/') .('['
lib/Acme/EyeDrops.pm view on Meta::CPAN
my @perlhackers = find_eye_shapes('face',
'person OR animal',
'perlhacker');
finds all shapes matching face AND (person OR animal)
AND perlhacker.
Instead of using the API, as shown above, you may also use
the F<findshapes.pl> command in the F<demo> directory:
findshapes.pl -h (for help)
findshapes.pl -v face person perlhacker
The last example displays the faces and properties of all
perl hackers.
Please note that these shape properties are experimental and
may change in future A::E releases.
=head1 BUGS
A really diabolical shape with lots of single character lines
will defeat the shape-pouring algorithm.
You can eliminate all alphanumerics (via Regex => 1) only if the
program to be converted is careful with its use of regular
expressions and C<$_>.
To convert complex programs, you must use Regex => 0, which
emits a leading unsightly double C<eval>.
The code generated by non-zero Regex requires Perl 5.005 or higher
in order to run; when run on earlier versions, you will likely
see the error message: C<Sequence (?{...) not recognized>.
If using Perl 5.18+, the generated file needs a leading
"use re 'eval'" when a postive value for Regex is used.
The converted program runs inside an C<eval> which may cause
problems for non-trivial programs. A C<die> statement or
an C<INIT> block, for instance, may cause trouble.
If desperate, give the C<TrapEvalDie> and C<TrapWarn>
attributes a go, and see if they fix the problem.
If the program to be converted uses the Perl format variables
C<$:>, C<$~> or C<$^> you may need to explicitly set the
C<FillerVar> attribute to a Perl variable/s not used by the program.
Linux F</usr/games/banner> does not support the following characters:
\ [ ] { } < > ^ _ | ~
When the CPAN Text::Banner module is enhanced, it will be used
in place of the Linux banner command.
=head1 AUTHOR
Andrew Savige <asavige@cpan.org>
=head1 SEE ALSO
Acme::EyeDrops lightning talk by Flavio Poletti at YAPC::Europe 2008 at F<http://yapc.tv/>.
Acme::EyeDrops in JPerl Advent Calendar (Japanese)
at F<http://perl-users.jp/articles/advent-calendar/2009/casual/08.html>.
The history of Acme::Bleach, Acme::EyeDrops and related modules
at F<http://www.perlmonks.org/?node_id=967004>.
Software Art page at F<http://www.runme.org/>.
Acme's Y::E 2002 naked arm wrestling movie at
F<http://astray.com/tmp/yapcbits3.mov>.
Japanese translations of selected CPAN modules (including Acme::EyeDrops)
can be found at F<http://perldoc.jp/docs/modules/>.
(Japanized Perl Resources Project is at
F<https://sourceforge.jp/projects/perldocjp/>).
Perl Obfuscation Engines, for example, yaoe by Perl Monk mtve,
at F<http://www.perlmonks.org/index.pl?node_id=161087>.
More information on 99 bottles of beer can be found at
F<http://www.99-bottles-of-beer.net/> and
F<http://archive.develooper.com/fwp@perl.org/msg03193.html>.
Similar sites exist for I<hello world> programs
F<http://www2.latech.edu/~acm/HelloWorld.shtml>,
and I<quines>
F<http://www.nyx.net/~gthompso/quine.htm>.
To learn more about HQ9+ programming visit
F<http://www.cliff.biffle.org/esoterica/hq9plus.html> and
F<http://search.cpan.org/dist/HQ9PLUS/>.
Perl Monks Obfuscation section.
In particular, ideas for EyeDrops shapes were got from:
F<http://www.perlmonks.org/index.pl?node_id=45213>
(Erudil's camel code),
F<http://www.perlmonks.org/index.pl?node_id=285157>
(Spaghetti Obfu),
F<http://www.perlmonks.org/index.pl?node_id=289733>
(Just another Bach Hacker),
F<http://www.perlmonks.org/index.pl?node_id=329174>
(hello world),
F<http://www.perlmonks.org/index.pl?node_id=188405>
(Sierpinski Triangle),
F<http://www.perlmonks.org/index.pl?node_id=398757>
(Halloween JAPH ?),
F<http://www.perlmonks.org/index.pl?node_id=384100>
(Propose.),
F<http://www.perlmonks.org/index.pl?node_id=397958>
(Saturn).
Changes to Perl 5.18 regex behavior are discussed at
F<http://perlmonks.org/?node_id=1030569>.
The Y::E 2002 I<Dark Art of Obfuscation> talk by Thomas Klausner
at F<http://domm.zsi.at/talks/obfu_yapc2002/>.
Les Perl Mongueurs de Paris $A++ page at
F<http://paris.mongueurs.net/aplusplus.html>.
Yanni Ellen Liu's excellent Ascii Art collection formerly at
F<http://www.cs.umanitoba.ca/~yliu/>.
More information on I<Baghdad Bob> can be found at
F<http://www.welovetheiraqiinformationminister.com/>.
More information on koaladiles (and their relationship to kwalitee)
can be found at
F<http://nntp.perl.org/group/perl.qa/3340>.
The cam.pm Obfuscated Programming Contests at
F<http://cam.pm.org/projects_home.shtml>.
I<Perl Golf> was played monthly at
F<http://perlgolf.sourceforge.net/> and is now played mostly at
F<http://codegolf.com/>. Ton Hospel's excellent generic
golf tester can be got from
F<http://www.xs4all.nl/~thospel/golf/gentest.pl>.
The C<--$|> idiom (exploited in the I<A Somersaulting Camel>
section) is "explained" in this thread:
F<http://archive.develooper.com/fwp@perl.org/msg01360.html>.
L<Acme::Bleach>
L<Acme::Smirch>
L<Acme::Buffy>
L<Acme::Pony>
L<Acme::ChuckNorris>
L<Acme::AsciiArt2HtmlTable>
L<Acme::AsciiArtinator>
=head1 CREDITS
I blame Japhy and Ronald J Kimball and others on the fwp
mailing list for exposing the ''=~ trick, Jas Nagra for
explaining his C<Acme::Smirch> module, and Rajah Ankur
and Supremely Unorthodox Eric for provoking me.
I would also like to thank Ian Phillipps, Philip Newton,
Ryan King, Michael G Schwern, Robert G Werner, Simon Cozens,
and others on the fwp mailing list for their advice on
ASCII Art, imaging programs, and on which picture of
Larry to use.
Thanks also to Mtv Europe, Ronald J Kimball and Eugene
van der Pijll for their help in golfing the program in
the I<Twelve Thousand and Thirty Two Camels> section.
Keith Calvert Ivey also contributed some levity to this section.
The "Love Birds" section was provoked by Muss, Jiun and Taffy.
The thumbsup shape was derived from one originally designed by Jiun.
Ideas from Adam Antonik, Mtv Europe, Eugene van der Pijll, Ton Hospel
and Keith Calvert Ivey were used in the I<Sierpinski Triangles> section.
Thanks cog for the prod to add new Shape Properties feature.
The jon shape was derived from
F<http://www.spidereyeballs.com/os5/set1/small_os5_r06_9705.html>.
Kudos to Elaine -HFB- Ashton for showing me this.
The merlyn shape was derived from this photo
F<http://www.stonehenge.com/merlyn/my_real_proof.jpg>
of Randal singing a duet with Samantha Fox.
The simon shape was derived from a pencil sketch by the Japanese
artist Eiko Yamashita.
The candle, china1, panda and santa2 shapes were derived from similar
ones at Yanni Ellen Liu's Ascii Art collection.
=head1 COPYRIGHT
Copyright (c) 2001-2015 Andrew Savige. All rights reserved.
This program is free software; you can redistribute it and/or
( run in 2.083 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )