include different files at run time

R

rzhu

Hi, Guys

I'm a newbie in Perl, and I have this question for web development. To
support different languages, I'm planning to extract all the text
strings from the perl CGI code, and define them in different hashes in
separate file. The idea is that at run time, depending on which
language user select, I can load proper file, hence the proper hash
for that language. Drop those strings into a static template HTML file
(also grouped in different directories for different language). The
ultimate goal is that to add support for a new language, I just have
to create a new file, translate all strings in that hash, stick it
into a new directory, and I'm done. No code mod needed.

The question is, how do I do this in perl? It seems there is not a
perl equivalent of ASP "include". Can anyone help?

Thanks in advance.


R. Zhu
 
A

Anno Siegel

rzhu said:
Hi, Guys

I'm a newbie in Perl, and I have this question for web development. To
support different languages, I'm planning to extract all the text
strings from the perl CGI code, and define them in different hashes in
separate file. The idea is that at run time, depending on which
language user select, I can load proper file, hence the proper hash
for that language. Drop those strings into a static template HTML file
(also grouped in different directories for different language). The
ultimate goal is that to add support for a new language, I just have
to create a new file, translate all strings in that hash, stick it
into a new directory, and I'm done. No code mod needed.

The question is, how do I do this in perl? It seems there is not a
perl equivalent of ASP "include". Can anyone help?

I don't know what ASP "include" does.

Look at Perl's "use", "require", etc.

Anno
 
T

Tore Aursand

To support different languages, I'm planning to extract all the text
strings from the perl CGI code, and define them in different hashes in
separate file.

There are modules which helps you with this. Take a look at the Locale::*
modules, specifically Locale::Maketext. Be sure to read the documentation
before you dive into it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top