Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
I'd like to offer up a small conversion to make this web-based. I'm not sure how well it would perform on a low bandwidth connection, but running off my local web server it works quickly enough to completely refresh and complete the request every second. Good stuff, ++hiseldl!
#!perl $|=1; $w = 25; $h = 25; $img="."x($w*$h-1); substr($img,11*$w+12,1,"#"); # in the middle $,="\n"; @hour=split//,"Just"; @min =split//,"another"; @sec =split//,"Perl hacker"; print "Content-type: text/html\n\n"; print "<pre>"; @t = localtime; $_=$img; for $hidx(0..3) { $newx=newx($t[2]%12*30+180,0,2+$hidx)+12; $newy=newy($t[2]%12*30+180,0,2+$hidx)+11; $vx = sprintf("%d", $newx); $vy = sprintf("%d", $newy); substr($_,$vy*$w+$vx,1,$hour[$hidx]); } for $midx(0..$#min) { $newx=newx($t[1]*6,0,-4-$midx)+12; $newy=newy($t[1]*6,0,-4-$midx)+11; $vx = sprintf("%d", $newx); $vy = sprintf("%d", $newy); substr($_,$vy*$w+$vx,1,$min[$midx]); } for $sidx(0..$#sec) { $newx=newx($t[0]*6,0,-1-$sidx)+12; $newy=newy($t[0]*6,0,-1-$sidx)+11; $vx = sprintf("%d", $newx); $vy = sprintf("%d", $newy); substr($_,$vy*$w+$vx,1,$sec[$sidx]); } print (/.{$w}/g),scalar localtime; print '<meta http-equiv="refresh" content="1;url=">'; sub newx { my($ang,$x,$y) = @_; my $a=$ang * atan2(1,1)/45;# angle in radians return ($x)*cos($a) - ($y)*sin($a); } sub newy { my($ang,$x,$y) = @_; my $a=$ang * atan2(1,1)/45;# angle in radians return ($x)*sin($a) + ($y)*cos($a); } exit 0;

In reply to Re: Camel Time by Theseus
in thread Camel Time by hiseldl

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.