Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

challenge: Perl's art restauration

by Discipulus (Monsignor)
on Mar 06, 2018 at 11:17 UTC ( #1210398=perlmeditation: print w/replies, xml ) Need Help??

Dear monks,

I post this under meditation because this is not really a question by me, even if some question mark is in the text.

Art needs restauration and restauration needs keen eyes and gentle hands. We have here at the monastery precious and invaluable masterpieces ruining as the time passes.

The most incredible things I ever seen in Perl is 3-D Stereogram, Self replicating source. by the genial monk Toodles but unfortunately it just run on perl 5.8 (or as someone said in 5.10).

Is some monk able to spot why this happens?

Is someone able to make this masterpiece run as expected on modern perl versions? Infact it doesnt fail on 5.26 but doesnt produce the stereogram effect: only sparse lines.


There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re: challenge: Perl's art restauration
by Eily (Prior) on Mar 06, 2018 at 16:27 UTC

    A version that works this time (unlike this one). Everything beyond 15 chars was ignored when generating the new code, but my replacement for the split was two chars longer. So I had to move the two extra chars on the next line, and propragate that down to the line n";}print@a;,; where the first and last ; aren't useful, and I could remove them to compensate for the two extra chars.

    #!/usr/bin/perl # Copyright (c) Marcus Post, <> # # # # $_=q,my(@f|@c|x$|@c|x$|@c|x$_=q.m(@f||@c|x$_=q.m(@f| +|@c|xx @w);@a=@f=<DAT%@w);@a=@f=<DAT%@w);@a=@f=<DAT%@w;@a=@f=<DAAT%@w;@a=@f=< +DAAT%% A>;seek(DATA|0!A>;seek(DAA|0!!A>;seek(DAA|0!A>;seek(DAA|0!!A>;seek(DAA +|0!!AA |0);@c=<DATA>;Y|0);@c<DATA>;Y||0);@c<DATA>Y||0);@c<DATA>Y|||0);@c<DATA +>Y|||| until(($_=pop(zutil(($_==pp(zuttil(($_==p(zuttil(($_==p(zutttil(($_==p +(zuttt @c))=~/^_/){};Qc))=~/^_/){};Qc)))=~/^_/{};Qc)))=~/^_/{};Qc))))=~/^_/{} +;Qc))) unshift(@a|$_)xnshift(@a|$_)xnshhift(a|$_)xnshhift(a|$_)xnshhiift(a|$_ +)xnshh ;for(1..3){pri%;for(1.3){pri%;ffor1.3){pri%;ffor1.3){pri%;ffor11.3){pr +i%;fff nt(shift(@c));!nt(shft(@c));!ntt(hft(@c));!ntt(hft(@c));!ntt(hftt(@c)) +;!nttt }for(@f){my($sY}for@f){my($sY}for@f){my($sY}for@f){my($sY}for@f){mmy($ +sY}foo );@_=/(.)/g;$_z);splt//;$_=sz);splt//;$_=sz);splt//;$_=sz);splt//;$_== +sz);ss =shift(@c);$_=Qhift(c);$_=~sQhift(c);$_=~sQhift(c);$_=~sQhift(c);$_=~s +QQhiff ~s/(.{15}).*/\x/(.{15})*/\1/x/(.{15})*/\1/x/(.{15})*/\1/x/(.{15}})*\1/ +xx/(.. 1/;@w=split//;%;@w=split/;fo%;@w=split/;fo%;@w=split/;fo%;@w=spllit;fo +%%;@ww for(@_){$w[$s+!r(@_){$w[$s15!r(@_){$w[$s15!r(@_){$w[$s15!!(@_){$$w[s15 +!!!(@@ 15-$_]=(($w[$sY-$_]=(($w[$s]YY-_]=(($w[$s]YY-_]=(($w[$s]YY-_]=((($[$s] +]YY-__ ]eq"|")?".":$wzq"|")?".":$w[$zq|")?"."::$[$zq|")??."::$[[$z|")???.::$$ +[[$z|| [$s]);$s++;}foQs]);$s++;}for(Qs];$s++;}}or(Qs];$$s+;}}orr(Qs]$$s++;}}o +rr(Qss r(1..75){unlesx1..75){unless(x1.75){unnlss(x1.775){uulsss(x1.75){uuuls +ss(x11 s($w[$_]ne''){%$w[$_]ne''){$w%$w$_]nee''{$w%$$w$_]nn''{{$w%$$w_]nnn''{ +{$w%$$ $w[$_]=$w[($_-![$_]=$w[($_-1)![$_=$w[[($_-)![$_==w[[($$_-)![$__w[[[($$ +_-)![[ 1)];}}print(joY];}}print(joinY];}prinnt(joinY;}prinntt(joinY;}pinnntt( +joinYY in""|@w);printz""|@w);print"\z""|w);;print"\z"|w);;pprint"\z"|w;;pppri +nt"\zz "\n"}print@a,;#n";}print@a;.;#n";priint@a;.;#n;priintt@a;.;#n;piinntt@ +a;.;## y!|zY\!%x!,Q!;#y!|zY\!%x!.Q!;#y!zY\!!%x!.Q!;#!zY\!!%x!!.Q!;#!z\!!!%x!! +.Q!;## s{Q.*\n}[]g;#<>s{Q.*\n}[]g;#<>sQ.*\nn}[]g;#>sQ.*\nn}[]]g;#>sQ.\nnn}[]] +g;#>ss eval;#EndFini!$eval;#EndFini!$eal;#EEndFin!$eal;;##nddFin!$ea;;###nddF +in!$ee __DATA__ 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000110000000110000000000000000011100000000000000000 000000000001110000001110000000000000000111110000000000000000 000000000011110000011110000000000000001111111000000000000000 000000000011110000011110000000000000001111110000000000000000 000000000011110000011110000000000000001111100000000000000000 000001111111111111111111111110000000001111100000000000000000 000011111111111111111111111100000000000111100000000000000000 000111111111111111111111111000000000000111100000000000000000 000000000011110000011110000000000000000111100000000000000000 000000000011110000011110000000000000000111100000000000000000 000000000011110000011110000000000000000111100000000000000000 000000000011110000011110000000000000000011100000000000000000 000001111111111111111111111110000000000011100000000000000000 000011111111111111111111111100000000000011100000000000000000 000111111111111111111111111000000000000001100000000000000000 000000000011110000011110000000000000000001100000000000000000 000000000011110000011110000000000000000001100000000000000000 000000000011110000011110000000000000000000000000000000000000 000000000011100000011100000000000000000000000000000000000000 000000000011000000011000000000000000000011110000000000000000 000000000000000000000000000000000000000111111000000000000000 000000000000000000000000000000000000000111110000000000000000 000000000000000000000000000000000000000011110000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000
    It works at least once, I didn't have the courage to go further down the chain :D

    Edit: oh, the Camel image would still be kinda broken (at least shifted on line 14 and below). I'll leave the correction as an exercise to the reader

Re: challenge: Perl's art restauration
by Eily (Prior) on Mar 06, 2018 at 14:39 UTC

    Edit: there was an issue with a split in void context (it would write the output to @_ before v5.12, and warn after), but fixing that creates code that does run, but generates invalid code. So this is only a partial fix. My original post is below, with the code that doesn't quite work. FYI, I saw the issue thanks to Toodles' explanation

      merci Eily++!

      the camel is not that broken (well a small hole in the neck..) and that ss can be also removed without damage, well ;ss can be removed too.

      I read the explanation but i overlooked the split in void context.


      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

        ss can be also removed without damage
        Yes I know, but since I was expecting the whole line of the image to be slightly shifted to the right, and therefore broken on that line, I didn't mind having my change so obvious. Besides at first I didn't give any explanation so I thought leaving a clue would be nice. oiskuu pointed out on the CB (thanks by the way!) that the generated code didn't run though

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2018-12-09 23:25 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (46 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!