# 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-2003 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 # ---------------- # 04-JAN-2003 MGD use $ENV for CGI variables # 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 ($ENV{'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; } } my $imageName = $ENV{'PATH_TRANSLATED'}; if ($imageName eq "") { $imageName = "HT_ROOT:[000000]WASDHTTPD.GIF"; } CGIplus::fileStream ($imageName, "image/gif"); } #------------------------------------------------------------------------------