[22972] in Perl-Users-Digest
Perl-Users Digest, Issue: 5192 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 7 21:05:50 2003
Date: Mon, 7 Jul 2003 18:05:13 -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 Mon, 7 Jul 2003 Volume: 10 Number: 5192
Today's topics:
Re: Пока <bwalton@rochester.rr.com>
Re: Call parent method indirectly <ben.goldberg@hotpop.com>
Compiling the h2xs way. (kspecial@linuxmail.org)
Re: Compiling the h2xs way. <jkeen@concentric.net>
Re: Completely confused - system and $? == -1 <persicom@acedsl.com>
Re: Completely confused - system and $? == -1 <persicom@acedsl.com>
Re: Completely confused - system and $? == -1 <persicom@acedsl.com>
Re: Google's newsgroups <REMOVEsdnCAPS@comcast.net>
Re: Hanging pipes in CGI Perl <bwalton@rochester.rr.com>
Re: Hanging pipes in CGI Perl (Tad McClellan)
Re: Hanging pipes in CGI Perl (Tad McClellan)
Help with Perl Script <yyyy@yyy.com>
Re: Help with Perl Script <jkeen@concentric.net>
Re: Help with Perl Script <abuse@sgrail.org>
Re: Help with Perl Script <jurgenex@hotmail.com>
Re: How do I clone a structure? (Greg Bacon)
Re: How do I clone a structure? (John Brock)
how to share socket handle across threads? (Sebastien)
Re: my first japh (Bryan Castillo)
Re: Naming some arrays in a foreach loop?! <ben.goldberg@hotpop.com>
Net::NNTP Undefined value (Gene Mat)
Re: Net::NNTP Undefined value <tony_curtis32@yahoo.com>
Re: Net::NNTP Undefined value (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 08 Jul 2003 00:48:15 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Пока
Message-Id: <3F0A14C8.90200@rochester.rr.com>
Andrew wrote:
> До свидания,
> любители Perl.
>
This is a text-only newsgroup (i.e., not HTML), so most folks won't know
you typed in something in Russian. Even if they did, most of us don't
know much Russian. Sorry.
--
Bob Walton
------------------------------
Date: Mon, 07 Jul 2003 20:58:16 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: Call parent method indirectly
Message-Id: <3F0A1728.1B1BB946@hotpop.com>
Malte Ubl wrote:
>
> Bart Lateur wrote:
>
> > Steve Grazzini wrote:
> >
> >
> >>You can also do:
> >>
> >> $self->can("SUPER::$method")->(@args);
> >
> >
> > You forgot to pass along the object itself.
> >
> > $self->can("SUPER::$method")->($self, @args);
>
> Not that many people would care, but this is not thread safe!
It's only thread-unsafe if you're using the very deprecated 5.005
threading model.
> The return value of C<can> can change over time, and time passes
> between: $self->can("SUPER::$method")
> and:
> ->($self, @args);
Maybe, but AFAIK, the only way that could possibly occur between the two
operations, in either non-threaded perl, or in perl with ithreads, would
be if we altered something through a signal handler.
Futhermore, so what? If @ISA of a module changes, or some method gets
added... well, we end up calling what can() returned, which is
"outdated" by a few microseconds, instead of the new value. If we'd
called the method directly, instead of with the intervention of can(),
then we'd probably still have gotten the "wrong" subroutine.
A slightly bigger deal is that ->can() might not call UNIVERSAL::can,
but instead call some class's overriden version of it.
> No biggie, if you are not messing with @ISA at runtime or put code
> references in it:
>
> push @ISA, sub { rand > 0.5 ? "Hello::World" : "Destroy::HD" }
I know that you can put coderefs into @ISA, but I've never heard of them
going into @INC.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: 7 Jul 2003 15:56:25 -0700
From: kspecial@linuxmail.org (kspecial@linuxmail.org)
Subject: Compiling the h2xs way.
Message-Id: <365f784f.0307071456.6961d899@posting.google.com>
My name is Noah. What i'm trying to figure out is how I can
compile this module: Win32::Scheduler. Most modules can simply be
inserted, be compiled (if you will) with a Makefile, or if there is
not one made, h2xs.
Now. H2xs is probably what i'm going to need *not quite sure.
Check out how the file directory looks:
~\scheduler\blib\lib\Win32:
--> Scheduler.PM
--> Scheduler(Directory)
\Scheduler:
-->CopyJobs.pl
-->TEST.PL
-->Win32-Scheduler.ppd
-->TIE_Scheduler.xpp
-->TIE_Task.xpp
-->CONSTANT.CPP
-->Scheduler.cpp
-->TIE_Task.cpp
-->TIEFunctions.cpp
-->CONSTANT.H
-->Scheduler.hpp
-->SchedulerBuild.h
-->VERSION.H
-->Scheduler.dsp
-->Scheduler.dsw
-->Scheduler.def
-->win32perl.h
-->CUString.lib
-->CUString.hpp
<EOF>-----------------------------------<EOF>
Quite UGLY I might add, but as you can see i have tried to
spiff it up for whomever may be reading.
So. ANY clues or small hint's (weeny) would be helpfull.
Thank you.
--K-sPecial
------------------------------
Date: 07 Jul 2003 23:31:04 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Compiling the h2xs way.
Message-Id: <becvro$c17@dispatch.concentric.net>
<kspecial@linuxmail.org> wrote in message
news:365f784f.0307071456.6961d899@posting.google.com...
> My name is Noah. What i'm trying to figure out is how I can
> compile this module: Win32::Scheduler. Most modules can simply be
> inserted, be compiled (if you will) with a Makefile, or if there is
> not one made, h2xs.
>
> Now. H2xs is probably what i'm going to need *not quite sure.
> Check out how the file directory looks:
>
> ~\scheduler\blib\lib\Win32:
[snip]
My hunch is that you are referring to this CPAN module.
http://search.cpan.org/src/DAVEROTH/Win32-Scheduler_v20000702/lib/Win32/Sche
duler/
The author does not appear to have provided a README, so we can only guess
at how it should be installed. Perhaps you should correspond directly with
him: rothd@roth.net
------------------------------
Date: Mon, 07 Jul 2003 20:12:50 -0400
From: "Matthew O. Persico" <persicom@acedsl.com>
To: nobody
Subject: Re: Completely confused - system and $? == -1
Message-Id: <3F0A0C82.7020507@acedsl.com>
Villy Kruse wrote:
> On Mon, 07 Jul 2003 01:27:15 -0400,
> Matthew O. Persico <persicom@acedsl.com> wrote:
>
>
>
>>Matthew O. Persico wrote:
>>
>>>Steve Grazzini wrote:
>>>
>>>
>>>>Matthew O. Persico <persicom@acedsl.com> writes:
>>>>
>>>>
>>>>>Sometimes, I get -1 back from system or $? is -1 with the backticks.
>>>>>I am using perl 5.6.1 on Solaris 2.7. Does this imply that somehow, a
>>>>>shell is being called on my behalf even though the backticks have no
>>>>>shell characters and the system command uses the list form?
>>>>
>>>>Nope.
>>>>
>>>>It means that, during the failed call, either fork(), exec()
>>>>or waitpid() failed and you need to check $! instead.
>>>>
>>
>>Ok, folks, time to scratch my head once again. Upon taking the above
>>advice, I stepped into my program using the debugger to check $!. Have a
>>look:
>>
>> DB<2> n
>>AMG::System::system(/am/common/lib/site_perl/5.6.1/AMG/System.pm:119):
>>119: waitpid($pid,0);
>> DB<2> n
>>AMG::System::system(/am/common/lib/site_perl/5.6.1/AMG/System.pm:120):
>>120: my $status = $?;
>> DB<2> print $! + 0 . "->$!"
>>10->No child processes
>>
>>No child processes? What the ...? The process was out there; the
>>waitpid() call waited until the job was finished and the work that the
>>job was supposed to do was done. I'm on a Solaris 2.7 system. Note that
>>I do lots of calls and waitpids, but only certain programs fail. What
>>should I look for in those programs - I know that they exit with
>>explicit exit() calls when done.
>>
>
>
>
> Since you are on Solaris, do trace the program with truss and check if there
> are any calls to wait/waitpid which aren't accounted for in the code.
> There are some perl functions which have a hidden call to wait/waitpid,
> such as system() or open() specifying a pipe.
>
What should I truss? The perl parent or perl child?
> Villy
------------------------------
Date: Mon, 07 Jul 2003 20:14:53 -0400
From: "Matthew O. Persico" <persicom@acedsl.com>
To: Rick Delaney <rick.delaney@rogers.com>
Subject: Re: Completely confused - system and $? == -1
Message-Id: <3F0A0CFD.4010806@acedsl.com>
Rick Delaney wrote:
> "Matthew O. Persico" <persicom@acedsl.com> writes:
>
>
>>Matthew O. Persico wrote:
>> DB<2> n
>>AMG::System::system(/am/common/lib/site_perl/5.6.1/AMG/System.pm:119):
>>119: waitpid($pid,0);
>> DB<2> n
>>AMG::System::system(/am/common/lib/site_perl/5.6.1/AMG/System.pm:120):
>>120: my $status = $?;
>> DB<2> print $! + 0 . "->$!"
>>10->No child processes
>>
>>No child processes? What the ...? The process was out there; the
>>waitpid() call waited until the job was finished and the work that the
>>job was supposed to do was done. I'm on a Solaris 2.7 system.
>
>
> In addition to the other good advice, make sure that SIG_CHLD is not
> being ignored for these children. If it is then waitpid will still
> block but it will return -1 and set errno ($!) to ECHILD.
>
OOOOOOOOOH! I think you may have hit that nail! I used to do waits on
SIG CHILD to collect the Perl kids, but I abandoned that in favor of
polling (kill 0) because that later is more reliable. I just might have
a left-over IGNORE someplace. I'll check it out. Thanks!
------------------------------
Date: Mon, 07 Jul 2003 20:28:36 -0400
From: "Matthew O. Persico" <persicom@acedsl.com>
Subject: Re: Completely confused - system and $? == -1
Message-Id: <3F0A1034.4050806@acedsl.com>
Matthew O. Persico wrote:
> Rick Delaney wrote:
>
>> "Matthew O. Persico" <persicom@acedsl.com> writes:
>>
>>
>>> Matthew O. Persico wrote:
>>> DB<2> n
>>> AMG::System::system(/am/common/lib/site_perl/5.6.1/AMG/System.pm:119):
>>> 119: waitpid($pid,0);
>>> DB<2> n
>>> AMG::System::system(/am/common/lib/site_perl/5.6.1/AMG/System.pm:120):
>>> 120: my $status = $?;
>>> DB<2> print $! + 0 . "->$!"
>>> 10->No child processes
>>>
>>> No child processes? What the ...? The process was out there; the
>>> waitpid() call waited until the job was finished and the work that the
>>> job was supposed to do was done. I'm on a Solaris 2.7 system.
>>
>>
>>
>> In addition to the other good advice, make sure that SIG_CHLD is not
>> being ignored for these children. If it is then waitpid will still
>> block but it will return -1 and set errno ($!) to ECHILD.
>>
>
> OOOOOOOOOH! I think you may have hit that nail! I used to do waits on
> SIG CHILD to collect the Perl kids, but I abandoned that in favor of
> polling (kill 0) because that later is more reliable. I just might have
> a left-over IGNORE someplace. I'll check it out. Thanks!
>
>
YOU DA MAN! That's exactly it. I set SIG{CHLD}='IGNORE' in the Perl
parent to non-zombie the kids. When I stepped in and did SIG{CHLD}=undef
just before the system call, the call came back correctly!
Now all I have to do is figure out why most of my calls work correctly,
but only some do not - I must be doing implicit SIG{CHLD}=undef calls
depending on whether or not I am using the DBI connections.
Thank you thank you thank you. Who says .misc is all noise and no signal?!
------------------------------
Date: Mon, 07 Jul 2003 19:10:16 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Google's newsgroups
Message-Id: <Xns93B1CD1C8E945sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Abigail <abigail@abigail.nl> wrote in
news:slrnbgjr2p.tmv.abigail@alexandra.abigail.nl:
> Eric J. Roode (REMOVEsdnCAPS@comcast.net) wrote on MMMDXCVII September
> MCMXCIII in <URL:news:Xns93B1B168DE363sdn.comcast@206.127.4.25>:
>:}
>:} How does Google filter newsgroups?
>:}
>
> What makes you think this newsgroup is the place to ask about Google's
> policies? Or have you determined that this is the only group which
> gets "filtered" by Google?
You're right, of course, and I should have known better. This is the only
newsgroup I had noticed it for, but then, I don't read many groups. You're
right, there must be better places to ask.
- --
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/AwUBPwoLyGPeouIeTNHoEQJr/gCeINC9aYTjYwOPhPa9f17uFWIzyOEAoOJe
fUmvC003GyB48RKt0FkrzCE+
=hWgG
-----END PGP SIGNATURE-----
------------------------------
Date: Mon, 07 Jul 2003 23:10:01 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Hanging pipes in CGI Perl
Message-Id: <3F09FDC3.2040506@rochester.rr.com>
Christophe Baegert wrote:
...
> I have a big problem with pipes and Perl.
>
> I made a program A, with these lines
>
> open(PROGB,"|progb") or die "$!";
> print PROGB $text;
> close PROGB;
>
> And program B is :
>
> open(FILE,">/tmp/file") or die "$!";
> wile($line=<STDIN>){
h--^
*please* copy/paste working code, don't just type it in!!!
> print FILE $line;
> }
> close FILE;
>
> It runs perfectly when launched in shell, but when I run it in CGI mode, it
> hangs, without any error message (it runs without problem if I comment the
> part opening and writing to PROGB)
>
> I have this problem in a lot of perl scripts. Every time it occurs, the cgi
> scrip stays undefinitely up, I have to kill it manually. I'm looking for
> the reason of the problem since a whole year ! I never found the answer. I
> really never saw a so strange problem. Please help !!!
Have you studied and followed *all* the references and recommendations
found in:
perldoc -q 500
? Your problem is almost certainly associated with one of those items.
For example, on my system, I had to specify the directory where I
stored progb in order for Perl to find it -- that is a matter of web
server configuration, and will vary from web server to web server,
depending upon exactly how the web server is configured.
Another item: I did not notice:
use CGI;
in your scripts. You are missing the boat big-time if you're writing
Perl CGI scripts without this module.
There was a conspicuous absence of a header line generated in the
scripts you provided, as well as a #! line to tell Linux you want to use
the Perl interpreter to execute your scripts.
If you clean all that up, it should run and do what you appear to want
it to do (although why you want to do it that way isn't readily
apparent). It "works" on my system with those cleanups.
I seriously doubt your problem actually has anything to do with the use
of pipes, and is most likely a server configuration problem or a
misunderstanding of what your server configuration means in terms of
executing programs from a CGI script running on your server. Start out
by specifying an absolute path for progb and see if that helps. Note
that problems with web server configuration are off-topic for this
newsgroup.
HTH.
...
> Christophe
--
Bob Walton
------------------------------
Date: Mon, 7 Jul 2003 18:55:18 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Hanging pipes in CGI Perl
Message-Id: <slrnbgk236.3ap.tadmc@magna.augustmail.com>
Christophe Baegert <cbaegert-pas-de-spam@europeanservers.net> wrote:
> And program B is :
>
> open(FILE,">/tmp/file") or die "$!";
> wile($line=<STDIN>){
It is?
Doesn't that generate a syntax error?
[ Have you seen the Posting Guidelines that are posted here frequently? ]
> It runs perfectly
I gotta say I don't believe you there.
I think it must compile _before_ it can run, even imperfectly.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 7 Jul 2003 19:09:33 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Hanging pipes in CGI Perl
Message-Id: <slrnbgk2tt.3ap.tadmc@magna.augustmail.com>
Christophe Baegert <cbaegert-pas-de-spam@europeanservers.net> wrote:
> I made a program A, with these lines
>
> open(PROGB,"|progb") or die "$!";
Is progb in your current working directory (cwd)?
Does it work if you use an absolute path rather than a
relative path to the program?
> print PROGB $text;
You never defined a value for $text, so the print() will make no output...
> close PROGB;
>
> And program B is :
>
> open(FILE,">/tmp/file") or die "$!";
^^^^
^^^^ a useless use of quotes
See the Perl FAQ:
What's wrong with always quoting "$vars"?
> wile($line=<STDIN>){
... so the wile loop (sic) is never entered.
> It runs perfectly when launched in shell, but when I run it in CGI mode, it
> hangs,
See the Perl FAQ:
My CGI script runs from the command line but not the browser.
> Please help !!!
It is obvious that we do not have the real code, so we cannot do that.
> My Perl setup
Your Perl setup does not matter.
Since you said it is working from the command line, your perl must
be working fine.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 07 Jul 2003 23:30:42 GMT
From: "Robert" <yyyy@yyy.com>
Subject: Help with Perl Script
Message-Id: <ConOa.184174$nr.8348239@twister.southeast.rr.com>
Any help on this would be great since its a free script there is no support.
I have a website on a win2k server running MSFP 2002 extensions. The script
should create a html file on the fly but it won't. The script is one of
those post card scripts that sends an e-mail and a link to the card. All
works fine except for the card creation. The e-mail it sends contains a link
but when clicked you get the 404 error.
Anybody PLEASE HELP
Robert
------------------------------
Date: 07 Jul 2003 23:43:55 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Help with Perl Script
Message-Id: <bed0jr$c1c@dispatch.concentric.net>
"Robert" <yyyy@yyy.com> wrote in message
news:ConOa.184174$nr.8348239@twister.southeast.rr.com...
> Any help on this would be great since its a free script there is no
support.
> I have a website on a win2k server running MSFP 2002 extensions. The
script
> should create a html file on the fly but it won't. The script is one of
> those post card scripts that sends an e-mail and a link to the card. All
> works fine except for the card creation. The e-mail it sends contains a
link
> but when clicked you get the 404 error.
> Anybody PLEASE HELP
> Robert
>
>
Please study the Posting Guidelines for this Usenet news group before
posting:
http://groups.google.com/groups?q=Posting+Guidelines+group:comp.lang.perl.mi
sc+group:comp.lang.perl.misc&hl=en&lr=&ie=UTF-8&group=comp.lang.perl.misc&sa
fe=off&scoring=d&selm=kbCdnWZGuuE_bWajRTvU2Q%40august.net&rnum=4
------------------------------
Date: Mon, 07 Jul 2003 23:53:14 GMT
From: derek / nul <abuse@sgrail.org>
Subject: Re: Help with Perl Script
Message-Id: <fu1kgvssgiojoub1aleqa5kgtpfe7sla5i@4ax.com>
On Mon, 07 Jul 2003 23:30:42 GMT, "Robert" <yyyy@yyy.com> wrote:
>Any help on this would be great since its a free script there is no support.
>I have a website on a win2k server running MSFP 2002 extensions. The script
>should create a html file on the fly but it won't. The script is one of
>those post card scripts that sends an e-mail and a link to the card. All
>works fine except for the card creation. The e-mail it sends contains a link
>but when clicked you get the 404 error.
>Anybody PLEASE HELP
>Robert
You won't get any better answer the second time.
------------------------------
Date: Tue, 08 Jul 2003 01:03:47 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Help with Perl Script
Message-Id: <TLoOa.40782$JY1.31386@nwrddc01.gnilink.net>
You may want to choose a better subject. If you are posting in this NG then
it better is a posting about Perl or a Perl script. And most of the postings
here are requests for help.
So you just missed the one most important chance of getting someones
attention.
Robert wrote:
> Any help on this would be great since its a free script there is no
> support. I have a website on a win2k server running MSFP 2002
> extensions. The script should create a html file on the fly but it
> won't. The script is one of those post card scripts that sends an
> e-mail and a link to the card. All works fine except for the card
> creation.
Well, then I guess you need to check the "card creation" subroutine.
Did you see the syntax error on line 42?
> The e-mail it sends contains a link but when clicked you
> get the 404 error. Anybody PLEASE HELP
Maybe "perldoc -q 500" might help you fixing it.
jue
------------------------------
Date: Mon, 07 Jul 2003 23:23:58 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: How do I clone a structure?
Message-Id: <vgk08eked6t193@corp.supernews.com>
In article <bechen$258$1@nets3.rz.RWTH-Aachen.DE>,
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
: [...]
:
: This doesn't mean that the word should be erased from this FAQ (people
: might still be able to find this entry with it). But Brian is right
: insofar as the recursiveness is often the best way for an
: implementation so using it as an adverb as he suggested is technically
: more correct.
Even the humble array can be viewed as being a recursive data structure,
but the questions elicit very different answers:
How do I print out or copy a recursive data structure?
sub print_recursive_data_structure {
for (@_) {
print $_, "\n";
}
}
How do I recursively print out or copy a data structure?
sub print_data_structure_recursively {
if (@_) {
print shift(), "\n";
&print_data_structure_recursively;
}
}
Used as an adverb, 'recursively' modifies the verb 'print'. Used as an
adjective, 'recursive' modifies the noun 'data structure'. The
questions are not equivalent.
Greg, spricht English als Muttersprache :-)
--
I sincerely believe . . . that banking establishments are more dangerous
than standing armies, and that the principle of spending money to be paid
by posterity under the name of funding is but swindling futurity on a
large scale. -- Thomas Jefferson
------------------------------
Date: 7 Jul 2003 19:46:37 -0400
From: jbrock@panix.com (John Brock)
Subject: Re: How do I clone a structure?
Message-Id: <bed0ot$r63$1@panix1.panix.com>
In article <bechen$258$1@nets3.rz.RWTH-Aachen.DE>,
Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>Also sprach Greg Bacon:
>
>> In article <u9llva47rc.fsf@wcl-l.bham.ac.uk>,
>> Brian McCauley <nobull@mail.com> wrote:
>>
>>: tadmc@augustmail.com (Tad McClellan) writes:
>>: > Your Question is Asked Frequently:
>>: >
>>: > How do I print out or copy a recursive data structure?
>>: Is it just me, or does the word order above seem strange?
>>:
>>: Surely is should read:
>>:
>>: "How do I recursively print out or copy a data structure?"
>> The questions aren't equivalent, but the difference is subtle. Who
>> cares how (e.g., recursively or iteratively) you print the data?
>>
>> Mark me down in the "just you" column. :-)
>I don't see where Perl data structures are recursive. A recursive data
>structure is for instance a linked list as we know it from C. In Perl
>structures are usually not recursive but simply nested iteratively
>(hash-ref in an array-ref in a hash etc).
>
>This doesn't mean that the word should be erased from this FAQ (people
>might still be able to find this entry with it). But Brian is right
>insofar as the recursiveness is often the best way for an
>implementation so using it as an adverb as he suggested is technically
>more correct.
I still think "clone" is the most appropriate term, and I don't
understand why the FAQ didn't use it. Maybe the FAQ question
predates the popular use of the word "clone"?
--
John Brock
jbrock@panix.com
------------------------------
Date: 7 Jul 2003 15:25:46 -0700
From: seb@eseb.net (Sebastien)
Subject: how to share socket handle across threads?
Message-Id: <395938ea.0307071425.3dc3385a@posting.google.com>
Hello,
I've been rtfm'ing for days but can't a solution to this problem:
I have a thread that receives multiple client request thanks to an
endless loop through the accept() method. The new socket object
returned by accept() must be communicated to another master thread. I
am using the IO::Socket module.
When trying to use threads::shared or Thread::Queue, I keep getting
this failure:
Invalid value for shared scalar at ./X.pl line N.
So is there a way to share a socket/file handle accross threads?
Thank you
Sebastien
------------------------------
Date: 7 Jul 2003 16:21:01 -0700
From: rook_5150@yahoo.com (Bryan Castillo)
Subject: Re: my first japh
Message-Id: <1bff1830.0307071521.4a426e8d@posting.google.com>
"LaDainian Tomlinson" <go@away.spam> wrote in message news:<CAhOa.14885$1a6.4675@lakeread01>...
> "Bryan Castillo" wrote:
> > Here is my first attempt at a JAPH. Any pointers on how to shorten
> > it up more and obscure it?
> >
> > $|++;print"\033[2J";$f="\033[5;%dH%s";$x=33;END{print"\n\n"}
> > @_=map{[--$x,$_]}split//,'rekcaH lreP rehtonA tsuJ';
> > select'','','',(printf$f,@{splice@_,rand@_,1})/10 while(@_);
>
> I actually wrote my first a few days ago too (in my signature). Can't offer
> any advice on obscuring yours, but you may consider only using double quotes
> so that the whole command is executable from a command line using single
> quotes (i.e., perl -e '<code>'). Other than that, I like it. Made me look
> up select()...
>
allright then...
perl -e '$|++;sub Z{printf@_};@_=map{[--($X||=33),$_]}split//,",rekcaH lreP ".
"rehtonA tsuJ";Z "\033[2J";eval"map{select".(qq!"",!x3)."(Z \"\\033[5;%dH%s\",".
"\@{splice"."\@_,rand\@_,1})/10}(1..".@_.")";Z "\033[20;1H"'
(I guess I should mention this only works with a terminal that
accepts ANSI escape sequences.)
> Brandan L.
------------------------------
Date: Mon, 07 Jul 2003 18:42:36 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: Naming some arrays in a foreach loop?!
Message-Id: <3F09F75C.C17F1D2A@hotpop.com>
Thomas Becker wrote:
>
> Hey guys,
>
> I've to read out some rows of some mysql db. No problem at all.
>
> But I've to seperate the results for different machines.
> So I tried the following:
>
> while (@data = $sth->fetchrow_array()){
> push @$i_date, $data[0];
> push @$i_totalmem, $data[1];
> push @$i_residentmem, $data[2];
> push @$i_sharedmem, $data[3];
> push @$i_privatemem, $data[4];
> push @$i_cpu, $data[5];
> push @$i_connections, $data[6];
> }
>
> Surely it does not work. :( How can I give the arrays names containing
> $i?
Try this:
while( my @row = $sth->fetchrow_array ) {
push @{$data[$i]{$_}}, shift @row for qw(
date totalmem residentmem sharedmem cpu connections);
}
Then, look in $data[$i]{date} for what you are calling $i_date, etc..
It would probably be safer to do:
$sth->{FetchHashKeyName} = "NAME_lc";
while( my $row = $sth->fetchrow_hashref ) {
push @{$data[$i]{$_}}, $row->{$_} for qw(
date totalmem residentmem sharedmem cpu connections);
}
So that if the order of columns in the table changes, your code won't
get confused.
> And then I want to create some Graphs using GD:Graph (nice module).
> How can I access every of the arrays created above seperately?
>
> Again I tried something stupid:
>
> foreach $i (@welo){
> $my_graph->set_legend("$i_totalmem","$i_residentmem",
> "$i_sharedmem","$i_privatemem","$i_cpu","$i_connections");
> $gd = $my_graph->plot([\@$i_date, \@$i_totalmem,
> \@$i_residentmem, \@$i_sharedmem, \@$i_privatemem, \@$i_cpu,
> \@$i_connections])
> or die $my_graph->error;
> }
foreach $i (@welo) {
my @graph_this = qw(
date totalmem residentmem sharedmem cpu connections);
my @labels = map "${i}_$_", @graph_this[1..$#graph_this];
$my_graph->set_legend( @labels );
my @data = @{$data[$i]}{@graph_this};
my $gd = $my_graph->plot( \@data )
or die $my_graph->error;
}
> Surely it doesn't work at all. :)
> Can someone give me a clue?
You're looking for symbolic references, but don't do that.
http://perl.plover.com/varvarname.html
http://perl.plover.com/varvarname2.html
http://perl.plover.com/varvarname3.html
Use an @data array instead. (Or maybe, a %data hash, and $data{$i}
instead of $data[$i]. It depends on what types of values $i will be.)
> I do not get this done by myself. I've got no clue.
>
> Thx ALOT, Thomas
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Mon, 07 Jul 2003 23:45:58 GMT
From: geneSPAMAWAYmat@yahoo.com (Gene Mat)
Subject: Net::NNTP Undefined value
Message-Id: <Xns93B1C915253FDgeneSPAMAWAYmatyahoo@167.206.3.2>
Hi, I'm trying to build a simple program to list all the newsgroups in the
server. However, I can't get this program to run, here's what I have.
#!/opt/local/bin/perl
use Net::NNTP;
$nntp = Net::NNTP->new("nntp.perl.org",Debug,10);
my $LIST=nntp->list;
$nntp->quit;
Can't call method "list" on an undefined value at ./getnntp.pl line 13.
Other methods of the Net::NNTP work fine, including
article,group,xover,date,etc. Just the list, active and newsgroups methods
die with undefined value error.
Please Help.
Gene Mat
------------------------------
Date: Mon, 07 Jul 2003 18:52:23 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Net::NNTP Undefined value
Message-Id: <87isqdnbd4.fsf@limey.hpcc.uh.edu>
>> On Mon, 07 Jul 2003 23:45:58 GMT,
>> geneSPAMAWAYmat@yahoo.com (Gene Mat) said:
> Hi, I'm trying to build a simple program to list all the
> newsgroups in the server. However, I can't get this
> program to run, here's what I have.
> my $LIST=nntp->list;
^^^
hth
t
------------------------------
Date: Mon, 7 Jul 2003 19:22:35 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Net::NNTP Undefined value
Message-Id: <slrnbgk3mb.3da.tadmc@magna.augustmail.com>
Gene Mat <geneSPAMAWAYmat@yahoo.com> wrote:
> my $LIST=nntp->list;
^^^^^
> Please Help.
Please ask a machine to help you *before* asking thousands of
people around the world to help you.
You should always enable warnings when developing Perl code.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 5192
***************************************