summaryrefslogtreecommitdiff
path: root/FS/FS/CGI.pm
diff options
context:
space:
mode:
authorivan <ivan>2002-09-23 14:27:28 +0000
committerivan <ivan>2002-09-23 14:27:28 +0000
commit536d684c3e17375d45a5d62bc5d748fec0224860 (patch)
tree77cf0d1f159f5d4261d4ec06fd40fdda4079f5a2 /FS/FS/CGI.pm
parentf95dffea25ebcdac0b6a4e0355a3c087ea28de0c (diff)
global.asa changes for profiling redirects
header-handling changes necessary for chart .cgis
Diffstat (limited to 'FS/FS/CGI.pm')
-rw-r--r--FS/FS/CGI.pm34
1 files changed, 33 insertions, 1 deletions
diff --git a/FS/FS/CGI.pm b/FS/FS/CGI.pm
index e44ebcc..d69aad2 100644
--- a/FS/FS/CGI.pm
+++ b/FS/FS/CGI.pm
@@ -10,7 +10,7 @@ use FS::UID;
@ISA = qw(Exporter);
@EXPORT_OK = qw(header menubar idiot eidiot popurl table itable ntable
- small_custview myexit);
+ small_custview myexit http_header);
=head1 NAME
@@ -68,6 +68,38 @@ END
$x;
}
+=item http_header
+
+Sets an http header.
+
+=cut
+
+sub http_header {
+ my ( $header, $value ) = @_;
+ if (exists $ENV{MOD_PERL}) {
+ if ( defined $main::Response
+ && $main::Response->isa('Apache::ASP::Response') ) { #Apache::ASP
+ if ( $header =~ /^Content-Type$/ ) {
+ $main::Response->{ContentType} = $value;
+ } else {
+ $main::Response->AddHeader( $header => $value );
+ }
+ } elsif ( defined $HTML::Mason::Commands::r ) { #Mason
+ ## is this the correct pacakge for $r ??? for 1.0x and 1.1x ?
+ if ( $header =~ /^Content-Type$/ ) {
+ $HTML::Mason::Commands::r->content_type($value);
+ } else {
+ $HTML::Mason::Commands::r->header_out( $header => $value );
+ }
+ } else {
+ die "http_header called in unknown environment";
+ }
+ } else {
+ die "http_header called not running under mod_perl";
+ }
+
+}
+
=item menubar ITEM, URL, ...
Returns an HTML menubar.