[25855] in Perl-Users-Digest
Perl-Users Digest, Issue: 8090 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 18 03:05:43 2005
Date: Wed, 18 May 2005 00:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 18 May 2005 Volume: 10 Number: 8090
Today's topics:
Clean out accents in French names <pln@razzle.Stanford.EDU>
Re: Clean out accents in French names <john@castleamber.com>
Re: Clean out accents in French names <jurgenex@hotmail.com>
Re: Clean out accents in French names <noreply@gunnar.cc>
Re: Permuting using any number of given chars (Anno Siegel)
Re: shutdown.al reported missing <sisyphus1@nomail.afraid.org>
test if statement from database <efbo@hotmail.com>
Re: test if statement from database <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 May 2005 22:44:13 +0000 (UTC)
From: "Patrick L. Nolan" <pln@razzle.Stanford.EDU>
Subject: Clean out accents in French names
Message-Id: <d6ds3t$b8q$1@news.Stanford.EDU>
I have a script that takes information, including people's
names, and builds an XML file. I just found that the
application that reads the XML is fussy about characters.
It choked on the name "Jean-Paul le Fevre", where there
was an accent over the first e in Fevre. I don't know
how to type that on this keyboard. I edited the file
by hand, changing that character to a plain "e", and
all was OK. By the way, this isn't Unicode, it's just
extended ASCII.
I think I know how to identify "non-printing" characters
like that, but I would like to translate each one to
its nearest equivalent in the basic ASCII character
set. Thus the various e's with acute, grave and
circumflex accents would all go to "e", and so forth.
Has this problem been solved?
--
* Patrick L. Nolan *
* W. W. Hansen Experimental Physics Laboratory (HEPL) *
* Stanford University *
------------------------------
Date: 17 May 2005 23:30:38 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Clean out accents in French names
Message-Id: <Xns9659BC4EE3E3Acastleamber@130.133.1.4>
Patrick L. Nolan wrote:
> I have a script that takes information, including people's
> names, and builds an XML file. I just found that the
> application that reads the XML is fussy about characters.
Then use something like:
<?xml version="1.0" encoding="ISO-8859-1"?>
^^^^^^^^^^
> Has this problem been solved?
Specify an encoding, and there shouldn't be any problem.
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Wed, 18 May 2005 00:04:52 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Clean out accents in French names
Message-Id: <EEvie.178$cd.150@trnddc01>
Patrick L. Nolan wrote:
> I have a script that takes information, including people's
> names, and builds an XML file. I just found that the
> application that reads the XML is fussy about characters.
> It choked on the name "Jean-Paul le Fevre", where there
> was an accent over the first e in Fevre. I don't know
> how to type that on this keyboard. I edited the file
> by hand, changing that character to a plain "e", and
> all was OK. By the way, this isn't Unicode, it's just
> extended ASCII.
Well, did you set the encoding attribute in the XML file explicitely to
ISO-8859-1 or ANSI-1252 or to whatever you mean with "extended ASCII"?
If not then the file would contain "extended ASCII" but the other
application would try to read UTF-8, because that's the default for XML if
nothing contrary is specified. Of course that's going to cause trouble.
> I think I know how to identify "non-printing" characters
> like that, but I would like to translate each one to
> its nearest equivalent in the basic ASCII character
> set. Thus the various e's with acute, grave and
> circumflex accents would all go to "e", and so forth.
Not a good idea. I for one am particular about my first name. It's Jürgen,
not Jurgen (which isn't any name at all).
And as has been discussed many times just removing the accents etc.
transforms e.g. "to sleep" (?) into "whore" in Swedish.
> Has this problem been solved?
Often. Just use the proper encoding. Luckily XML was designed with support
for non-English characters in mind.
jue
------------------------------
Date: Wed, 18 May 2005 02:22:40 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Clean out accents in French names
Message-Id: <3evgdvF58uvoU1@individual.net>
Jürgen Exner wrote:
> And as has been discussed many times just removing the accents etc.
> transforms e.g. "to sleep" (?) into "whore" in Swedish.
The Swedish for "hear" is "höra",
Guess you mean "to hear". The Swedish for "hear" is "höra", and removing
those dots changes the meaning as you say. :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 17 May 2005 22:21:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Permuting using any number of given chars
Message-Id: <d6dqpl$lag$1@mamenchi.zrz.TU-Berlin.DE>
Brian Wakem <no@email.com> wrote in comp.lang.perl.misc:
> I can use Algorithm::Permute to output all permutations of 1 2 3
>
> 123
> 132
> 312
> 213
> 231
> 321
>
>
> But what I'm looking for is all possible permutations using any number of
> the input chars.
>
> Like this -
>
> 1
> 2
> 3
> 12
> 13
> 21
> 23
> 31
> 32
> 123
> 132
> 312
> 213
> 231
> 321
>
>
> I can't think of a way right now and I can't find a module that does it.
Split the problem. You know how to get all permutations for a given
set. So find all subsets of the input characters ('', '3', '2', '23', '1',
'13', '12', '123') and apply your solution to each.
for ( subsets( '123') ) {
print_permutations( $_);
}
The definition of subsets() is left as an exercise in recursion.
Anno
------------------------------
Date: Wed, 18 May 2005 13:38:49 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: shutdown.al reported missing
Message-Id: <428ab8c9$0$5177$afc38c87@news.optusnet.com.au>
"Frederik Vanrenterghem" <frederik_BCOL@vanrenterghem.biz> wrote in message
news:pan.2005.05.17.19.04.22.267633@vanrenterghem.biz...
> I ran into a problem with a program gsr.pl on my iPAQ that has a (likely
> somewhat broken) perl 5.8.4 from Familiar Linux 0.8.2. It's likely
> broken because I've had to manually add a lot of modules, some of
> which had to be compiled on the handheld. There things might have
> gone somewhat south... Anyway, the error is as follows:
>
> Can't locate
> auto/Net/SMTP/Server/Client/shutdown.al in @INC (@INC contains:
> /usr/lib/perl5/5.8.4/arm-linux /usr/lib/perl5/5.8.4
> /usr/lib/perl5/site_perl/5.8.4/arm-linux /usr/lib/perl5/site_perl/5.8.4
> /usr/lib/perl5/site_perl .) at /home/root/GSR_0.8.0/gsr.pl line 456
>
> That section of the script is as follows:
> 445 sub dienice {
> 446 my ($txt) = @_;
> 447
> 448 if ( $daemon >= 1 ) {
> 449 syslog('info', $txt);
> 450 syslog('info',"Aborting");
> 451 }
> 452 else {
> 453 printf("\n$txt\n");
> 454 printf("Aborting\n\n");
> 455 }
> 456 if ($client) {$client->shutdown;}
> 457 exit 1;
> 458 }
>
$client is a Net/SMTP/Server/Client.pm object - and you have called the
'shutdown' method on that object. But Net/SMTP/Server/Client.pm defines no
such method - so perl looks for it in the above '.al' file, can't find it,
and complains about that.
I couldn't find anything in the source that makes me think that
'$client->shutdown;' ought to do anything other than produce that error
(assuming $client is a Net/SMTP/Server/Client.pm object). Let us know if I
missed something :-)
Cheers,
Rob
------------------------------
Date: 18 May 2005 00:02:06 GMT
From: ef <efbo@hotmail.com>
Subject: test if statement from database
Message-Id: <Xns965A125B473C9efbo@195.121.6.67>
Hi,
I have an compare statement stored in the database. e.g. 'fieldx > 10'.
I read that and want to use that directly in a perl statement, something
like
$iffromdatabase =~ s/fieldx/realvalueoffieldx/;
if ( /$iffromdatabase/e ){
.....
}
can this be done somehow?
Bo.
------------------------------
Date: Wed, 18 May 2005 02:37:43 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: test if statement from database
Message-Id: <3evhakF58hvnU1@individual.net>
ef wrote:
> I have an compare statement stored in the database. e.g. 'fieldx > 10'.
> I read that and want
Did you read *why* you want it?
> to use that directly in a perl statement, something like
>
> $iffromdatabase =~ s/fieldx/realvalueoffieldx/;
> if ( /$iffromdatabase/e ){
> .....
> }
>
> can this be done somehow?
Yes. Check e.g.
perldoc -q "expand variables"
perldoc -f eval
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 8090
***************************************