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

Re: [MacPerl] Browser Redirect based upon OS



At 23.00 +0100 98-11-24, Kevin Diffily wrote:
>I have been searching all of the major and obscure CGI lists in vain for a
>browser redirection based upon someones Operating System.  Since I am new
>to Perl I do not feel confident enough to try this from scratch.  Does
>anyone have any scripts and or ideas.  They will be greatly appreciated.

Perl stores the name of the OS in the $^O variable. You'll just have to
check that to know.

#!perl

$^O =~ /Win/ and $location = 'windows/index.html';
$^O =~ /Mac/ and $location = 'macos/index.html';
$location ||= 'unix/index.html';
print "Location: $location\n\n";

__END__

... or something like that.


___Carl_Johan_Berglund_________________________
   Adverb Information
   carl.johan.berglund@adverb.se
   http://www.adverb.se/



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