Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Stamp_Guy's scratchpad

by Stamp_Guy (Monk)
on Jun 01, 2004 at 21:50 UTC ( #358647=scratchpad: print w/ replies, xml ) Need Help??

#!/usr/bin/perl -w use strict; use CGI qw(:standard); my $query = new CGI; use CGI::Carp qw(fatalsToBrowser); ##################################################################### # DESCRIPTION ##################################################################### # The purpose of this script is to provide a simple way to switch # between the French and English versions of a website. In order to # function properly, the script requires that a standard naming # convention be used on both the French and English versions of the # website. ##################################################################### # CONFIGURATION ##################################################################### my %OPTIONS = ( en_extension => '_e', fr_extension => '_f', en_directory => 'en', fr_directory => 'fr', ); ##################################################################### # PLEASE DO NOT MODIFY ANYTHING BELOW THIS LINE ##################################################################### # Switch to English or French? my $lang = $query->param('lang'); # The http address of the page calling this script my $referrer = $query->referer; # Initialize the $final_url variable my $final_url = "$referrer"; # Change the $final_url variable as per instructions stored in the # $lang variable if ($lang eq "en") { $final_url =~ s/$OPTIONS{'fr_directory'}/$OPTIONS{'en_directory'}/ +i; $final_url =~ s/$OPTIONS{'fr_extension'}\.html/$OPTIONS{'en_extens +ion'}\.html/i; } elsif ($lang eq "fr") { $final_url =~ s/$OPTIONS{'en_directory'}/$OPTIONS{'fr_directory'}/ +i; $final_url =~ s/$OPTIONS{en_extension}\.html/$OPTIONS{fr_extension +}\.html/i; } # Go to the page requested print $query->redirect("$final_url");
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2014-07-26 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls