All pastes #974706 Raw Edit

Something

public text v1 · immutable
·published 2008-04-06 23:44 UTC
rendered paste body
#!/usr/pkg/bin/perl
# Patenttiosasto asentaa<tm>

use Time::Local;

sub lz {
  my $an=$_[0];
  if (length($an)==1) {  
    $an="0".$an;
  }
  return $an;
}

sub headeri {
  print "Content-type: text/html\n\n";
}

sub sisalto {
  $oikea=&lz($hour).":".&lz($min);
  if (($min==4) and ($hour==23)) {
    $status='<h1>It <span style="color: #00FF00;">IS</span> 23:04!</h1>';
  } else {
    $status='<h1>It is <span style="color: #FF0000;">NOT</span> 23:04!</h1>';
  }

  print <<END;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Is it 23:04?</title>
  </head>
  <body bgcolor="#FFFFFF">

    <table border="0" height="100%" width="100%">
      <tr align="center" valign="middle">
        <td>

          <table border="0" cellspacing="0" cellpadding="0" align="center">
          <tr>
            <td height="100%">
              <center><img src="kello.png" alt="23:04"><br>
              $status</center>
              <!-- It's actually $oikea. -->
            </td>
          </tr>
          </table>
        </td>
      </tr>
    </table>

  </body>
</html>
END
}

# Ja sitten pistetään sivu läjään...
($sec, $min, $hour, $mday, $mon, $year, $wday)=(localtime(time))[0..6];
headeri;
sisalto;