Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 40 lines (38 sloc) 0.987 kb
4e1dbe89 » ltoetsch
2001-03-01 [lcd4linux @ 2001-03-01 15:11:30 by ltoetsch]
1 #!/usr/bin/perl
2
3 use strict;
4 use vars qw ($file $DELAY);
5 ########## CONFIG
6 $file = "lcd4linux"; # .png is appended
7 $DELAY = 0; # delay in seconds
8 # if delay is zero, file is sent when modified.
9 #################
10
11 use CGI qw/:push -nph/;
12 $| = 1;
13 my ($mtime, $nmtime, $size, $nsize);
14 (undef, undef, undef, undef, undef, undef, undef, $size, undef,
15 $mtime) = stat "$file.png";
16 print multipart_init(-boundary=>'----------------here we go!');
17 while (1) {
18 print multipart_start(-type=>'image/png');
19 undef $/;
20 open(IN, "$file.png") or die("Can't read '$file.png'");
21 $_ = <IN>;
22 print $_;
23 close(IN);
24 print multipart_end;
25 if ($DELAY) {
26 sleep $DELAY;
27 }
28 else {
29 W: while (1) {
30 # sleep(1);
31 (undef, undef, undef, undef, undef, undef, undef, $nsize, undef,
32 $nmtime) = stat "$file.png";
33 if($mtime != $nmtime || $size != $nsize) {
34 $mtime = $nmtime;
35 $size = $nsize;
36 last W;
37 }
38 }
39 }
40 }
41
Something went wrong with that request. Please try again.