This is a script meant for CGI use. You need the GD package installed in order to use this. Simply call the script in a browser and it gives you the current time as supplied by the server. Works with strict, but warnings are disabled because of uninitialized values as well as one depreceated variable :) Time returned in 12 hour format (A.M./P.M.)
#!/usr/bin/perl -T
use strict;
use GD;@_[2..3,1,rand
(1)]=((localtime)[$*++,
,1..1+1],"A.M."); $_[1]-=
12and$_[$| ]="P.M." unless$_[
rand( 1)+1]<12;$_[1]||= 12;push@_
,sprintf("%02d:%02d:%02d %s",@_[$ *
,3,2,$[]);sub _{print"Content-type: "
,$,,"image/png\n",,,$,,,$',,$_,,,''.'
';binmode STDOUT;print $_[5]->png;}$_
[5]=new GD::Image(9*length$_[4], 2*
2*2*2);$_[6]=$_[5]->colorAllocate
($|,$%,$|);$_[5]->transparent($_[
6]);$_[6]=$_[5]->colorAllocate
($ |, $%, 255 );$ _[ 5]
->string (gdGiantFont
,$|,$%,@_[4,5]);&_;
In reply to CGI Clock
by mt2k
-
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.