diff options
author | ltoetsch <> | 2001-03-01 15:11:30 +0000 |
---|---|---|
committer | ltoetsch <> | 2001-03-01 15:11:30 +0000 |
commit | 5eaeb9d424feab2829ba1d5b80c917f7d959d71a (patch) | |
tree | 0f39e041e461437ed275db79c913d668af9026bd /nph-png | |
parent | 0b05ba6a90ba10d55143565c510dbf09685b22a5 (diff) | |
download | lcd4linux-5eaeb9d424feab2829ba1d5b80c917f7d959d71a.tar.gz |
[lcd4linux @ 2001-03-01 15:11:30 by ltoetsch]
added PNG,Webinterface
Diffstat (limited to '')
-rwxr-xr-x | nph-png | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#!/usr/bin/perl + +use strict; +use vars qw ($file $DELAY); +########## CONFIG + $file = "lcd4linux"; # .png is appended + $DELAY = 0; # delay in seconds + # if delay is zero, file is sent when modified. +################# + +use CGI qw/:push -nph/; +$| = 1; +my ($mtime, $nmtime, $size, $nsize); +(undef, undef, undef, undef, undef, undef, undef, $size, undef, + $mtime) = stat "$file.png"; +print multipart_init(-boundary=>'----------------here we go!'); +while (1) { + print multipart_start(-type=>'image/png'); + undef $/; + open(IN, "$file.png") or die("Can't read '$file.png'"); + $_ = <IN>; + print $_; + close(IN); + print multipart_end; + if ($DELAY) { + sleep $DELAY; + } + else { + W: while (1) { + # sleep(1); + (undef, undef, undef, undef, undef, undef, undef, $nsize, undef, + $nmtime) = stat "$file.png"; + if($mtime != $nmtime || $size != $nsize) { + $mtime = $nmtime; + $size = $nsize; + last W; + } + } + } +} + |