[23099] in Perl-Users-Digest
Perl-Users Digest, Issue: 5320 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 5 14:46:29 2003
Date: Tue, 5 Aug 2003 11:45:59 -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 Tue, 5 Aug 2003 Volume: 10 Number: 5320
Today's topics:
Re: using Perl5 MD5 module in Perl4? <richard.kofler@chello.at>
Re: using Perl5 MD5 module in Perl4? (Kenjis Kaan)
Variables in config files, -w, and "only used once". (Seebs)
Re: Variables in config files, -w, and "only used once" (Greg Bacon)
Re: Variables in config files, -w, and "only used once" <noreply@gunnar.cc>
Re: Variables in config files, -w, and "only used once" <REMOVEsdnCAPS@comcast.net>
Re: Web hosts and mod_perl [was: Web development and Pe (trwww)
Re: Web hosts and mod_perl <noreply@gunnar.cc>
Re: Why, oh why have I read "Perl 6 essentials"??? <persicom@acedsl.com>
Re: Why, oh why have I read "Perl 6 essentials"??? <jaspax@u.washington.edu>
Re: Why, oh why have I read "Perl 6 essentials"??? <g4rry_sh0rt@zw4llet.com>
Re: Why, oh why have I read "Perl 6 essentials"??? <g4rry_sh0rt@zw4llet.com>
Re: Why, oh why have I read "Perl 6 essentials"??? <uri@stemsystems.com>
Re: Wide character in print <eric-amick@comcast.net>
Re: Wide character in print <flavell@mail.cern.ch>
Re: Wide character in print <shtil@comcast.net>
Re: Wide character in print <flavell@mail.cern.ch>
Re: Wide character in print <jurgenex@hotmail.com>
Writing to a socket between many modules <gareth_curtis@tesco.net>
Re: Writing to a socket between many modules <uri@stemsystems.com>
wwwboard post file permissions <spam12@64spam.com>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 03 Aug 2003 09:32:10 GMT
From: Richard Kofler <richard.kofler@chello.at>
Subject: Re: using Perl5 MD5 module in Perl4?
Message-Id: <3F2CD678.90FD70B8@chello.at>
Tad McClellan wrote:
>
> Bart Lateur <bart.lateur@pandora.be> wrote:
> > Kenjis Kaan wrote:
> >
> >>Tivoli's version of Perl is still Perl4.
>
[ ... some line containing much too true content snipped ... ]
> I heard somewhere over a year ago that they were moving to embedding
> Perl 5 into their apps.
>
> Guess that hasn't happened yet...
>
[ sigsnip ]
In fact we asked for this in late 1999 for the first time.
Since then the change request / feature request is pending....
For our Tivoli installations we since then have two
Perl versions in coexistance. It does not add too
much complexity, but allows us to use version 5.8
for site specific scripts.
To the OP: Look out for Tivoli Red Books. Maybe coexistant
versions of Perl versions is covered there.
Dic_k
--
Richard Kofler
SOLID STATE EDV
Dienstleistungen GmbH
Vienna/Austria/Europe
------------------------------
Date: 5 Aug 2003 10:47:06 -0700
From: tivolinewbie@canada.com (Kenjis Kaan)
Subject: Re: using Perl5 MD5 module in Perl4?
Message-Id: <6a8ba9f8.0308050947.3fb3fead@posting.google.com>
Richard Kofler <richard.kofler@chello.at> wrote in message news:<3F2CD678.90FD70B8@chello.at>...
> Tad McClellan wrote:
> >
> > Bart Lateur <bart.lateur@pandora.be> wrote:
> > > Kenjis Kaan wrote:
> > >
> > >>Tivoli's version of Perl is still Perl4.
> >
>
> [ ... some line containing much too true content snipped ... ]
>
> > I heard somewhere over a year ago that they were moving to embedding
> > Perl 5 into their apps.
> >
> > Guess that hasn't happened yet...
> >
> [ sigsnip ]
>
> In fact we asked for this in late 1999 for the first time.
> Since then the change request / feature request is pending....
>
> For our Tivoli installations we since then have two
> Perl versions in coexistance. It does not add too
> much complexity, but allows us to use version 5.8
> for site specific scripts.
>
> To the OP: Look out for Tivoli Red Books. Maybe coexistant
> versions of Perl versions is covered there.
>
> Dic_k
Where in the Tivoli distribution did you find perl 5.8? I checked the
TMR installation and all I find is perl4. Look here. Or did you
download perl 5.8 off Activestate or whatever and installed yourself
(that's different issue). I am referring to the perl that comes with
Tivoli.
C:\Tivoli>C:\Tivoli\bin\w32-ix86\tools\perl.exe -v
This is perl, version 4.0
perl for NT $$Revision: 4.0.1.8
Build 3
Patch level: 36
Copyright (c) 1989, 1990, 1991, Larry Wall
NT Copyright (c) 1993, Intergraph Corporation
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 4.0 source
kit.
C:\Tivoli>
------------------------------
Date: 04 Aug 2003 17:44:53 GMT
From: seebs@plethora.net (Seebs)
Subject: Variables in config files, -w, and "only used once".
Message-Id: <3f2e9b95$0$1098$3c090ad1@news.plethora.net>
This is probably a FAQ, but I've been unable to figure out the right search
terms to use to look it up.
I want to have a common file loaded by multiple programs which sets a
variable, which they then use.
If a given program only uses this variable once, it then produces:
Name "main::catdb" used only once: possible typo at dbdump.cgi line 7.
or something similar.
This is "obviously harmless", but I *hate* having warnings, and I want it
to go away.
Is there a way for me to tell perl that names encountered in a file I'm
loading should count towards the number of uses of those names, so I don't
get this?
I don't want to do:
$x = $x;
just to suppress this, but I will if I have to.
-s
--
Copyright 2003, all wrongs reversed. Peter Seebach / seebs@plethora.net
http://www.seebs.net/log/ - YA blog. http://www.seebs.net/ - homepage.
C/Unix wizard, pro-commerce radical, spam fighter. Boycott Spamazon!
Consulting, computers, web hosting, and shell access: http://www.plethora.net/
------------------------------
Date: Mon, 04 Aug 2003 17:59:56 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Variables in config files, -w, and "only used once".
Message-Id: <vit7oshaeu3j16@corp.supernews.com>
In article <3f2e9b95$0$1098$3c090ad1@news.plethora.net>,
Seebs <seebs@plethora.net> wrote:
: [...]
:
: Is there a way for me to tell perl that names encountered in a file I'm
: loading should count towards the number of uses of those names, so I don't
: get this?
I've seen code that scans config files for scalars and makes dummy
assignments, but that's a little hacky. You could predeclare with our
or with use vars, but that's not very helpful if the contents change
often.
You could work around with a use (i.e., let the compiler see them
early):
% cat try
#! /usr/local/bin/perl -w
use Foo;
print $bar, "\n";
[12:54] ant% cat Foo.pm
$bar = 42;
1;
% ./try
42
Hope this helps,
Greg
--
. . . aggressors cannot wage total war without introducing socialism.
-- Ludwig von Mises, *Interventionism: an Economic Analysis*
------------------------------
Date: Mon, 04 Aug 2003 20:15:09 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Variables in config files, -w, and "only used once".
Message-Id: <bgm8bm$pr5vu$1@ID-184292.news.uni-berlin.de>
Seebs wrote:
> If a given program only uses this variable once, it then produces:
>
> Name "main::catdb" used only once: possible typo at dbdump.cgi line
> 7.
>
> or something similar.
>
> This is "obviously harmless", but I *hate* having warnings, and I
> want it to go away.
Declare it with my or our.
(It's apparently a global variable. You may want to consider declaring
it as lexically scoped instead.)
Another possible solution:
use warnings;
no warnings 'once';
You'd better study http://www.perldoc.com/perl5.8.0/pod/perllexwarn.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 04 Aug 2003 15:39:34 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Variables in config files, -w, and "only used once".
Message-Id: <Xns93CDA9661A64Csdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
seebs@plethora.net (Seebs) wrote in
news:3f2e9b95$0$1098$3c090ad1@news.plethora.net:
> This is probably a FAQ, but I've been unable to figure out the right
> search terms to use to look it up.
>
> I want to have a common file loaded by multiple programs which sets a
> variable, which they then use.
You could try my new module Config::Vars, which is designed for this
purpose. It's available on CPAN.
- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPy7EamPeouIeTNHoEQKQkgCfW/yJZ3H1LmkQPCIWRb5yXyEhf6MAnRak
BvXqOfLQ2u5dLDsFFGoAHlS1
=6PRF
-----END PGP SIGNATURE-----
------------------------------
Date: 3 Aug 2003 21:43:28 -0700
From: toddrw69@excite.com (trwww)
Subject: Re: Web hosts and mod_perl [was: Web development and Perl 6]
Message-Id: <d81ecffa.0308032043.68f183cf@posting.google.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<bgf479$o2jrh$1@ID-184292.news.uni-berlin.de>...
> As regards _shared_ hosting environments, this is one problem area:
>
> Take a Perl program with program specific *.pm files. It may work fine
> if it's installed by one of the users, but the consequenses if that
> same program, maybe of a different version, is installed by one or
> more other users on the same server, may become ... interesting. (If I
> have understood it correctly, you share the same %INC variable.)
>
> Global variables is another potential problem, I suppose.
>
> It would be great if it was possible to configure a server in a way
> that handles such potential problems properly. Is there anybody who
> knows if that is possible?
For shared hosting this is a problem. You have to do some customizing
to use mod_perl 1 for shared hosting because other users could access
your database handles, redefine your subroutines, all kinds of
dangerous stuff.
A cheap compaq dp, an ADSL connection, redhat, and dyndns.org was my
solution. But it wouldnt handle any amount of traffic well.
What a provider could do so that all requests could be served over
port 80 is set up a proxy httpd that dispatches internal httpds based
on the 'host:' header in the request. This will give each user their
own memory to work in. It is an expensive solution though.
Apache 2 and mod_perl 2 will take care of this. Each virtual host can
have its own interpreter:
http://perl.apache.org/docs/2.0/user/design/design.html#Virtual_Hosts
Todd W.
------------------------------
Date: Mon, 04 Aug 2003 15:04:25 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Web hosts and mod_perl
Message-Id: <bglm4h$97f78$1@ID-184292.news.uni-berlin.de>
trwww wrote:
> Gunnar Hjalmarsson wrote:
>> It would be great if it was possible to configure a server in a
>> way that handles such potential problems properly. Is there
>> anybody who knows if that is possible?
>
> For shared hosting this is a problem. You have to do some
> customizing to use mod_perl 1 for shared hosting because other
> users could access your database handles, redefine your
> subroutines, all kinds of dangerous stuff.
>
> A cheap compaq dp, an ADSL connection, redhat, and dyndns.org was
> my solution. But it wouldnt handle any amount of traffic well.
>
> What a provider could do so that all requests could be served over
> port 80 is set up a proxy httpd that dispatches internal httpds
> based on the 'host:' header in the request. This will give each
> user their own memory to work in. It is an expensive solution
> though.
>
> Apache 2 and mod_perl 2 will take care of this. Each virtual host
> can have its own interpreter:
>
> http://perl.apache.org/docs/2.0/user/design/design.html#Virtual_Hosts
Thanks for the info, Todd! It seems as if we have reasons, after all,
to be optimistic as regards mod_perl on shared hosting accounts.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 04 Aug 2003 22:43:25 -0400
From: "Matthew O. Persico" <persicom@acedsl.com>
To: JS Bangs <jaspax@u.washington.edu>
Subject: Re: Why, oh why have I read "Perl 6 essentials"???
Message-Id: <3F2F19CD.3000008@acedsl.com>
JS Bangs wrote:
> Simon sikyal:
>
>
>>This book is evil, especially the part about junctions. I am *dying* to use them!!!
>>:((((
>
>
> :). I haven't read the book, but the Apocalypses make my mouth water . . .
> especially the new subroutine declaration syntax. Soon, they say.
Go read http://www.perl.com/pub/a/2003/07/29/exegesis6.html
It will absolutely blow your mind. Wait until you see the power of
junctions, the new <== and ==> operators (of which the later is more
mind blowing) and 'when'...
------------------------------
Date: Mon, 4 Aug 2003 21:32:56 -0700
From: JS Bangs <jaspax@u.washington.edu>
Subject: Re: Why, oh why have I read "Perl 6 essentials"???
Message-Id: <Pine.A41.4.56.0308042130210.95418@dante18.u.washington.edu>
Matthew O. Persico sikyal:
> JS Bangs wrote:
> > Simon sikyal:
> >
> >
> >>This book is evil, especially the part about junctions. I am *dying* to use them!!!
> >>:((((
> >
> >
> > :). I haven't read the book, but the Apocalypses make my mouth water . . .
> > especially the new subroutine declaration syntax. Soon, they say.
>
> Go read http://www.perl.com/pub/a/2003/07/29/exegesis6.html
> It will absolutely blow your mind. Wait until you see the power of
> junctions, the new <== and ==> operators (of which the later is more
> mind blowing) and 'when'...
I read it just before I received this message, providentially. Now I'm
looking at my code and thinking, "If only this were Perl6, I could say
'any @foo' here and my life would be so much easier . . .".
--
Jesse S. Bangs jaspax@u.washington.edu
http://students.washington.edu/jaspax/
http://students.washington.edu/jaspax/blog
------------------------------
Date: Tue, 05 Aug 2003 09:46:11 +0000
From: Garry Short <g4rry_sh0rt@zw4llet.com>
Subject: Re: Why, oh why have I read "Perl 6 essentials"???
Message-Id: <bgnr2l$qk5$2$8302bc10@news.demon.co.uk>
Matthew O. Persico wrote:
> JS Bangs wrote:
>> Simon sikyal:
>>
>>
>>>This book is evil, especially the part about junctions. I am *dying* to
>>>use them!!!
>>>:((((
>>
>>
>> :). I haven't read the book, but the Apocalypses make my mouth water . .
>> :.
>> especially the new subroutine declaration syntax. Soon, they say.
>
> Go read http://www.perl.com/pub/a/2003/07/29/exegesis6.html
> It will absolutely blow your mind. Wait until you see the power of
> junctions, the new <== and ==> operators (of which the later is more
> mind blowing) and 'when'...
I'm only on exegesis 3, and I'm already drooling ....
Garry
------------------------------
Date: Tue, 05 Aug 2003 16:46:20 +0000
From: Garry Short <g4rry_sh0rt@zw4llet.com>
Subject: Re: Why, oh why have I read "Perl 6 essentials"???
Message-Id: <bgon0u$h6m$1$8300dec7@news.demon.co.uk>
> Go read http://www.perl.com/pub/a/2003/07/29/exegesis6.html
> It will absolutely blow your mind. Wait until you see the power of
> junctions, the new <== and ==> operators (of which the later is more
> mind blowing) and 'when'...
I was wondering why I hadn't seen exegesis 6, and I've just realised why.
I'm looking on dev.perl.org/perl6, and it's not there (nor, actually, is
#4, but at least there's a link to the relevant place on perl.com).
Actually, a lot of the stuff on the perl6 site doesn't look like it's been
updated for ages. Is this site not being maintained, or something?
Just on a casual note, because the more I read, the more impatient I get,
are there any estimated timescales on when Perl6 will be available?
Cheers,
Garry
------------------------------
Date: Tue, 05 Aug 2003 16:47:58 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why, oh why have I read "Perl 6 essentials"???
Message-Id: <x7wudsqce9.fsf@mail.sysarch.com>
>>>>> "GS" == Garry Short <g4rry_sh0rt@zw4llet.com> writes:
GS> Just on a casual note, because the more I read, the more impatient
GS> I get, are there any estimated timescales on when Perl6 will be
GS> available?
next christmas (for some definition of christmas).
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Sun, 03 Aug 2003 10:29:27 -0400
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: Wide character in print
Message-Id: <v26qiv8h6bf05ru9lmiihov8fo1r2c43av@4ax.com>
On Sat, 02 Aug 2003 19:01:28 GMT, "Yuri Shtil" <shtil@comcast.net> wrote:
>What is Eniac 2 ?
>
>Sorry for ignorance !!!
It's a stupid joke. Ignore it. I suspect you're trying to print Unicode
characters to a filehandle that isn't expecting them. You should be able
to fix the problem by adding
binmode(FILEHANDLE, ":utf8");
after the opening of the filehandle. If that doesn't work, you should be
able to turn off the warning.
perldoc perldiag
--
Eric Amick
Columbia, MD
------------------------------
Date: Sun, 3 Aug 2003 17:40:44 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Wide character in print
Message-Id: <Pine.LNX.4.53.0308031654520.15409@lxplus004.cern.ch>
On Sun, Aug 3, Eric Amick inscribed on the eternal scroll:
> On Sat, 02 Aug 2003 19:01:28 GMT, "Yuri Shtil" <shtil@comcast.net>
had, it seems, blurted out atop a fullquote:
> >What is Eniac 2 ?
> >
> >Sorry for ignorance !!!
>
> It's a stupid joke.
Well, I thought it was rather amusing; but then, the hon. Usenaut
could perhaps be advised to pay more attention to Usenet posting
conventions, and to entrust unknown terminology to a search engine of
their choice before revealing ignorance of the history of computers in
public... [An aside on the topic of character coding and old
computers: http://www.mailcom.com/besm6/ shows what can happen when
people try to put two different character codings into the same web
page - Mozilla decided it must be Chinese, with unfortunate
results...] [OK, so BESM-6 was a youngster compared to ENIAC]
> I suspect you're trying to print Unicode
> characters to a filehandle that isn't expecting them.
OK, let's get serious.
There is a Perl document (perldiag) which lists the error messages
issued by perl itself. For 5.8.0 this document could be perused at
http://www.perldoc.com/perl5.8.0/pod/perldiag.html ,
although it's also part of any complete Perl installation.
This should be the _first_ recourse for any unrecognised message.
And indeed, here is the offending item:
Wide character in %s
(W utf8) Perl met a wide character (>255) when it wasn't expecting
one. This warning is by default on for I/O (like print) but can be
turned off by no warnings 'utf8';. You are supposed to explicitly
mark the filehandle with an encoding, see open and perlfunc/binmode.
Seems to me that they key phrase here is "You are supposed to...".
> You should be able to fix the problem by adding
>
> binmode(FILEHANDLE, ":utf8");
Do you think so? That tells Perl that the filehandle *is* expecting
utf-8 encoding, but if it isn't in fact expecting it, then it's
likely to cause an even worse problem.
If the hon. Usenaut is expecting a particular character coding on
their output, I would recommend (in 5.8.0) defining that coding in
an encoding layer, to give Perl the chance to convert between "Wide
characters" internally, and the expected encoding externally.
Without some context, I've no idea whether the material in question
might want to be koi8-r (the traditional encoding for Russian
Cyrillic), or nothing more exciting than Windows-1252; but either way,
an :encoding layer is what I'd recommend.
The relevant documentation page that's called out from the binmode()
page is: http://www.perldoc.com/perl5.8.0/lib/open.html
(In earlier Perl versions, one needs to call the encoding explicitly,
instead of including it in the open/binmode calls).
> If that doesn't work, you should be able to turn off the warning.
But again: the warning is there for a reason. Just hiding the warning
doesn't make that reason go away. I would recommend identifying and
then solving the problem, not just hiding it.
You then added, almost it seems as an afterthought:
> perldoc perldiag
Oh, right: but I'd suggest putting that up-front, IMNSHO it's the
single most important part of this reply.
cheers
------------------------------
Date: Mon, 04 Aug 2003 01:48:47 GMT
From: "Yuri Shtil" <shtil@comcast.net>
Subject: Re: Wide character in print
Message-Id: <3YiXa.41592$Oz4.12184@rwcrnsc54>
I am amazed how a simple question can start something close to a flaming war
!!!
Are only superbly educated in computer history are allowed to participate in
this group ?
On the serious note, my problem showed up when I tried to parse/write XML
code that came from a third party application.
So I have no idea what to expect since the application does not specify the
encoding (or at least I don't know how to extract it).
These wide characters just showed up in some records.
There is an another problem.
My code passes extracted XML strings to an another application as counted
strings. It seems that the Perl length function returns an incorrect result
when these
"wide" characters are present.
Again, please pardon my ignorance and try to avoid flaming each other.
"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.53.0308031654520.15409@lxplus004.cern.ch...
> On Sun, Aug 3, Eric Amick inscribed on the eternal scroll:
>
> > On Sat, 02 Aug 2003 19:01:28 GMT, "Yuri Shtil" <shtil@comcast.net>
> had, it seems, blurted out atop a fullquote:
>
> > >What is Eniac 2 ?
> > >
> > >Sorry for ignorance !!!
> >
> > It's a stupid joke.
>
> Well, I thought it was rather amusing; but then, the hon. Usenaut
> could perhaps be advised to pay more attention to Usenet posting
> conventions, and to entrust unknown terminology to a search engine of
> their choice before revealing ignorance of the history of computers in
> public... [An aside on the topic of character coding and old
> computers: http://www.mailcom.com/besm6/ shows what can happen when
> people try to put two different character codings into the same web
> page - Mozilla decided it must be Chinese, with unfortunate
> results...] [OK, so BESM-6 was a youngster compared to ENIAC]
>
> > I suspect you're trying to print Unicode
> > characters to a filehandle that isn't expecting them.
>
> OK, let's get serious.
>
> There is a Perl document (perldiag) which lists the error messages
> issued by perl itself. For 5.8.0 this document could be perused at
> http://www.perldoc.com/perl5.8.0/pod/perldiag.html ,
> although it's also part of any complete Perl installation.
>
> This should be the _first_ recourse for any unrecognised message.
>
> And indeed, here is the offending item:
>
> Wide character in %s
> (W utf8) Perl met a wide character (>255) when it wasn't expecting
> one. This warning is by default on for I/O (like print) but can be
> turned off by no warnings 'utf8';. You are supposed to explicitly
> mark the filehandle with an encoding, see open and perlfunc/binmode.
>
> Seems to me that they key phrase here is "You are supposed to...".
>
> > You should be able to fix the problem by adding
> >
> > binmode(FILEHANDLE, ":utf8");
>
> Do you think so? That tells Perl that the filehandle *is* expecting
> utf-8 encoding, but if it isn't in fact expecting it, then it's
> likely to cause an even worse problem.
>
> If the hon. Usenaut is expecting a particular character coding on
> their output, I would recommend (in 5.8.0) defining that coding in
> an encoding layer, to give Perl the chance to convert between "Wide
> characters" internally, and the expected encoding externally.
>
> Without some context, I've no idea whether the material in question
> might want to be koi8-r (the traditional encoding for Russian
> Cyrillic), or nothing more exciting than Windows-1252; but either way,
> an :encoding layer is what I'd recommend.
>
> The relevant documentation page that's called out from the binmode()
> page is: http://www.perldoc.com/perl5.8.0/lib/open.html
>
> (In earlier Perl versions, one needs to call the encoding explicitly,
> instead of including it in the open/binmode calls).
>
> > If that doesn't work, you should be able to turn off the warning.
>
> But again: the warning is there for a reason. Just hiding the warning
> doesn't make that reason go away. I would recommend identifying and
> then solving the problem, not just hiding it.
>
> You then added, almost it seems as an afterthought:
>
> > perldoc perldiag
>
> Oh, right: but I'd suggest putting that up-front, IMNSHO it's the
> single most important part of this reply.
>
> cheers
------------------------------
Date: Mon, 4 Aug 2003 18:11:35 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Wide character in print
Message-Id: <Pine.LNX.4.53.0308041755050.25330@lxplus093.cern.ch>
On Mon, Aug 4, Yuri Shtil continued in TOFU style:
> Are only superbly educated in computer history are allowed to participate in
> this group ?
You're no fun in a usenet discussion...
> On the serious note, my problem showed up when I tried to parse/write XML
> code that came from a third party application.
> So I have no idea what to expect since the application does not specify the
> encoding
But a text file is, in general, useless without a specification of its
character encoding.
> (or at least I don't know how to extract it).
It's not normally something that one can "extract" in any formal way
from the datastream itself; it's a piece of meta-data that goes along
with the data. However, with some samples and some knowledge of
context, someone could well offer a hypothesis.
Perhaps if you'd show the data in context (accompanied for example by
a hexadecimal dump of the bytes), someone could offer a suggestion
about what it is.
> These wide characters just showed up in some records.
That's not a very definite description of symptoms, you know. I think
we could have guessed that for ourselves based on your previous
presentation. I for one was hoping to see something more definite in
the way of an exhibit.
> There is an another problem.
>
> My code passes extracted XML strings to an another application as counted
> strings. It seems that the Perl length function returns an incorrect result
> when these
> "wide" characters are present.
I'd have to guess that the Perl length function returns what it's
documented to return, but that you're expecting something different.
> Again, please pardon my ignorance
Lack of knowledge (ignorance) is NOT the issue here, and is a
perfectly normal and acceptable state of being, and (I think I can
speak for many another here) is one of the reasons why we come to
Usenet to share what we know. The *problem* is that you aren't
showing us any working, so we don't know exactly what you're trying,
we don't know exactly what results you are getting, we don't know what
you expected the answer to be, and so we can't really offer any
definite help.
If you haven't tried it yet I'd suggest
http://www.perldoc.com/perl5.8.0/pod/perluniintro.html
and then
http://www.perldoc.com/perl5.8.0/pod/perlunicode.html
with particular reference to #Byte-and-Character-Semantics
But most of all to
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
have fun
------------------------------
Date: Tue, 05 Aug 2003 15:00:10 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Wide character in print
Message-Id: <_DPXa.19332$td7.12043@nwrddc01.gnilink.net>
Alan J. Flavell wrote:
> On Mon, Aug 4, Yuri Shtil continued in TOFU style:
[...]
> The *problem* is that you aren't
> showing us any working, so we don't know exactly what you're trying,
> we don't know exactly what results you are getting, we don't know what
> you expected the answer to be, and so we can't really offer any
> definite help.
>
> If you haven't tried it yet I'd suggest
> http://www.perldoc.com/perl5.8.0/pod/perluniintro.html
> and then
> http://www.perldoc.com/perl5.8.0/pod/perlunicode.html
> with particular reference to #Byte-and-Character-Semantics
>
> But most of all to
> http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
I'd like to add http://www.catb.org/~esr/faqs/smart-questions.html to that
list.
jue
------------------------------
Date: Tue, 05 Aug 2003 15:28:54 +0100
From: "Gareth Curtis" <gareth_curtis@tesco.net>
Subject: Writing to a socket between many modules
Message-Id: <pan.2003.08.05.14.28.53.610919@tesco.net>
Hi all,
I wonder if someone can give me some advice.
I am using WxWindows with Perl and have a script with many different
packages. I'd like each of these packages to be able to write to a socket.
In the main.pl file I have:
my $socket_handle = connect_server();
Then each package is able to see the global variable, I assume this is ok.
The connect_server is a module containing the code to connect to the
server using the Socket.pm module. I struggled with this for ages and
finally worked out that the socket is actually a kind of file and to
return() a file I had to do this:
my $socket_handle = *SOCKET_HANDLE; # Set the $socket_handle variable to
the SOCKET_HANDLE (pass file type handle with *)
return($socket_handle);
This seems to work. My question is; is this the right way to do this? Or
will it cause problems later maybe? If not, what is the correct way to do
this.
Many thanks for any help,
Gareth.
------------------------------
Date: Tue, 05 Aug 2003 14:51:04 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Writing to a socket between many modules
Message-Id: <x7brv4rwdj.fsf@mail.sysarch.com>
>>>>> "GC" == Gareth Curtis <gareth_curtis@tesco.net> writes:
GC> The connect_server is a module containing the code to connect to
GC> the server using the Socket.pm module. I struggled with this for
GC> ages and finally worked out that the socket is actually a kind of
GC> file and to return() a file I had to do this:
GC> my $socket_handle = *SOCKET_HANDLE; # Set the $socket_handle
GC> variable to the SOCKET_HANDLE (pass file type handle with *)
GC> return($socket_handle);
use the IO::Socket module. it is much easier to use than the low level
Socket.pm module. it will return a socket handle directly to you and not
need a type glob and the other stuff you are obviously doing there.
GC> This seems to work. My question is; is this the right way to do
GC> this? Or will it cause problems later maybe? If not, what is the
GC> correct way to do this.
i am not sure about what your question means. getting a socket is one
thing (and i told you a better way to do it). using it is another
thing. sharing a single socket among many modules is fine as long as
they all have access to the same handle. but how do you go about sharing
that handle? a package global will work but that is not a good
idea. making all the modules use an OO interface to this handle is a
possibility. but you would then need to create an instance of this
object in each module that needs it or again have a global object. i bet
you have what we call an XY problem. your design is set so you think you
have to do the i/o from each module. maybe a redesign is in order. i
have never seen a design where socket i/o has to be done all over the
place. that is prone to bugs and has maintenance issues. maybe your
modules should be called and just return their desired output to a
parent module which can do all the socket i/o. then you have a higher
level view of things and much better control over your data and i/o.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 05 Aug 2003 04:19:31 GMT
From: Mark Stewart <spam12@64spam.com>
Subject: wwwboard post file permissions
Message-Id: <MPG.1998d02d8bf0c4a7989719@news.easynews.com>
My wwwboard posts are "owned" by user 99 with the permission of 644. I
can get the files chown'd to my username and change the permissions, but
how can I get wwwboard to create new posts with a permission that also
allows me to edit the files if I want too, and still let the web script
update the file? Would 664 do, or would it have to be 666? The directory
is 777 btw.
I've editing existing perl scripts and creating small ones myself, but
I'm not sure if these changes could be done within the script or if the
server config would have to be change somehow.
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5320
***************************************