#!/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 = ( "harpsicord.200k.gif", "harpsicord.355k.gif", "harpsicord.633k.gif", "harpsicord.2000k.gif", "harpsicord.3556k.gif", "harpsicord.6330k.gif", "harpsicord.11247k.gif", "harpsicord.20000k.gif" ); ## Delay: Delay in seconds between pictures $Delay = 1; ## Cycle: Variable that determines what to do at end of pictures ## 0 - exit, 1 - Coninuous loop $Cycle = 1; ########################################################################### ##### 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);