[29467] in Perl-Users-Digest
Perl-Users Digest, Issue: 711 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 2 18:10:22 2007
Date: Thu, 2 Aug 2007 15:09:09 -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 Thu, 2 Aug 2007 Volume: 11 Number: 711
Today's topics:
Re: @arts <ether@invalid.email.net>
Re: @arts <bik.mido@tiscalinet.it>
Re: @arts <savagebeaste@yahoo.com>
Re: How do you continue in a for loop? <mark.clementsREMOVETHIS@wanadoo.fr>
Re: How do you continue in a for loop? <bik.mido@tiscalinet.it>
I finally got a round tuit. (My first JAPH) <admiralcap@gmail.com>
Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
Re: if kill 9, $pid fails, is the error caught anywhere <nospam-abuse@ilyaz.org>
Re: if kill 9, $pid fails, is the error caught anywhere <bik.mido@tiscalinet.it>
Re: if kill 9, $pid fails, is the error caught anywhere <1usa@llenroc.ude.invalid>
Re: if kill 9, $pid fails, is the error caught anywhere <simon.chao@fmr.com>
Re: map & MIME::Parser <glex_no-spam@qwest-spam-no.invalid>
Re: Object creation failure in perl <allergic-to-spam@no-spam-allowed.org>
Re: Object creation failure in perl <mark.clementsREMOVETHIS@wanadoo.fr>
Re: Perl and Sockets xhoster@gmail.com
Re: Perl with DBI <tzz@lifelogs.com>
Re: Q on localizing *STDOUT and fork xhoster@gmail.com
Re: XML Validation <glex_no-spam@qwest-spam-no.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Aug 2007 19:39:28 GMT
From: Ether J <ether@invalid.email.net>
Subject: Re: @arts
Message-Id: <Xns9980811B6C83DEther@130.133.1.4>
Michele Dondi <bik.mido@tiscalinet.it> wrote in
news:jfu0b355u7759lhn7u72kk8nf09gm82tc9@4ax.com:
> On Wed, 1 Aug 2007 00:35:41 -0700, "V.Ronans" <v_r@spamless.and.happy>
> wrote:
>
>>I do NOT deny your and other regular's contributions - you and others
>>have done a lot for the community - but no matter how much you've done
>>doesn't give you the right to miss treat and take advantage of
> ^^^^^^^^^^^^^^
> ^^^^^^^^^^^^^^
??
>>vulnerable people.
> ^^^^^^^^^^
> ^^^^^^^^^^
??
What the problem? "vulnerable" is the correct spelling (according to
meriam-webster and dictionary.com)...
> Very funny: I imagine already becoming very rich and famous out of
> people ending up in psychiatric ward for having been told that "my
> script doesn't work, what can I do?" is not a valid description of
> their problem!
>
>
> Michele
I'll take this half-assed reply as a concession that a) there is no
proof, and b) that you and tab and the like are both wrong on the
previously stated counts, and will never raise yourselves to the level of
admitting it. Pitiful.
------------------------------
Date: Thu, 02 Aug 2007 22:22:58 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: @arts
Message-Id: <kte4b3tg8uqnc93q91qjb74h3jvb8ki7tt@4ax.com>
On 2 Aug 2007 19:39:28 GMT, Ether J <ether@invalid.email.net> wrote:
>>>doesn't give you the right to miss treat and take advantage of
>> ^^^^^^^^^^^^^^
>> ^^^^^^^^^^^^^^
> ??
>
>>>vulnerable people.
>> ^^^^^^^^^^
>> ^^^^^^^^^^
> ??
>
>What the problem? "vulnerable" is the correct spelling (according to
>meriam-webster and dictionary.com)...
I was not suggesting it were not, was I?
I was just having fun at reading such big words as "vulnerable people"
and "to take advantage" in connection with a thing like answering
posts on usenet.
Do you really want to know what "vulnerable people", "to take
advantage" and "to abuse" mean? Just whatch this:
http://youtube.com/watch?v=apwGhybit7o
and be ashamed of having used similar terms in a context as silly as
this one.
>> Very funny: I imagine already becoming very rich and famous out of
>> people ending up in psychiatric ward for having been told that "my
>> script doesn't work, what can I do?" is not a valid description of
>> their problem!
[snip]
>I'll take this half-assed reply as a concession that a) there is no
>proof, and b) that you and tab and the like are both wrong on the
Huh?!? No proof of... what, exactly?
>previously stated counts, and will never raise yourselves to the level of
>admitting it. Pitiful.
Terribly! But to be sure, we're all wrong not only on the previously
stated counts: just about on any you could come up with. I hope that
will make you feel better.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Thu, 2 Aug 2007 15:00:31 -0700
From: "Steve K." <savagebeaste@yahoo.com>
Subject: Re: @arts
Message-Id: <5hf2c7F3k838dU1@mid.individual.net>
Michele Dondi wrote:
> On 1 Aug 2007 08:52:58 GMT,
> anno4000@radom.zrz.tu-berlin.de wrote:
> >>> Anno -- sigless since 1989
> [snip]
> > It's a signature in the everyday sense of the word, manually added
> > unless I forget (or put it twice). It doesn't come from a
> > .signature
> > file and, as you observed, it lacks the "-- " and thus isn't a
> > Usenet
> > signature in the specialized sense of the word.
> And what is the one directly above "-- \n" in (most of) my posts? Am I
> *sigful*?
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
sigful, probably yes, but you'd be more so if your sig actually compiled
:)
$ perl
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
^d
syntax error at - line 3, next 2 tokens "=sub"
syntax error at - line 3, next 2 tokens "->"
Unterminated <> operator at - line 4.
------------------------------
Date: Thu, 02 Aug 2007 17:22:36 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: How do you continue in a for loop?
Message-Id: <46b1f6bc$0$27397$ba4acef3@news.orange.fr>
Michele Dondi wrote:
> On Thu, 02 Aug 2007 04:07:09 -0700, Ingo Menger
> <quetzalcotl@consultant.com> wrote:
>
>>> And, of course, $i is a terrible variable name.
>> On the contrary.
>> It's short.
>> It's a clichee and as such conveys information about the intent of the
>> programmer. I for one use it *only* for integer valued indexes or loop
>> variables, and insofar $i is much better than everbodies whoore $_,
>> which can be anything anywhere.
>
> $_ is a pronoun. $i is a noun. Each is good for what it's good, don't
> talk so bad 'bout $_ please. Anyway I agree with you: $i is perfectly
> fine for integer indexes.
>
But something like $ii or $ix is easier to search for whatever the
editor (much less worrying about word boundaries and so forth).
Mark
------------------------------
Date: Thu, 02 Aug 2007 22:25:49 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How do you continue in a for loop?
Message-Id: <l9f4b3ln3uq2ioampfs14pjrl57hc1032q@4ax.com>
On Thu, 02 Aug 2007 17:22:36 +0200, Mark Clements
<mark.clementsREMOVETHIS@wanadoo.fr> wrote:
>> $_ is a pronoun. $i is a noun. Each is good for what it's good, don't
>> talk so bad 'bout $_ please. Anyway I agree with you: $i is perfectly
>> fine for integer indexes.
>>
>But something like $ii or $ix is easier to search for whatever the
>editor (much less worrying about word boundaries and so forth).
Well, if you use either $i or $_ for anything that may require a
search with your text editor, then you're on your own. And in that
case $ii or $ix may not be that good either...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Thu, 02 Aug 2007 15:06:58 -0700
From: Matt Madrid <admiralcap@gmail.com>
Subject: I finally got a round tuit. (My first JAPH)
Message-Id: <1tCdne2gooceyC_bnZ2dnUVZ_j2dnZ2d@comcast.com>
I've been meaning to do one of these for a while.
This is my first attempt at a JAPH. Comments/critique
welcome.
Matt M.
--
$_= "Okay.. I finally got a round tuit."; @_ =(-5,107,36,45,11,24,
100,90,111,93,92,43,24,70,20,93,98,1,93,86,2,96,60,103,33,-61,1,0,
1,1,1,0,1,6) ;s /(\w)/ ord($1) /eg ;$, =[ /(\d{2})/g];$; =\$_ ;@;
=map {chr $,->[$_] +$_[$_] }-34 ..-9 ;${$; }=join q,,, @;; print
------------------------------
Date: Thu, 02 Aug 2007 12:08:52 -0700
From: it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1186081732.328530.231760@i13g2000prf.googlegroups.com>
On Aug 2, 12:20 am, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> it_says_BALLS_on_your forehead
> <simon.c...@fmr.com>], who wrote in article <1185994130.562023.205...@l70g2000hse.googlegroups.com>:
>
> > nvm, i gather it's in '$!'. On another note, does anyone know of any
> > reason besides 'No such process' that would lead to a return of 0 from
> > the kill function? trying to come up with actionable instructions for
> > support team.
>
> What OS? On most OSes, there may be unkillable processes (not even by
> root). [I rememeber getting ones on Solaris 2.6, when the floppy disk
> started to misfunction....]
This is SunOS 5.8.
------------------------------
Date: Thu, 02 Aug 2007 12:14:02 -0700
From: it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1186082042.148691.4660@i38g2000prf.googlegroups.com>
On Aug 2, 5:30 am, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On Wed, 01 Aug 2007 13:26:04 -0700, it_says_BALLS_on_your forehead
>
> <simon.c...@fmr.com> wrote:
> >> When directed at a process whose UID is not identical to that of the
> >> sending process, signal number zero may fail because you lack permission
> >> to send the signal, even though the process is alive. You may be able to
> >> determine the cause of failure using "%!".
>
> >did you really mean "%!"? or did you mean "$!"?
>
> Since he also wrote
>
> : unless (kill 0 => $pid or $!{EPERM}) {
> ^^^^^^^^^
> ^^^^^^^^^
> : warn "$pid looks dead";
> : }
>
> it's clear enough that he meant C<%!>.
hehe, clear to you perhaps :-). i hadn't recognized that '%!' was a
hash named '!'--to me, it was just a magic variable--nor did i
interpret $!{EPERM} to be a hash lookup. of course now that you've
explained it i see it clearly. thanks!
------------------------------
Date: Thu, 02 Aug 2007 12:15:27 -0700
From: it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1186082127.399095.113770@j4g2000prf.googlegroups.com>
On Aug 1, 5:22 pm, xhos...@gmail.com wrote:
> it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote:
> > On Aug 1, 3:09 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> > > it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote
> > > innews:1185993951.400313.206600@w3g2000hsg.googlegroups.com:
>
> > > > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
>
> > > > Thanks in advance for any assistance.
>
> > > perldoc perlipc
>
> > > 'Signals' has some information.
>
> > > When directed at a process whose UID is not identical to that of the
> > > sending process, signal number zero may fail because you lack
> > > permission to send the signal, even though the process is alive. You
> > > may be able to determine the cause of failure using "%!".
>
> > did you really mean "%!"? or did you mean "$!"?
cool, thanks. i've never come across that variable before. i just
incorrectly assumed A. Sinan fat-fingered it, since '%' is right next
to '$'.
------------------------------
Date: Thu, 2 Aug 2007 20:05:05 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <f8tddh$16vb$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
it_says_BALLS_on_your forehead
<simon.chao@fmr.com>], who wrote in article <1186081732.328530.231760@i13g2000prf.googlegroups.com>:
> > What OS? On most OSes, there may be unkillable processes (not even by
> > root). [I rememeber getting ones on Solaris 2.6, when the floppy disk
> > started to misfunction....]
> This is SunOS 5.8.
I think it should not matter. It is hard to imagine an OS
architecture which would not allow a device driver to define "Do not
interrupt programs which entered this chunk of my code" flag.
Anyone with more detailed knowledge?
Thanks,
Ilya
------------------------------
Date: Thu, 02 Aug 2007 22:30:40 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <jif4b356cplqaianp6s39qr12rk2ouclkh@4ax.com>
On Thu, 02 Aug 2007 12:14:02 -0700, it_says_BALLS_on_your forehead
<simon.chao@fmr.com> wrote:
>> Since he also wrote
>>
>> : unless (kill 0 => $pid or $!{EPERM}) {
>> ^^^^^^^^^
>> ^^^^^^^^^
>> : warn "$pid looks dead";
>> : }
>>
>> it's clear enough that he meant C<%!>.
>
>hehe, clear to you perhaps :-). i hadn't recognized that '%!' was a
>hash named '!'--to me, it was just a magic variable--nor did i
>interpret $!{EPERM} to be a hash lookup. of course now that you've
>explained it i see it clearly. thanks!
Yes, sorry. I suggest you to get familiar with "this kinda things".
Whaterver "this kinda things" is: basically, special (as in
"predefined") variables are just like all other ones. They just have
some strange names, but the syntax associated to them is not special
nor stranger than that of regular variables.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Thu, 02 Aug 2007 21:05:54 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <Xns9980ADF5D99C8asu1cornelledu@127.0.0.1>
it_says_BALLS_on_your forehead <simon.chao@fmr.com> wrote in
news:1186082127.399095.113770@j4g2000prf.googlegroups.com:
> On Aug 1, 5:22 pm, xhos...@gmail.com wrote:
>> it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote:
>> > On Aug 1, 3:09 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid>
>> > wrote:
>> > > it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote
>> > > innews:1185993951.400313.206600@w3g2000hsg.googlegroups.com:
>>
>> > > > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
>>
>> > > > Thanks in advance for any assistance.
>>
>> > > perldoc perlipc
>>
>> > > 'Signals' has some information.
>>
>> > > When directed at a process whose UID is not identical to that of
>> > > the sending process, signal number zero may fail because you lack
>> > > permission to send the signal, even though the process is alive.
>> > > You may be able to determine the cause of failure using "%!".
>>
>> > did you really mean "%!"? or did you mean "$!"?
>
> cool, thanks. i've never come across that variable before. i just
> incorrectly assumed A. Sinan fat-fingered it, since '%' is right next
> to '$'.
It should have been obvious that I copied and pasted the paragraph from
the Perl documentation I referenced. You did read:
perldoc perlipc
Right?
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and
reverse each component for email address)
comp.lang.perl.misc
guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Thu, 02 Aug 2007 14:23:48 -0700
From: it_says_BALLS_on_your forehead <simon.chao@fmr.com>
Subject: Re: if kill 9, $pid fails, is the error caught anywhere?
Message-Id: <1186089828.716065.184800@z24g2000prh.googlegroups.com>
On Aug 2, 5:05 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote innews:1186082127.399095.113770@j4g2000prf.googlegroups.com:
>
>
>
> > On Aug 1, 5:22 pm, xhos...@gmail.com wrote:
> >> it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote:
> >> > On Aug 1, 3:09 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid>
> >> > wrote:
> >> > > it_says_BALLS_on_your forehead <simon.c...@fmr.com> wrote
> >> > > innews:1185993951.400313.206600@w3g2000hsg.googlegroups.com:
>
> >> > > > in '$!' or '$?' perhaps? I couldn't find it in the perldocs.
>
> >> > > > Thanks in advance for any assistance.
>
> >> > > perldoc perlipc
>
> >> > > 'Signals' has some information.
>
> >> > > When directed at a process whose UID is not identical to that of
> >> > > the sending process, signal number zero may fail because you lack
> >> > > permission to send the signal, even though the process is alive.
> >> > > You may be able to determine the cause of failure using "%!".
>
> >> > did you really mean "%!"? or did you mean "$!"?
>
> > cool, thanks. i've never come across that variable before. i just
> > incorrectly assumed A. Sinan fat-fingered it, since '%' is right next
> > to '$'.
>
> It should have been obvious that I copied and pasted the paragraph from
> the Perl documentation I referenced. You did read:
>
> perldoc perlipc
>
> Right?
Apologies, I have now. Another reason i thought you had mistyped was
that I tried a simple script where I attempted to kill a pid that I
knew did not exist and printed the error message captured in $!, so I
thought that was where the messages were stored. It didn't occur to me
that another variable would also provide insight as to the nature of
the error. Thanks for your help.
------------------------------
Date: Thu, 02 Aug 2007 11:12:21 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: map & MIME::Parser
Message-Id: <46b20265$0$501$815e3792@news.qwest.net>
hobbzilla wrote:
> What is the equivelent of this code?
>
> map ({$_->bodyhandle->path() } @parts))
for my $obj ( @parts )
{
$obj->bodyhandle->path();
}
perldoc -f map
>
>
> It appears to be returning something like this /tmp/path/filename.txt/
> tmp/path/filename2.txt/tmp/path/filename3.txt - I really need it to
> send /tmp/path/filename2.txt /tmp/path/filename3.txt (so long as /tmp/
> path/filename.txt is the email body of the message -- I want the body
> discarded and just need the attachments..
>
> Please advise.
>
> The original script I am referencing is located here:
> http://people.ifax.com/~aidan/hylafax/mail2fax/mail2fax.pl.txt
It's probably easiest to filter @parts first, to the ones you're
interested in, in the while() loop, by only pushing certain
ones to @parts.
For the various methods you can call:
perldoc MIME::Parser
------------------------------
Date: Thu, 2 Aug 2007 21:23:09 +0200 (CEST)
From: Jim Cochrane <allergic-to-spam@no-spam-allowed.org>
Subject: Re: Object creation failure in perl
Message-Id: <slrnfb4boq.tsr.allergic-to-spam@no-spam-allowed.org>
On 2007-08-02, Paul Lalli <mritty@gmail.com> wrote:
> On Aug 2, 9:21 am, ramesh.thangam...@gmail.com wrote:
>> The thing here is the code is not failing always.
>
> That is not an important "thing". It is failing. Therefore, you did
> something wrong.
Not only that, but the fact that it is only sometimes failing makes the
problem worse. If it always failed in the same manner, finding and
fixing the problem is likely to be much easier than in your case, where
it only fails sometimes. Can you (OP) see why?
It's hard enough to fix an intermittent problem when you have access to
the code. You're asking people to help you find and fix the problem
without the code. Demanding the impossible, I'd say.
--
------------------------------
Date: Thu, 02 Aug 2007 22:34:12 +0200
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: Object creation failure in perl
Message-Id: <46b23fc5$0$27414$ba4acef3@news.orange.fr>
Paul Lalli wrote:
> On Aug 2, 9:21 am, ramesh.thangam...@gmail.com wrote:
>> The thing here is the code is not failing always.
>
> That is not an important "thing". It is failing. Therefore, you did
> something wrong.
>
>> I am using a cron wrapper script
>
> Also irrelevant.
Notwithstanding the remainder of this post, the fact that something runs
from cron can be relevant, since a process running from cron tends to
have very few environment variables set by default and the user's shell
startup script(s) isn't run.
Mark
------------------------------
Date: 02 Aug 2007 16:29:39 GMT
From: xhoster@gmail.com
Subject: Re: Perl and Sockets
Message-Id: <20070802122941.516$WA@newsreader.com>
"Zev G." <ZevGreenblatt@gmail.com> wrote:
Please don't top post.
> On Aug 1, 6:06 pm, xhos...@gmail.com wrote:
> > "Zev G." <ZevGreenbl...@gmail.com> wrote:
> > > Hi
> >
> > > I am working on a new project and the need to code in Sockets came
> > > up. I have also been told that the nature of sockets entails multi-
> > > threading. In other words, if my program is listening for a call, I
> > > need to make sure the user can use the computer for other stuff.
> >
> > Pretty much any modern general-purpose OS these days is multi-tasking,
> > so using the computer for other stuff is not a problem. Using the
> > same *program instance* for other stuff could be, though. Is that what
> > you meant?
> >
> not sure what a program instance is.
I was going to call it a "process", but I didn't know how platform-specific
that terminology is. I figure "program instance" is the abstract way
to describe it. If you don't know what either of those means, I'm afraid
I'm not prepared to hold your hand throughout your entire adventure in
computer-land.
> I am told that as opposed to
> other kinds of programs, a sockets program must make an API call to
> Windows in order to listen for incoming communication. Doing this will
> hog the processor and display an houglass and then they won't be able
> to get any other work done unless you use threading.
Either you were told incorrectly or you didn't understand what you were
told. You should direct your questions to the people who are telling you
this stuff. I'd rather not try to debate things with your boss using you as
an intermediary. Anyway, while I am typing this on my Windows machine, I
have a perl program waiting to accept a socket in another window. No hour
glass, no CPU hogging.
H:\>perl -le "use IO::Socket; my $foo=IO::Socket::INET->new(Listen=>5,
LocalPort => '9876') or die $@; my $c=$foo->accept(); print $foo; print $c"
> I am hoping to
> find a way to avoid using threading, so I'm wondering if the perl
> Sockets wrapper takes care of the threading needs for me.
I don't think you have the necessary background to know what "taking care
of it for me" would look like. All you have is some vague boogie-man of
FUD.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Thu, 02 Aug 2007 17:40:29 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Perl with DBI
Message-Id: <m2y7gtvcmq.fsf@lifelogs.com>
On Wed, 01 Aug 2007 19:55:09 -0700 Jason <jwcarlton@gmail.com> wrote:
J> I really appreciate all of your help, as well as the friendly manner
J> with which it was delivered. Seriously, you have no idea how much I
J> appreciate it.
You must sacrifice a porcupine at midnight in the Sahara to repay us.
Chant at will.
Ted
------------------------------
Date: 02 Aug 2007 16:42:58 GMT
From: xhoster@gmail.com
Subject: Re: Q on localizing *STDOUT and fork
Message-Id: <20070802124300.178$73@newsreader.com>
kj <socyl@987jk.com.invalid> wrote:
>
> My question is this: is there a way to avoid the bothersome saving
> and restoring of STDOUT. I naively thought that one could do so
> by localizing *STDOUT. IOW, replace the LOOK_HERE block with:
>
> {
> local *STDOUT;
> open STDOUT, '>&', $out or die $!;
>
> {
> open my $pipe, '|-', '/usr/bin/sort', '-n' or die $!;
> print $pipe int( rand( ~0 ) ), "\n" for 1..1_000_000;
> }
> }
>
> Very nice, except it doesn't work. Now the output /usr/bin/sort
> (which, incidentally, in this example happens to be pretty big)
> goes to the terminal.
The piped "sort" doesn't inherit the Perl notion of STDOUT, it inherits the
C's notion of stdout. When Perl starts, Perl's STDOUT "points" to C's
stdout. When you localize STDOUT, you break that linkage, and so whatever
is done to Perl's STDOUT doesn't affect C's stdout.
>
> I suspect that the problem with these failed solutions has to do
> with the implicit fork triggered by the '|-' mode in the call to
> open. I.e., I'm guessing that the child process uses the default
> STDOUT irrespective of the parent's maneuvers. But if this is the
> case, then my confusion simply shifts to wondering how the first
> approach could have worked at all!
When you reopen STDOUT without localizing it, it does this by reopening
C's notion of stdout and leaving Perl's STDOUT pointing to C's stdout.
Forked commands inherit this C notion, complete with the change made to it.
>
> Anyway, BTAIM, is there anyway to avoid the save/restore rigmarole?
You could do the redirect in the open command:
open my $pipe, '|-', "/usr/bin/sort -n > $filename", or die $!;
Alas, this requires you to use the shell-interpreted-version of the open
rather than the shell-less version.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Thu, 02 Aug 2007 10:31:40 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: XML Validation
Message-Id: <46b1f8dc$0$495$815e3792@news.qwest.net>
sln@netherlands.co wrote:
> On Wed, 25 Jul 2007 14:56:36 -0700, Shiraz <shirazk@gmail.com> wrote:
>
>> I am trying to use the XML simple to parse out some xml data. If I use
>> the code below with invalid xml, i just get a warning 'not well-formed
>> (invalid token) at line 1, column 16, byte 16 at /usr/local/lib/perl5/
>> site_perl/5.8.7/i686-linux/XML/Parser.pm line 187'
>> A test like 'unless (my $data = $xml->XMLin($msg) ) ' doesnt work
>> either.
>> Anyone know how to test for valid XML using just XML::Simple or would
>> i have to get a XML checking library
That is telling you it's invalid.
use XML::Simple;
use strict;
my $msg = '<xml><select app>orig_gw</select></xml>';
my $data;
eval {
my $xs = XML::Simple->new();
$data = $xs->XMLin( $msg );
};
print "Error: $@\n$msg\n";
>>
>> Thanks,
>>
>> code:
>> #!/usr/bin/perl
>> use strict;
>> use XML::Simple;
>> $|=1;
>> my $xml = new XML::Simple;
>> my $msg = '<xml><select app>orig_gw</select></xml>'; #this is bad xml
>> my $data = $xml->XMLin($msg)
>>
>> result:
>> not well-formed (invalid token) at line 1, column 16, byte 16 at /usr/
>> local/lib/perl5/site_perl/5.8.7/i686-linux/XML/Parser.pm line 187
There's something not right on the first line, column 16. You have to
figure out what's not correct.
[...]
> One of them is available here, RxParse, a pure Perl xml,xhtml parser
> that is excellent for that. Search the forum or google. I think the
> one posted was version 1.1
Please, don't even suggest people use that module. Search the newsgroup
to see why.
Use something more reliable, like XML::Validator::Schema, if you have
an XSD.
------------------------------
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 V11 Issue 711
**************************************