[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] CGI Script FYIs



Huh.  The CGI Script extension puts in a content-type of text/html unless a content-type is supplied.  Weird.  Good, I guess.

I found out how to change the time that a CGI Script stays open.  You can set it anywhere from hexadecimal 01 to 7F minutes (1 - 127).  Open up the CGI Script (after it has been saved) in ResEdit and edit the "time" resource.  Open ID 128 and change the hexademical "05" to any value between the range above.  Anything less (00) or more (80-FF) apparently makes it stay open until closed manually.

Of course, opening and saving the CGI in MacPerl resets it to 05.  You could make a droplet, however, to change the resource with Mac::Resources (or maybe I'll make the droplet for you :-):

#!perl -w
use Mac::Resources;
use Mac::Memory;
use Mac::Types;

my $min = MacPerl::Ask(
  'How many minutes for the CGIs? (1-127, 0 for indefinite)',5,
);
$min = substr(MacPack('long',$min),3,1);
foreach my $file (@ARGV) {
  if (defined OpenResFile($file)) {
    my $id = Get1Resource('time', 128);
    if (defined $id) {
      $id->set(0,1,$min);
      ChangedResource($id);
      UpdateResFile(CurResFile());
    } else {warn $^E}
    CloseResFile(CurResFile());
  } else {warn $^E}
}
__END__

This should work just fine.  Let me know how it works, tho.

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    MacPerl: Power and Ease                     ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch