[21906] in Perl-Users-Digest
Perl-Users Digest, Issue: 4110 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 13 00:06:24 2002
Date: Tue, 12 Nov 2002 21:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 12 Nov 2002 Volume: 10 Number: 4110
Today's topics:
Re: About to tear my hair out here ... (Newbie Question <wsegrave@mindspring.com>
DBI Question (script included) <bobx@linuxmail.org>
Re: DBI Question (script included) <fxn@hashref.com>
Re: DBI Question (script included) <tk@WINDOZEdigiserv.net>
Re: DBI Question (script included) <jeff@vpservices.com>
Find perl modules in perl script (JZ)
Re: Global file search function? (Bryan Castillo)
Help the script doesn't work (Nick Richards)
Re: Help the script doesn't work <jurgenex@hotmail.com>
Re: Help the script doesn't work <bwalton@rochester.rr.com>
Re: Help with https and lwp <bwalton@rochester.rr.com>
Re: help with Win32::OLE MS Word <tednospam94107@yahoo.com>
Re: illegal use of comment ? <pkent77tea@yahoo.com.tea>
Re: illegal use of comment ? <pkent77tea@yahoo.com.tea>
Re: illegal use of comment ? <goldbb2@earthlink.net>
Re: newbie LWP redirect/cookie question <goldbb2@earthlink.net>
Re: perl daemon in windows memory hog ? <bowman@montana.com>
Re: Question on -B (Walter Roberson)
Re: Simple question - What is unicode? <pkent77tea@yahoo.com.tea>
Re: Simple question - What is unicode? <jurgenex@hotmail.com>
Re: some help with a print statement requested - double (ebchang)
Re: Try your hand at perl golf <goldbb2@earthlink.net>
Re: UTF8 counting first octet hi bits <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Nov 2002 22:23:36 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: About to tear my hair out here ... (Newbie Question)
Message-Id: <aqsk63$6t9$1@slb2.atl.mindspring.net>
"William Alexander Segraves" <wsegrave@mindspring.com> wrote in message
news:aqs2ig$1nr$1@slb5.atl.mindspring.net...
<snip>
> One advantage you'll find in favor of your use of CGI.pm is that you can
> test your code from the command line, query string, or a POST from a form,
<snip>
Clarification:
... from the command line, via a query string added to the URL, or a
submittal (POST or GET) from a form, ...
Bill Segraves
------------------------------
Date: Wed, 13 Nov 2002 02:17:01 GMT
From: "Bob X" <bobx@linuxmail.org>
Subject: DBI Question (script included)
Message-Id: <xCiA9.47907$Lg2.13827910@news2.news.adelphia.net>
Running the following:
#! /usr/bin/perl
# pragmas
use strict;
use warnings;
use DBI;
# datasource name
my $dsn = "DBI:mysql:contacts_db:localhost";
# user name
my $user_name = "bob";
# password
my $password = "bob";
# database and statement handles
my $dbh;
my $sth;
# array for rows
my @ary;
# connect to the database
$dbh = DBI->connect($dsn, $user_name, $password) or exit(1);
# issue query
$sth = $dbh->prepare("SELECT * FROM contact ORDER BY first_name");
$sth->execute();
# read results of query, then clean up
while(@ary = $sth->fetchrow_array()) {
print join("\t", @ary), "\n"; # <-- line 33 is here
}
$sth->finish();
# close the db and exit the script
$dbh->disconnect();
exit(0);
Get me this warning:
Use of uninitialized value in join or string at dbtest.pl line 33.
Use of uninitialized value in join or string at dbtest.pl line 33.
I have a MySQL db with one table and that one table has two records. The
script runs and produces the expected results.
Any thoughts?
Bob
------------------------------
Date: 13 Nov 2002 03:35:15 +0100
From: Xavier Noria <fxn@hashref.com>
Subject: Re: DBI Question (script included)
Message-Id: <87y97y42os.fsf@kodo.localdomain>
"Bob X" <bobx@linuxmail.org> writes:
: # issue query
: $sth = $dbh->prepare("SELECT * FROM contact ORDER BY first_name");
: $sth->execute();
:
: # read results of query, then clean up
: while(@ary = $sth->fetchrow_array()) {
: print join("\t", @ary), "\n"; # <-- line 33 is here
: }
: $sth->finish();
:
: # close the db and exit the script
: $dbh->disconnect();
: exit(0);
:
: Get me this warning:
:
: Use of uninitialized value in join or string at dbtest.pl line 33.
: Use of uninitialized value in join or string at dbtest.pl line 33.
:
: I have a MySQL db with one table and that one table has two records. The
: script runs and produces the expected results.
:
: Any thoughts?
My guess is that each row in the contact table has a NULL field and
therefore its corresponding element in @ary becomes undef. The warning
is printed because the call to join() concatenates those entries behind
the scenes.
-- fxn
------------------------------
Date: Wed, 13 Nov 2002 02:34:50 GMT
From: tk <tk@WINDOZEdigiserv.net>
Subject: Re: DBI Question (script included)
Message-Id: <cce3tug0eef9cq0bd5llj01b60a6qg2li9@4ax.com>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on Wed, 13 Nov 2002 02:17:01 GMT, "Bob X"
<bobx@linuxmail.org> managed to scribble:
[snip]
| # read results of query, then clean up
| while(@ary = $sth->fetchrow_array()) {
| print join("\t", @ary), "\n"; # <-- line 33 is here
| }
Have you tried...
while (@ary = $sth->fetchrow_array()) {
print $_ . "\n";
}
...?
The arrays are elements, not tab delimited, if I'm thinking clearly =)
Regards,
tk
-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3
iQA/AwUBPdG6iijNZg8h4REKEQK+QwCeKhoH1bEBZ1h0UCozXhoRJQ+4EXsAn0va
I0Aua5xHhrkVVx/qWiNrugfN
=R1Fl
-----END PGP SIGNATURE-----
--
+--------------------------+
| digiServ Network |
| Web solutions | Remove WINDOZE to reply.
| http://www.digiserv.net/ |
+--------------------------+
------------------------------
Date: Tue, 12 Nov 2002 18:53:57 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBI Question (script included)
Message-Id: <3DD1BEC5.1070905@vpservices.com>
Bob X wrote:
> use warnings;
In other words, you ask to be warned when values are uninitialized.
> while(@ary = $sth->fetchrow_array()) {
> print join("\t", @ary), "\n"; # <-- line 33 is here
> }
> Use of uninitialized value in join or string at dbtest.pl line 33.
In other words, perl does what you ask, and tells you when you have
uninitialized values (NULLs).
Do this instead, which changes the uninitialized NULLs into empty
strings. Empty strings are initialized even though they are empty.
while(my $row = $sth->fetch) {
print join("\t",map{defined $_ ? $_ : ''}@$row),"\n";
}
--
Jeff
------------------------------
Date: 12 Nov 2002 19:21:06 -0800
From: ibm_97@yahoo.com (JZ)
Subject: Find perl modules in perl script
Message-Id: <10bc841c.0211121921.7a43db17@posting.google.com>
Perl newbie.
How to find installed perl modules in system (Unix or Linux) by using Perl?
Thanks a lot.
------------------------------
Date: 12 Nov 2002 20:09:05 -0800
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: Global file search function?
Message-Id: <1bff1830.0211122009.3a602cff@posting.google.com>
> You've mentioned *NIX environments. What about Windoze itself? some
> people run NT as their servers, I haven't checked, but is locate ported
> to win32/dos too?
cygwin http://sources.redhat.com/cygwin/
^^^^^^
Some people have managed to run Gnome under windows with it.
>
> | There are very few programs that aren't portable, it's just that the
> | amount of work taken to port them may differ.
>
> True, but if you dont have to have millisecond results, would it not be
> easier to write portable code from the outset, instead of either having
> to modify the script (even moderately) for the second platform you wish
> to run it on, or have to copy/install a ported command to the platform
> you're working on?
It's not just millisecond results vs seconds results, we were talking
about recursively searching the whole entire filesystem, on some
systems (with lots and lots of files) this could be 30+ minutes.
Maybe its not as bad as it was years ago, but anybody who made the
mistake of find / -name "*.tgz" was liable to get their account
removed.
(I did this on an old dynix system years ago, there were over 50 disks
on the system and nfs mounts to 5+ remote servers, I returned 3 hours
later to see my shell still haning there with no output)
(Can you hear the spinning and grinding of disks?)
>
> _If_ the script happened to be a CGI script, running on a remote server
> (not owned/have root access by yourself), the possability of
> running/installing a command can cause possible issues, in that you'd
> have to convince the admin to install what you require. For those of us
> that run our own servers, maybe this isn't too big an issue, but for
> 3rd party "users" of servers, this could be quite an issue.
>
If you have CGI scripts that often and repeatedly search the whole
filesystem
(without caching), you will:
- probably have users that complain about your web pages
taking too long to load
- and probably have sysadmins flaming you and randomly
deleting your files
If you wanted to have portable perl and speed, you could do the
File::Find once a day or once a week and store the results in a flat
file, dbm file, DB, etc... Even if your searching does a sequential
scan of the data, you would be better off than constantly trashing
your/(or your sysadmin's) disks.
Don't get me wrong, File::Find is great, however I usually use it on
known subdirectories which don't go too deep.
------------------------------
Date: 12 Nov 2002 20:03:21 -0800
From: nick.richards@workventures.com.au (Nick Richards)
Subject: Help the script doesn't work
Message-Id: <3f9d2fc5.0211122003.40d0a8ae@posting.google.com>
This doesn't work I'm wanting to set the values of each element in
$replace[1] to the value of temp can anyone help?
open (TEMP,"/logs/web/tenants/temp.txt");
open (PROXYLOG, ">>/logs/web/tenants/winsmonth.txt");
@replace = <PROXYLOG>;
while(@replace = <PROXYLOG>){
$replace[1] = <TEMP>;
print @replace;
print PROXYLOG @replace;
}
close PROXYLOG;
close TEMP;
------------------------------
Date: Wed, 13 Nov 2002 04:26:48 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Help the script doesn't work
Message-Id: <cwkA9.12613$4N1.10919@nwrddc04.gnilink.net>
Nick Richards wrote:
> This doesn't work I'm wanting to set the values of each element in
> $replace[1] to the value of temp can anyone help?
No idea what you mean.
$replace[1] is only one element. What do you mean with each element in
$replace[1]?
temp doesn't appear anywhere in your code. Do you mean the file temp.txt?
>
> open (TEMP,"/logs/web/tenants/temp.txt");
> open (PROXYLOG, ">>/logs/web/tenants/winsmonth.txt");
> @replace = <PROXYLOG>;
This would read all lines from winsmonth.txt into the array @replace except
that the PROXYLOG is opened for append, not for reading.
You must have disabled warnings, otherwise perl should have warned you.
> while(@replace = <PROXYLOG>){
If <PROXYLOG> would have opened for reading then there would have been
nothing left to read here in the condition. The loop would have never
executed.
No idea what happens if you are trying to read from a write-only file.
Nothing good, I would presume.
> $replace[1] = <TEMP>;
This reads the next line from temp.txt into the second element of the array
@replace.
> print @replace;
And then prints the whole array
> print PROXYLOG @replace;
And again to PROXYLOG.
> }
> close PROXYLOG;
> close TEMP;
Sorry, I cannot figure out what you are actually trying to achive but maybe
my comments will give you some hint in the right direction.
jue
------------------------------
Date: Wed, 13 Nov 2002 04:37:03 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Help the script doesn't work
Message-Id: <3DD1D6E8.1020103@rochester.rr.com>
Nick Richards wrote:
> This doesn't work I'm wanting to set the values of each element in
> $replace[1] to the value of temp can anyone help?
"Doesn't work" is more than just a bit vague. What doesn't work, why do
you think it doesn't work, and what do you expect that it should do?
Does it generate an error message? If so, what exactly does it say?
But see below.
>
> open (TEMP,"/logs/web/tenants/temp.txt");
*Always* *always* check open's to see if they were successful or not.
If the file isn't actually opened, the rest of your program "won't
work". Use something like:
open TEMP,"filename" or die "Oops, $!";
> open (PROXYLOG, ">>/logs/web/tenants/winsmonth.txt");
You have opened winsmonth.txt for append, but below you try to read from
it. Won't work too well.
> @replace = <PROXYLOG>;
Above you read the entire contents of winsmonth.txt into array @replace
(that is, it would if winsmonth.txt were opened for read).
> while(@replace = <PROXYLOG>){
On the above line you now attempt to read winsmonth.txt again, but it is
already at end-of-file, so you get nothing, and the loop doesn't
execute. Plus I think you wanted to read the file a line at a time
here, which means it should have been
while($replace=<PROXYLOG>){
But since you have already read winsmonth.txt into @replace, you
probably actually want:
for (@replace){
in order to step through the file (now in array form) a line at a time.
> $replace[1] = <TEMP>;
This will read one line from temp.txt and put it into the second element
of @replace. Is that really what you want? And does temp.txt have at
least as many lines as winsmonth.txt does?
> print @replace;
You want to output the entire file once for each line in the file? That
could get kind of large, and seems pretty pointless. I think you should
revisit your logic for this program. It is not clear what you actually
intended to accomplish.
> print PROXYLOG @replace;
> }
> close PROXYLOG;
> close TEMP;
>
--
Bob Walton
------------------------------
Date: Wed, 13 Nov 2002 04:49:09 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Help with https and lwp
Message-Id: <3DD1D9BE.9060906@rochester.rr.com>
ETAN WEINTRAUB wrote:
...
> It works if I use http:// instead of https://, however I need it to work
> with https://. When I switch it to https://, I get the following message:
>
> ----------------------------------------------------------------
> File: local.cshrc
> 500 (Internal Server Error) Can't connect to localhost:443 ()
> Client-Date: Tue, 12 Nov 2002 20:32:21 GMT
>
> ----------------------------------------------------------------
>
> Any ideas???
Does the https://... work at the site using your favorite web browser?
If not, then it is a web server problem, not a Perl problem. Looks to
me like that is probably the case.
...
> -Etan Weintraub
...
--
Bob Walton
------------------------------
Date: Tue, 12 Nov 2002 19:19:37 -0800
From: "ted" <tednospam94107@yahoo.com>
Subject: Re: help with Win32::OLE MS Word
Message-Id: <aqsg4a$gmd$1@slb4.atl.mindspring.net>
How would I figure out where the table is in relation to everything else in
the Document. For instance, how would I know if the table is after the third
paragragh or the fifth paragraph?
Also, how would I figure out if a bulleted list has a nested list?
"Brian Helterline" <brian_helterline@hp.com> wrote in message
news:aqs46t$63f$1@hpcvsgen.cv.hp.com...
> "ted" <tednospam94107@yahoo.com> wrote in message
> news:<aqqdmq$k4c$1@slb2.atl.mindspring.net>...
> > Hello,
> >
> > I'm trying to extract text from MS Word docs that have tables and
bulleted
> > lists.
> >
> > How would I detect tables and bulleted lists (and nested lists) in the
> Word
> > doc? They are scattered throughout the doc.
> >
> > Any help appreciated. Thanks.
> > -Ted
> >
> Hi Ted,
> There is a Tables collection for the document that contains all the tables
> within the document.
> Word->Document->Tables
> Bulleted lists are just a format style so you would have to search for a
> style to locate them.
> -brian
>
>
------------------------------
Date: Wed, 13 Nov 2002 02:08:59 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: illegal use of comment ?
Message-Id: <pkent77tea-104F85.02085713112002@news-text.blueyonder.co.uk>
In article <aqpltp$7hn$1@canopus.cc.umanitoba.ca>,
roberson@ibd.nrc.ca (Walter Roberson) wrote:
> In article <pkent77tea-60BF37.21505711112002@news-text.blueyonder.co.uk>,
> pkent <pkent77tea@yahoo.com.tea> wrote:
<som rambling rubbish>
> Using the character '#' has some ambiguity: ASCII allowed the display
> for that position to be the UK pounds-stirling L-bar symbol. (Or
Do they? Fsck. Ok then 'the character at Unicode code point
0xwhateveritis commonly called hash or square or...'.
Standards.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Wed, 13 Nov 2002 02:17:51 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: illegal use of comment ?
Message-Id: <pkent77tea-C4C56B.02174913112002@news-text.blueyonder.co.uk>
In article <slrnat1c5s.ri9.garry@zfw.zvolve.net>,
Garry Williams <garry@ifr.zvolve.net> wrote:
> On Mon, 11 Nov 2002 21:50:57 GMT, pkent <pkent77tea@yahoo.com.tea> wrote:
> > And why yes I did have to deal with a load of data files proving that
> > people can get an email address 'wrong' in a variety of ways including:
> > adding newlines, or carriage returns
> > appending a final dot to the domain
> > typing the whole thing in upper case
> > etc. Hmm.
>
> Those last two are _not_ incorrect.
> The final dot _is_ the root domain
I know, I have had to attempt to set up a small zone (if that's the
right term) using BIND 8.
It's stuff that's wrong in the 'no-one does that so why are you?' way,
rather than 'non-RFC' wrong, hence the quotes in the orginal text. Our
MTA at work doesn't like the root domain dot though :-/
> and (sendmail at least) doesn't
> make a distinction between upper and lower case for the part to the
> left of the @.
Sadly not all the world uses sendmail, so we have to take a case
sensitive approach to the username portion in this application. And
let's not even go into full RFC822 email address parsing... well there's
a module on CPAN for that sort of thing :-)
> user names in mixed case. The mail cannot get delivered.) Domain
> names, of course are not case-sensitive, by definition.
very true, which is useful in a lot of ways. Doesn't stop the occasional
jibe at somebody whose host shows up as a BIGLETTER.ORG :-) It's like
being back in the days of foovax!bangvax!pathsvax!user.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Tue, 12 Nov 2002 23:33:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: illegal use of comment ?
Message-Id: <3DD1D613.6BAE20D2@earthlink.net>
pkent wrote:
>
> In article <aqpltp$7hn$1@canopus.cc.umanitoba.ca>,
> roberson@ibd.nrc.ca (Walter Roberson) wrote:
>
> > pkent wrote:
> <som rambling rubbish>
>
> > Using the character '#' has some ambiguity: ASCII allowed the
> > display for that position to be the UK pounds-stirling L-bar symbol.
> > (Or
>
> Do they? Fsck. Ok then 'the character at Unicode code point
> 0xwhateveritis commonly called hash or square or...'.
Unicode point U+0023, "NUMBER SIGN", which as an html entity is written
#
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Tue, 12 Nov 2002 23:41:07 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: newbie LWP redirect/cookie question
Message-Id: <3DD1D7E3.C66DE00E@earthlink.net>
Bryan Castillo wrote:
[snip]
> (Unless you can submit data in both GET and POST style. I don't know
> if that can be done or not.)
You *can*, but it's discouraged -- if you need the data to go in two
parts, then use POST with your extra data passed in through PATH_EXT.
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Tue, 12 Nov 2002 21:37:44 -0700
From: bowman <bowman@montana.com>
Subject: Re: perl daemon in windows memory hog ?
Message-Id: <aqsksm$ctit4$1@ID-159066.news.dfncis.de>
James Q.L wrote:
>
> it will restart the IIS server, if it didn't response within 60 seconds
> then the computer will get rebooted.
> i want to save the log
> my $log = `iisreset /restart /rebootonerror /timeout:60`;
> print OUT $log;
> is it possible to do it in this sequence or should i do it in
> 'SERVICE_STOP_PENDING' ?
> and is the timeout setting too long ? and what's the max sleep time i can
> set in Win32::Daemon ? i am afraid the SCM can't wait that long.
If the iisreset triggers the reboot, the SCManager will send a
SERVICE_CONTROL_SHUTDOWN. You've got about 20 seconds, but you can spin
that out with
Win32::Daemon::State( SERVICE_STOP_PENDING, 30000 );
You've acknowledged the imminent shutdown, and the second parameter is a
hint to the SCManager that it will take you 30 seconds (30000 msec) to
clean up. You should be able to write the log to a local drive with no
problem. The rub comes if you're trying to do something that depends on
another service that is also in the process of shutting down or is already
gone. That's where juggling shutdown priorities comes in, so you get the
good news first.
------------------------------
Date: 13 Nov 2002 02:55:48 GMT
From: roberson@ibd.nrc.ca (Walter Roberson)
Subject: Re: Question on -B
Message-Id: <aqsevk$j1a$1@canopus.cc.umanitoba.ca>
In article <3DD17880.B26AC3D3@sedona.intel.com>,
Ron Smith <rdsmith@sedona.intel.com> wrote:
|> In article <3DD14CE9.887CF8A2@sedona.intel.com>,
|> Ron Smith <rdsmith@sedona.intel.com> wrote:
|> :I'd like a quick and *efficient* way to do an "accurate" -B test,
|> :regardless of whether or not the file is currently gzipped.
|I'm happy with the perl definition ala -B. While I appreciate some of
|the subtlties you mention below, none of them matter much for the kinds
|of files I'm actually going to scan.
In that case, I'd suggest that you read 512 characters using
Compress::Zlib's gzread(), and that you use 'tr' to "translate"
all text-like characters to nothingness. If the length of what's
left exceeds your comfort factor, then it isn't sufficiently "text-like"
for your purposes.
--
This signature intentionally left... Oh, darn!
------------------------------
Date: Wed, 13 Nov 2002 02:39:58 GMT
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Simple question - What is unicode?
Message-Id: <pkent77tea-DFB97B.02395613112002@news-text.blueyonder.co.uk>
In article <3dcb0817@news.victoria.tc.ca>,
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote:
[About ranges of characters in XML files]
> </rant again>
[it was too well reasoned to be a rant :-) ]
> Personally I don't see how this trade off is supposed to make sense.
I was always under the impression that XML files contained only
characters from ISO-8859 (which doens't cover the entire range x00-xff)
and a select few control characters such as x0a and x09. Characters
between decimal 127 and decimal 160 (I think) are outside the set
specified by ISO-8859.
Hence those high-bit and low-bit control chars were disallowed because
they may mean something special to different systems because they're
outside the set of character/code points specified by iso8859 and have
no universally accepted meaning.
In windows those characters are used for some glyphs, and on MacOS
they're used for AFAICT a different set of glyphs, for example.
Now that only applies to literal characters - as most XML users know you
can happily escape characters if you want them in your document, you
just can't have them as literals. So rather than a literal ;left single
smart quote' you have to put '–' or whatever in your XML. It's
exactly like having to put '&' in an HTML document or '%20' in a
URL. No prizes for guessing whether people who are paid to write HTML
always follow that though...
ObPerl:
at least now we're building XML validation right into a desktop perl
application using the rather cool 'wxPerl' stuff
http://wxperl.sourceforge.net/ - taking load off the servers and putting
it where it belongs - on the desktop!
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply
------------------------------
Date: Wed, 13 Nov 2002 03:44:29 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Simple question - What is unicode?
Message-Id: <xUjA9.13271$TL6.5373@nwrddc02.gnilink.net>
pkent wrote:
> In article <3dcb0817@news.victoria.tc.ca>,
> yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote:
> I was always under the impression that XML files contained only
> characters from ISO-8859 (which doens't cover the entire range
> x00-xff) and a select few control characters such as x0a and x09.
> Characters between decimal 127 and decimal 160 (I think) are outside
> the set specified by ISO-8859.
Most definitely not. The default encoding for XML is UTF-8.
If you want to use ISO-8859-x then you have to specify this explicitly.
Unfortunately there is no difference between a file in UTF-8 and a file in
ISO-8859-1 as long as you stick to ASCII characters only. Therefore far to
many people code their programs as if XML was ISO-8859-1 and are very
surprised when someone submits a non-ASCII character.
> So rather than a literal ;left
> single smart quote' you have to put '–' or whatever in your XML.
And why would anyone with a sane mind do that? First crippling XML by
switching from UTF-8 to ISO, and then using numerical Unicode code points to
regain the ability to represent non-English characters which they just
removed? What a concept!
jue
------------------------------
Date: Wed, 13 Nov 2002 02:08:26 GMT
From: echang@netstorm.net (ebchang)
Subject: Re: some help with a print statement requested - double quotes giving me trouble!
Message-Id: <Xns92C4D71FFA356echangnetstormnet@207.106.92.86>
Paul Spitalny <no_spam@no_spam.com> wrote in <3DD15DA4.4060704@no_spam.com>:
> Hi,
> I am trying to print a line and I want quotation marks in the output
> line. The exact output line I want to print, to the output file, is:
>
> .options probefilename="output.dat"
>
> I tried to print the line using the following perl code:
>
> print TEMP ".options probefilename="output.dat"\n";
>
> But,this does not work.
>
> I can successfully do the following:
>
> print TEMP ".options probefilename='output.dat'\n";
>
> But, although this will execute, the single quote is not what I want.
> I surmise that the double quotes are confusing the print statement. How
> can I get around this problem??
As you've used them the double quotes create broken code because the quote
following the = is paired with the opening one - you have essentially tried
to use two quoted string with the bare text output.dat in between them.
Among other possibilities:
print TEMP qq(.options probefilename="output.dat"); # use an alternative
operator
or
print TEMP ".options probefilename=\"output.dat\"\n"; # escape the quotes
or
print TEMP '.options probefilename="output.dat"',"\n"; # break it up
--
EBC
------------------------------
Date: Tue, 12 Nov 2002 23:59:53 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Try your hand at perl golf
Message-Id: <3DD1DC49.98114EE4@earthlink.net>
Ton Hospel wrote:
>
> perl golf = trying to solve a certain problem with perl using
> as few characters as possible.
>
> The monthly challenge now running:
> http://perlgolf.sourceforge.net/TPR/0/6/
> Prizes for the winners, fun for all.
Just for the sake of variety, I would like to see a perl golf contest
where the score is measured by the number of ops (counted using B.pm),
instead of the number of characters.
This would allow us to write perl golf submissions with long, readable
variable names, and as much whitespace and comments and as we want,
without it interfering with the score.
(There would need to be a few restrictions, to avoid "cheating" through
doing eval STRING, or storing vital information in the comments and
extracting it, etc., but this could be done by putting -Mops=stuff on
the command line in the testing harness, later followed by inspection of
the winning pieces of code by the judges.)
--
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]
------------------------------
Date: Wed, 13 Nov 2002 03:48:13 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: UTF8 counting first octet hi bits
Message-Id: <1YjA9.13283$TL6.10002@nwrddc02.gnilink.net>
Ed Kulis wrote:
> I'm trying to decode UTF-8 so that I can protect various conversion
> functions from characters that they can't deal with
Just an idea: what about asking Text::Iconv to do the conversion for you. If
there are characters, which are not representable (like Japanese characters
in let's say ISO-8859-1) then Iconv will fail with an error code.
I don't quite see why you want to roll your own code.
jue
------------------------------
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.
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 4110
***************************************