# CGIplusPM_example3.pl
#
# Simple example that demonstrates sending the contents of a file as binary.
# Also see CGIplusPM_example2.pl which demonstrates the low level requirements.
# May be invoked using either /cgi-bin/cpipluspm_example3 for standard CGI
# environment or using /CGIplus-bin/cpipluspm_example3 for CGIplus environment.
#
# COPYRIGHT
# ---------
# Copyright (c) 2000 Mark G.Daniel
# This program, comes with ABSOLUTELY NO WARRANTY.
# This is free software, and you are welcome to redistribute it
# under the conditions of the GNU GENERAL PUBLIC LICENSE, version 2.
# 
# VERSION HISTORY
# ----------------
# 31-MAY-2000  MGD  initial
#------------------------------------------------------------------------------

require "HT_ROOT:[SRC.PERL]CGIplus.PM";

# pass the reference of the example function to the CGIplus processor
CGIplus::process(\&exampleScript);

#------------------------------------------------------------------------------
# all the work is done in this function

sub exampleScript
{
   if (CGIplus::isCGIplus())
   {
      if (CGIplus::var("QUERY_STRING") eq "eoj")
      {
         printf ("Content-Type: text/plain
Expires: Fri, 13 Jan 1978 14:00:00 GMT

Bye! (after %d requests)
", CGIplus::usageCount());
         exit;
      }
   }

   $imageName = CGIplus::var("PATH_TRANSLATED");
   if ($imageName eq "") {
      $imageName = "HT_ROOT:[000000]WASDHTTPD.GIF";
   }
   CGIplus::fileStream ($imageName, "image/gif");
}

#------------------------------------------------------------------------------

