#!/usr/local/bin/perl ########################################################################### # Animate.cgi: Will coninuously put picture's to standered out for # # the httpd to dynamically scarf and send to the client. # # (ie: cheap mans animation!) # ########################################################################### # last modified: 3/16/95 (cshorb) # ########################################################################### ## User Configurable Variables ########################################################################### ## PictArray: An ordered array of filenames to display. @PictArray = ( "gifs/Golf1.gif", "gifs/Golf2.gif", "gifs/Golf3.gif", "gifs/Golf4.gif", "gifs/Golf5.gif", ); ## Delay: Delay in seconds between pictures $Delay = 3; ## Cycle: Variable that determines what to do at end of pictures ## 0 - exit, 1 - Coninuous loop $Cycle = 0; ########################################################################### ##### End of User Configurable Parameters! ###### ########################################################################### ## Define Constants ########################################################################### $BoundaryString = "--Boundary String--"; $HEADER = "Content-type: multipart/x-mixed-replace;boundary=$BoundaryString\n"; $STRING = "\n$BoundaryString\n"; $ENDSTRING = "\n$BoundaryString\n"; $CTSTRING = "Content-type: image/gif\n\n"; $NumPicts = @PictArray; ## DoIt ########################################################################### # Unbuffer the Output select(STDOUT); $| = 1; print $HEADER; print $STRING; $PictNum = 0; $Done = 0; while ( (!$Done) && ($NumPicts) ) { print $CTSTRING; open( PICTFILE, "< $PictArray[ $PictNum ]" ) || exit( 0 ); while ( ) { print; } close( PICTFILE ); print "$STRING"; $Done = ( ($PictNum == ($NumPicts-1)) && (!$Cycle) ); $PictNum = ( ++$PictNum % $NumPicts ); sleep( $Delay ); } ## while: ( (!$D)&&($NP) ) exit(0);