[15783] in Perl-Users-Digest
Perl-Users Digest, Issue: 3196 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 29 14:10:34 2000
Date: Mon, 29 May 2000 11:10:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959623822-v9-i3196@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 29 May 2000 Volume: 9 Number: 3196
Today's topics:
Pod::Tree 1.02 released (Steven W McDougall)
Question: Fileupload using cgi-lib.pl <mmlai@sfu.ca>
runtime errors - Q how to do this <100115.1010@CompuServe.COM>
Re: runtime errors - Q how to do this <tony_curtis32@yahoo.com>
Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
Re: seeking method to encode email addresses in web pag <elaine@chaos.wustl.edu>
Simple Perl syntax question <owen.sullivan@worldzap.com>
Re: Simple Perl syntax question <aqumsieh@hyperchip.com>
Re: Simple Perl syntax question (Colin Watson)
Re: Simple Perl syntax question excalibor@my-deja.com
Re: Simple Perl syntax question <andkaha@my-deja.com>
Re: Simple Perl syntax question <iltzu@sci.invalid>
Simple Question <gpfan@ptdprolog.net>
Re: Simple Question (Neil Kandalgaonkar)
Re: Simple Question <james@208.23.123.242>
Re: Simple Question <tony_curtis32@yahoo.com>
Re: Simple Question <ak@dasburo.de>
some inbuilt function in perl!! <arun67@yahoo.com>
Re: some inbuilt function in perl!! <aqumsieh@hyperchip.com>
Re: some inbuilt function in perl!! (Colin Watson)
Sorry - I thought it was on topic <mee@cardgirl.com>
thank yon Philip,but.... <huxh@990.net>
Re: thank you Phlip but.... <huxh@990.net>
Re: Translate foreign characters to English <flavell@mail.cern.ch>
Re: Translate foreign characters to English (Villy Kruse)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 28 May 2000 21:53:42 GMT
From: world!swmcd@uunet.uu.net (Steven W McDougall)
Subject: Pod::Tree 1.02 released
Message-Id: <abvY4.5385$v7.490880@news-west.usenetserver.com>
Pod::Tree 1.02 is released to CPAN.
>From the README file
Pod::Tree - Tree-based POD parser
Modules
Pod::Tree parses a POD into a static syntax tree.
Applications walk the tree to recover the structure and content of
the POD.
Pod::Tree::HTML walks a Pod::Tree and translates it to HTML.
Pod::Tree::Perl* translate the Perl PODs to HTML.
Executables
pod2html translates a POD file to an HTML file.
pods2html walks a directory tree,
translates all the PODs that it finds into HTML files,
and puts the HTML files into a parallel directory tree.
perl2html translates the Perl PODs to HTML
>From the Changes file
1.02 2000 May 19
Pod::Tree::Node
- added support for x<<>> style markups
Pod::Tree::PerlFunc
- added <dl></dl> tags to lists in perlfunc.pod sub-pages
- sort function names within alphabetical index paragraphs
Pod::Tree::PerlLib
- scan for .pod files under @INC
- added stop_file list
Pod::Tree::PerlPod
- don't convert PODs under /ext/
------------------------------
Date: 29 May 2000 17:46:49 GMT
From: Murvin Ming-Wai Lai <mmlai@sfu.ca>
Subject: Question: Fileupload using cgi-lib.pl
Message-Id: <8guae9$g0r$1@morgoth.sfu.ca>
Hi all,
I'm using the cgi-lib.pl to upload a file to the server. I know that
after I call &ReadParse, the variable name from the form will be stored in
the array %in.
For example, in the form, I have:
<INPUT type=file name=myfile>
and I upload the file "abc.txt" from client side, then $in{'myfile'} will
return the contents of the abc.txt . e.g.
$key equals: "myfile"
$in{$key} equals: "a b c d e f g ..." (whatever the content is)
However, I would like to know which variable I should look for to give me
the Name fo the file, i.e "abc.txt", using the cgi-lib.pl
Is there exist any variable in cgi-lib.pl that can provide me this piece
of information? or I have to edit the cgi-lib.pl to do this job?
In addition, I know, in cgi.pm, I can do this job for me. HOwever, I have
problem using cgi.pm --> I can't retrieve anything from param(). That's
why I try to use cig-lib.pl to do the job for me. Also, I know that in
cgi.pm, I can use "$tempfile = tmpFileName()" to get the temporary file
name + path for me. How can I store data using $tempfile? is it a
handler? ALso, How can I do this in cgi-lib.pl?
Thank you for the help. =)
--
.........................................................................
*>>>>Murvin Lai<<<< >>>>--Muffin--<<<< email: murvin_lai@sfu.ca *
*homepage: http://www.sfu.ca/~mmlai mmlai@sfu.ca *
`````````````````````````````````````````````````````````````````````````
------------------------------
Date: 29 May 2000 17:52:01 GMT
From: Dick Nickalls dicknickallscompuservecom <100115.1010@CompuServe.COM>
Subject: runtime errors - Q how to do this
Message-Id: <8guao1$c8n$3@sshuraac-i-1.production.compuserve.com>
Q How can I trap runtime errors in PERL without using
eval() ??
I want to be able to pick up the $! errormessage,
but using something like the usual BASIC method as follows:
ON ERROR gosub errorhandler
..
..
SUB errorhandler
$error = $!
print <outputfile> "runtime error: ", $error
RETURN
So, what is the equivalent in PERL???
any help would be appreciated.
cheers,
Dick
--
Dick Nickalls
dicknickalls@compuserve.com
Department of Anaesthesia, City Hospital, Nottingham, UK.
------------------------------
Date: 29 May 2000 12:56:40 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: runtime errors - Q how to do this
Message-Id: <87puq55jfr.fsf@limey.hpcc.uh.edu>
>> On 29 May 2000 17:52:01 GMT,
>> Dick Nickalls dicknickallscompuservecom <100115.1010@CompuServe.COM> said:
> Q How can I trap runtime errors in PERL without using
> eval() ?? I want to be able to pick up the $!
> errormessage, but using something like the usual BASIC
> method as follows:
You use eval.
If you want to write it in BASIC, write it in BASIC.
If you want to write it in perl, write it in perl.
Use the appropriate paradigms for the language at hand.
"perldoc -f eval" has quite a lot of info.
Why would you want to avoid eval anyway?
hth
t
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Mon, 29 May 2000 08:29:51 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <39328CEF.8CBA55FE@stomp.stomp.tokyo>
Thorbjørn Ravn Andersen wrote:
> "Godzilla!" wrote:
> > year for an exceptionally busy site at
> > 274 hits per day. In 30 years, a 15 minute
> These guys ship out 40 million ads a day:
> http://valueclick.com/about.html
> Which code do you think they will use?
I believe valueclick has no need to
mung email addresses as is the topic
of this thread.
Do you have an example which is actually
related to this thread's topic? Might
be better if you start a new thread for
your off-topic post.
Godzilla!
------------------------------
Date: Mon, 29 May 2000 16:41:28 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <B55815F7.4FCE%elaine@chaos.wustl.edu>
in article 393243CC.486B8B8@bigfoot.com, Thorbjørn Ravn Andersen at
thunderbear@bigfoot.com quoth:
>> year for an exceptionally busy site at
>> 274 hits per day. In 30 years, a 15 minute
>
> These guys ship out 40 million ads a day:
> Which code do you think they will use?
That was such an obvious troll that even I laughed....
e.
------------------------------
Date: Mon, 29 May 2000 14:30:35 GMT
From: "Owen Sullivan" <owen.sullivan@worldzap.com>
Subject: Simple Perl syntax question
Message-Id: <favY4.195$QT5.20688@news.iol.ie>
I know this is a simple question, but I don't see the answer in the FAQ or
my Perl book.
$Titlesub1=param("Titlesub1");
$Titlesub2=param("Titlesub2");
$Titlesub3=param("Titlesub3");
for ($i = 1; $i < 4; $i++) {
print "Variable value: ${Titlesub}{$i}";
}
I do not know the correct syntax to achieve printing out the values for each
of the 3 variables mentioned above. The above code is incorrect, the values
do not print out. Does anybody know the correct syntax? Thanks.
------------------------------
Date: Mon, 29 May 2000 14:51:41 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Simple Perl syntax question
Message-Id: <7ar9al4dfn.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
"Owen Sullivan" <owen.sullivan@worldzap.com> writes:
> $Titlesub1=param("Titlesub1");
> $Titlesub2=param("Titlesub2");
> $Titlesub3=param("Titlesub3");
>
> for ($i = 1; $i < 4; $i++) {
> print "Variable value: ${Titlesub}{$i}";
> }
>
> I do not know the correct syntax to achieve printing out the values for each
> of the 3 variables mentioned above. The above code is incorrect, the values
> do not print out. Does anybody know the correct syntax? Thanks.
You are trying to use hard references, which are frowned upon in this
part of the computing world (unless you really know what you're
doing). Try using an array @Titlesub instead of a buch of variables:
$Titlesub[1] = param("Titlesub1");
$Titlesub[2] = param("Titlesub2");
$Titlesub[3] = param("Titlesub3");
or even:
for my $i (1 .. 3) {
$Titlesub[$i] = param("Titlesub$i");
}
Then you can access each of your variables using only the index:
for my $i (1 .. 3) {
print "Variable value: $Titlesub[$i].\n";
}
HTH,
--Ala
------------------------------
Date: 29 May 2000 15:02:08 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: Simple Perl syntax question
Message-Id: <8gu0pg$e45$1@riva.ucam.org>
Owen Sullivan <owen.sullivan@worldzap.com> wrote:
>I know this is a simple question, but I don't see the answer in the FAQ or
>my Perl book.
'perldoc perlref' is the place to look here.
>$Titlesub1=param("Titlesub1");
>$Titlesub2=param("Titlesub2");
>$Titlesub3=param("Titlesub3");
>
>for ($i = 1; $i < 4; $i++) {
> print "Variable value: ${Titlesub}{$i}";
> }
>
>I do not know the correct syntax to achieve printing out the values for each
>of the 3 variables mentioned above. The above code is incorrect, the values
>do not print out. Does anybody know the correct syntax? Thanks.
Try:
print "Variable value: ", ${"Titlesub$i"}, "\n";
Beware that you can't use these "symbolic references" with lexicals - so
if you'd used 'my $Titlesub1' above, as you would tend to do when
operating under 'use strict qw(vars)', then it wouldn't work.
Also note that a more Perl-idiomatic, and probably more readable, way to
write the above loop would be something like:
for my $i (1..3) {
...
}
... though if you're more comfortable with C-style syntax then there's
nothing wrong with sticking with that.
Is it possible to use an array instead? Normally, $Titlesub[1] etc. is
more immediately obvious, and I'd guess perhaps faster too, than
${'Titlesub1'}, and you don't have to operate under 'no strict qw(refs)'
to get that to work.
--
Colin Watson [cjw44@flatline.org.uk]
"This is the only networking technology
that earns frequent flyer miles." - RFC 2549
------------------------------
Date: Mon, 29 May 2000 15:31:12 GMT
From: excalibor@my-deja.com
Subject: Re: Simple Perl syntax question
Message-Id: <8gu2g0$i9b$1@nnrp1.deja.com>
In article <favY4.195$QT5.20688@news.iol.ie>,
"Owen Sullivan" <owen.sullivan@worldzap.com> wrote:
> I know this is a simple question, but I don't see the answer in the
FAQ or
> my Perl book.
>
> $Titlesub1=param("Titlesub1");
> $Titlesub2=param("Titlesub2");
> $Titlesub3=param("Titlesub3");
>
> for ($i = 1; $i < 4; $i++) {
> print "Variable value: ${Titlesub}{$i}";
> }
>
> I do not know the correct syntax to achieve printing out the values
for each
> of the 3 variables mentioned above. The above code is incorrect, the
values
> do not print out. Does anybody know the correct syntax? Thanks.
With your example:
for my $value ($Titlesub1, $Titlesub2, $Titlesub3) {
print "Variable value: $value\n";
}
But you'll probably want a hash variable in here instead of several
scalars:
my %Titlesub;
$Titlesub{1} = param("Titlesub1");
$Titlesub{2} = param("Titlesub2");
$Titlesub{3} = param("Titlesub3");
foreach my $i (sort keys %Titlesub) {
print "Variable value: $Titlesub{$i}\n";
}
or even:
foreach my $value (sort values %Titlesub) {
print "Variable value: $value\n";
}
What you wanted to do may work with an eval {} block somewhere, but I am
not certain about it...
Anyway I think the hash approach (or an equivalent @array if all keys
are gonna be numerical) is the Right Way of doing this...
best regards,
d@
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 29 May 2000 15:39:52 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: Simple Perl syntax question
Message-Id: <8gu306$ido$1@nnrp1.deja.com>
In article <favY4.195$QT5.20688@news.iol.ie>,
"Owen Sullivan" <owen.sullivan@worldzap.com> wrote:
> I know this is a simple question, but I don't see the answer in the
FAQ or
> my Perl book.
>
> $Titlesub1=param("Titlesub1");
> $Titlesub2=param("Titlesub2");
> $Titlesub3=param("Titlesub3");
>
> for ($i = 1; $i < 4; $i++) {
> print "Variable value: ${Titlesub}{$i}";
> }
>
> I do not know the correct syntax to achieve printing out the values
for each
> of the 3 variables mentioned above. The above code is incorrect, the
values
> do not print out. Does anybody know the correct syntax? Thanks.
>
>
Ugly:
for ($i = 1; $i < 4; $i++) {
print "Variable value: ", ${"Titlesub$i"} . "\n";
}
/A
--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk e-mail is reported to the
# appropriate authorities, no exceptions.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 29 May 2000 17:30:40 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Simple Perl syntax question
Message-Id: <959621406.24836@itz.pp.sci.fi>
In article <7ar9al4dfn.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>, Ala Qumsieh wrote:
>You are trying to use hard references, which are frowned upon in this
>part of the computing world (unless you really know what you're
>doing). Try using an array @Titlesub instead of a buch of variables:
s/hard/symbolic/, surely?
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: Mon, 29 May 2000 15:59:12 GMT
From: "Samuel Bressi" <gpfan@ptdprolog.net>
Subject: Simple Question
Message-Id: <ktwY4.1559$tr5.34803@nnrp1.ptd.net>
Hey everyone,
I am fairly new at writing in Perl, and I have a question, its a pretty easy
one.
I have an HTML form, say its located at register.htm and then I have it
pointing to a CGI script. How can I take a value in the form, and place it
in a variable, say its $email...
The form field name is 'email' and I want that to be used in my Perl script.
Any help would be appreciated.
------------------------------
Date: 29 May 2000 16:29:14 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Simple Question
Message-Id: <8gu5sq$hn6$1@newsflash.concordia.ca>
In article <ktwY4.1559$tr5.34803@nnrp1.ptd.net>,
Samuel Bressi <spudf@ptdprolog.net> wrote:
>I have an HTML form, say its located at register.htm and then I have it
>pointing to a CGI script. How can I take a value in the form, and place it
>in a variable, say its $email...
The CGI module is the easiest way to do this. See 'perldoc CGI' at the
command line, or check the documentation at any CPAN site, e.g.
search.cpan.org.
If this is too confusing, most introductory perl books cover CGI to
some extent. Or you can get "Lincoln Stein's Official Guide to CGI.pm".
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Mon, 29 May 2000 12:33:07 -0700
From: James Tolley <james@208.23.123.242>
Subject: Re: Simple Question
Message-Id: <3932C5F3.D7184562@208.23.123.242>
Samuel Bressi wrote:
>
> I have an HTML form, say its located at register.htm and then I have it
> pointing to a CGI script. How can I take a value in the form, and place it
> in a variable, say its $email...
#!/usr/bin/perl -wT
use strict;
use CGI q/:standard/;
my $email = param('email');
# etc...
Like that.
There are a lot of good FAQ's around that answer this kind of thing, and
more about beginning CGI scripting with Perl. Try perl.com, perl.org and
cpan.org.
hth,
James
------------------------------
Date: 29 May 2000 11:32:34 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Simple Question
Message-Id: <877lcdco65.fsf@limey.hpcc.uh.edu>
>> On Mon, 29 May 2000 15:59:12 GMT,
>> "Samuel Bressi" <gpfan@ptdprolog.net> said:
> Hey everyone, I am fairly new at writing in Perl, and I
> have a question, its a pretty easy one.
> I have an HTML form, say its located at register.htm and
> then I have it pointing to a CGI script. How can I take
> a value in the form, and place it in a variable, say its
> $email...
> The form field name is 'email' and I want that to be
> used in my Perl script.
use CGI qw(:standard);
my $email_addr = param('email');
"perldoc CGI" for the documentation.
hth
t
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Mon, 29 May 2000 18:33:01 +0200
From: Alexander Knack <ak@dasburo.de>
To: Samuel Bressi <spudf@ptdprolog.net>
Subject: Re: Simple Question
Message-Id: <39329BBD.5DFFEBA1@dasburo.de>
Samuel Bressi wrote:
>
> Hey everyone,
> I am fairly new at writing in Perl, and I have a question, its a pretty easy
> one.
>
> I have an HTML form, say its located at register.htm and then I have it
> pointing to a CGI script. How can I take a value in the form, and place it
> in a variable, say its $email...
>
> The form field name is 'email' and I want that to be used in my Perl script.
>
> Any help would be appreciated.
use strict;
use CGI ':standard';
print header(), start_html();
my $email = param ('email');
print $email;
print end_html();
perldoc CGI
--
+--------------------------------------------------------------------+
| Alexander Knack ........Entropie erfordert keine Wartung .........|
| dasburo.de ..................................................|
+--------------------------------------------------------------------+
------------------------------
Date: Mon, 29 May 2000 14:30:04 GMT
From: Arun Mahajan <arun67@yahoo.com>
Subject: some inbuilt function in perl!!
Message-Id: <sj4vnclj5pj23@corp.supernews.com>
hello everybody,
i am new to perl and just looking strangly when i find a in-built function
in some program. Is there anybody who could help me to find some site which
provides the list and description of these functions.
thanks in advance for the help.
regards
Arun
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Mon, 29 May 2000 14:45:58 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: some inbuilt function in perl!!
Message-Id: <7au2fh4dp6.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
Arun Mahajan <arun67@yahoo.com> writes:
> i am new to perl and just looking strangly when i find a in-built function
> in some program. Is there anybody who could help me to find some site which
> provides the list and description of these functions.
Check out:
http://www.perl.com/pub/v/documentation
Note that if you have Perl properly installed on your system, then you
can access all of the documentation from your hard drive. Type
perldoc perldoc
and go from there. Good luck.
--Ala
------------------------------
Date: 29 May 2000 14:48:36 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: some inbuilt function in perl!!
Message-Id: <8gu004$dm8$1@riva.ucam.org>
Arun Mahajan <arun67@yahoo.com> wrote:
>i am new to perl and just looking strangly when i find a in-built function
>in some program. Is there anybody who could help me to find some site which
>provides the list and description of these functions.
perldoc -f function-name
--
Colin Watson [cjw44@flatline.org.uk]
"Fly me to the moon, and let me play among the stars;
Let me see what spring is like on Jupiter and Mars" - Bart Howard
------------------------------
Date: Mon, 29 May 2000 15:08:07 GMT
From: "Bob Jones" <mee@cardgirl.com>
Subject: Sorry - I thought it was on topic
Message-Id: <rJvY4.6990$F22.293394@typhoon1.ba-dsg.net>
I thought it was on-topic to post this message to a Perl related newsgoup.
I have been informed that it is not. Therefore, in the interest of usenet,
please disregard my previous posting
(I'm a newbie. I know this is not particularly an excuse, but I thought I
would mention it anway. My intention was not to interfere with this
newsgroup's usefulness)
Bob Jones <mee@cardgirl.com> wrote in message
news:2avY4.6963$F22.293306@typhoon1.ba-dsg.net...
> I am looking to hire a Perl specialist to update a greeting card Perl CGI
> script. I need to add the ability to cc different addresses and to add
> "send on a certain date." I have Perl scripts that do this, but I don't
> have the technical skills to combine these different Perl scripts. If you
> are able (and have the time) to do this, please contact me and we can
> discuss the details including price. My e-mail is mee@cardgirl.com .
> Thanks a lot. (Our Web Site is www.cardgirl.com)
> Thank you,
> Bob Jones
>
>
------------------------------
Date: Mon, 29 May 2000 22:46:05 +0800
From: "´ô´ô¹Ï" <huxh@990.net>
Subject: thank yon Philip,but....
Message-Id: <8gu0bc$2ohk$1@news.cz.js.cn>
thank you philip:
that format is the last thing in the file,I run the file in Redhat
6.1+perl5.0,use perl scriptname,I put a blank lint after the final '.',but
the error massage still exist.please give me more advive ,thanks a lot .
dodo
------------------------------
Date: Mon, 29 May 2000 22:52:12 +0800
From: "´ô´ô¹Ï" <huxh@990.net>
Subject: Re: thank you Phlip but....
Message-Id: <8gu0mr$2or2$1@news.cz.js.cn>
thank you philip:
that format is the last thing in the file,I run the file in Redhat
6.1+perl5.0,use perl scriptname,I put a blank lint after the final '.',but
the error massage still exist.please give me more advive ,thanks a lot .
dodo
Philip 'Yes, that's my address' Newton <nospam.newton@gmx.li> wrote in
message news:39313765.381091627@news.nikoma.de...
> On Sun, 28 May 2000 21:27:05 +0800, "´ô´ô¹Ï" <huxh@990.net> wrote:
>
> > Source code:
> > .......
> > format STDOUT=
> > @<<<<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<
> > $filename,$name,$word
> > .
> > when I run it ,there are some error massage:
> > format not terminated at scriptname line 21 ,at the end of line
>
> Is that format maybe the last thing in the file? This seems to be a
> common problem on DOS/Windows systems if there is no line ending after
> the '.' that terminates the format. Put a blank line after the final '.'
> and it should work.
>
> Cheers,
> Philip
> --
> Philip Newton <nospam.newton@gmx.li>
> If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 29 May 2000 16:14:27 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Translate foreign characters to English
Message-Id: <Pine.GHP.4.21.0005291534250.12313-100000@hpplus01.cern.ch>
On Sun, 28 May 2000, Ben Hambidge wrote:
> I need to do a comparison to match words, but I want to be able to
> ignore diacritics on the letters.
Sounds as if you need a translation table.
> So if someone types into a web form a name or word including foreign
> (esp European) characters, I want to convert that string to the ASCII
This is a complex question. Until you understand the problem that
you're trying to solve, this has rather little relevance to the Perl
language, and much more to WWW protocols. Most people don't
understand it, so there's no shame there: I happen to understand the
theory, but haven't used it extensively in practice, so I personally
am relatively uninformed about practical shortcomings in the available
browsers.
> Is there any easy way to do this?
Once you understand the problem that you're trying to solve, the
solution is obvious. ;-}
> Do different codepages that the user
> may have on their browser make a difference?
If you need to ask that question, then it's hard. If you have reason
to believe that your users will be working in charsets other than
iso-8859-1, then you would benefit from a tutorial on character coding
issues on the WWW. (You might also need information on the
shortcomings that are present in currently-available browsers).
If you're serious in tackling that part of the problem, I'd suggest
first studying Jukka Korpela's tutorials on this and related topics,
and raising questions on the comp.infosystems.www.authoring.cgi group.
http://www.hut.fi/~jkorpela/chars.html
http://www.hut.fi/u/jkorpela/forms/methods.html
You'll certainly want to cross-reference the relevant parts of the
HTML4 specification at W3C.
Then again, you might get important caveats by looking at material
written by those who normally work in non-Latin-1 locales - and thus
might be expected to be more alert to the practical side of such
things. See, just for one example, the discussion of FORMs in koi8-r
(Russian Cyrillic) at http://koi8.pp.ru/main.html, specifically
http://koi8.pp.ru/htmlforms.html
The details of how you actually code it in Perl aren't so very
important, seeing that most of the time and effort is going to be
spent on other things. So if you find that you prefer multiple
substitutions s/// over a translation operator tr/// , then I don't
suppose anyone would really notice. But translation is always more
efficient when it's feasible.
good luck
------------------------------
Date: 29 May 2000 15:23:24 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Translate foreign characters to English
Message-Id: <slrn8j52rb.5fc.vek@pharmnl.ohout.pharmapartners.nl>
On Mon, 29 May 2000 09:12:36 GMT, Lou Hevly <lou@visca.com> wrote:
>Here's a subroutine that will do this; it also converts caps to small
>letters, so you may have to modify it if that isn't what you want:
>
Depending on the language in question you might need a different
translation than the one given below
The comon German substitutions are:
ä => ae
ö => oe
ü => ue
ß => ss
For exampel you might see the city name Köln spelled as Koeln
and München spelled as Muenchen.
Other languages uses different rules, and in some cases you can't
even make the change without changing the maning of the word.
>sub convert {
> my ($ascii, $uline) = @_;
> $ascii =~ tr/A-Z/a-z/;
> $ascii =~ s/æ|Æ/ae/g;
> $ascii =~ s/Á|Â|À|Å|Ã|Ä|á|â|à|å|ã|ä/a/g;
> $ascii =~ s/Ç|ç/c/g;
> $ascii =~ s/Ð|ð/d/g;
> $ascii =~ s/É|Ê|È|Ë|é|ê|è|ë/e/g;
> $ascii =~ s/Í|Î|Ì|Ï|í|î|ì|ï/i/g;
[ ... etc ]
--
Villy
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3196
**************************************