[28613] in Perl-Users-Digest
Perl-Users Digest, Issue: 9977 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 17 18:05:43 2006
Date: Fri, 17 Nov 2006 15:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Nov 2006 Volume: 10 Number: 9977
Today's topics:
[OT] Salmon [Was: Re: help CGI in perl and C] <someone@example.com>
Re: best practice to avoiding excessive memory usage?? <tzz@lifelogs.com>
Re: best practice to avoiding excessive memory usage?? (reading news)
Re: Do I *have* to use 'OOP' to use modules? <spamtrap@dot-app.org>
Re: Do I *have* to use 'OOP' to use modules? <john@castleamber.com>
Re: Do I *have* to use 'OOP' to use modules? <tzz@lifelogs.com>
Re: Do I *have* to use 'OOP' to use modules? <cwilbur@chromatico.net>
Re: FAQ 5.11 How can I write() into a string? <jgibson@mail.arc.nasa.gov>
Re: FAQ 5.11 How can I write() into a string? anno4000@radom.zrz.tu-berlin.de
help CGI in perl and C gmclee@21cn.com
Re: help CGI in perl and C <spamtrap@dot-app.org>
Re: help CGI in perl and C <john@castleamber.com>
Re: help CGI in perl and C <yankeeinexile@gmail.com>
Re: help CGI in perl and C <uri@stemsystems.com>
Re: help CGI in perl and C <critterstown@googlemail.com>
Re: How to make Perl's regex engine "halt" after a matc <jgibson@mail.arc.nasa.gov>
Re: howto POST and leave site? <spamtrap@dot-app.org>
Re: OT: O'Reilly 'Perl CD Bookshelf' - gone for good? <john@castleamber.com>
Re: Perl redirection to browser timeout ... xhoster@gmail.com
Re: Perl redirection to browser timeout ... <newsgroup@cleanmymailbox.com>
Re: threads crash on XP (in Tk script) <brian.raven@osbsl.co.uk>
Re: what the difference between these loops? <spam.meplease@ntlworld.com>
Re: what the difference between these loops? <john@castleamber.com>
Re: what the difference between these loops? <john@castleamber.com>
Re: what the difference between these loops? <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Nov 2006 22:01:12 GMT
From: "John W. Krahn" <someone@example.com>
Subject: [OT] Salmon [Was: Re: help CGI in perl and C]
Message-Id: <Iiq7h.97$rB6.63@clgrps13>
Uri Guttman wrote:
>>>>>>"LSX" == Lawrence Statton XE2/N1GAK <yankeeinexile@gmail.com> writes:
>
> LSX> I write CGI in Perl, and my boss is coming to dinner. Do you have any
> LSX> good salmon recipes that would show I know how to write good Perl
> LSX> code? :)
>
> i write perl and love to cook salmon. i just bought about 1lb of wild
> salmon today from a great local fishmonger for $14/lb.
Pacific or Atlantic salmon?
> i will probably
> broil or grill it with possibly an herbed butter for a topping. yum! i
> should write a cpan module on this.
The grocer I go to sells it pre-prepared marinated in herbs and lemon, I
usually bake it. Mmmmmmm, salmon!
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Fri, 17 Nov 2006 20:53:12 +0000
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: best practice to avoiding excessive memory usage??
Message-Id: <g69r6w1bxs7.fsf@lifelogs.com>
On 17 Nov 2006, ithinkiam@gmail.com wrote:
> OK. That's what I'll do for the time being. However, I'm still
> interested in hearing how other people have overcome this problem.
As the size of your data grows, the solutions grow more complex too.
Everyone knows how to manage data = 1% of the system memory well. Few
manage data that is 500% of the system memory well.
Depending on your application you'll have to find the right solution.
Usually you'll end up with a database (not necessarily RDBMS) or
you'll split your data into several manageable pieces, to be processed
and loaded sequentially on one server or in parallel on multiple
servers.
For most problems, using a RDBMS database is the fastest, cheapest,
simplest way to manage large amounts of data. You see, then you can
just blame the DBAs when things don't work right :)
Ted
------------------------------
Date: Fri, 17 Nov 2006 22:12:23 GMT
From: "Mumia W. (reading news)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: best practice to avoiding excessive memory usage??
Message-Id: <btq7h.40$1s6.14@newsread2.news.pas.earthlink.net>
On 11/17/2006 08:38 AM, Chris wrote:
> I've come across the perl issue of inefficient use of memory when
> dealing with large datasets. What are people's opinions on the best way
> to work around this problem.
>
> e.g.
>
> My input file has this layout:
> # Input 1_8:
> 0.28496 0.10340 0.33403 0.86176 0.06723 0.15316 0.46009 0.09535 ...
> # Output 1_8:
> 0 0 1
> # Input 1_9:
> 0.38225 0.98944 0.03805 0.04031 0.05417 0.19623 0.07656 0.07944 ...
> # Output 1_9:
> 0 0 1
> # Input 1_10:
> 0.11106 0.02792 0.69635 0.37519 0.01326 0.95435 0.15976 0.01406 ...
> # Output 1_10:
> 0 0 1
>
> With ~73000 pairs of input and outputs. The file is ~260Mb is size.
> However when reading the file into an array with the following code
> snippet results in 1.2Gb of memory usage:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> my ($patfile) = @ARGV;
>
> open(my $FH, $patfile) or die;
> my @array;
> my $flag = 0;
> my $i = 0;
>
> while (<$FH>) {
> $flag = 0 if (/^\# Output/);
> $flag = 1 and next if (/^\# Input/);
> if ($flag) {
> chomp;
> print "$i\n";
> $array[$i] = [ split ];
> ++$i;
> }
> }
> exit;
>
> I've read about the various work-arounds to access the array via a file
> on disk, but they don't seem to be very conducive for working with
> complex data structures. Can you guys/gals let me know of their
> favourite method to work more efficiently as at the moment I'm just
> reading/writing the files a bit at a time?
> TIA
Arrays have a lot of overhead, so don't split the lines into arrays,
just put them into the main array without splitting.
When you need the data from a line, split it then.
--
paduille.4060.mumia.w@earthlink.net
------------------------------
Date: Fri, 17 Nov 2006 14:21:43 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Do I *have* to use 'OOP' to use modules?
Message-Id: <m2d57lyj3s.fsf@Sherm-Pendleys-Computer.local>
Merrilee Larson <merrile@telus.net> writes:
> On 2006-11-17, Ian Wilson <scobloke2@infotop.co.uk> wrote:
>> Merrilee Larson wrote:
>>> Hi...
>>>
>>> I'm not sure why, but I can't stand OOP. That's it!
>>
>> Perhaps you're just waiting for an epiphany?
>
> Maybe... but I seriously doubt it!
>
>
>>> Sooo....is it possible to be fully productive using Perl5 in a non-OOP
>>> fashion? Can I still use modules, etc? Or would I be severely restricting
>>> myself?
>>
>> Your question is expressed in an overly bipolar fashion, the truth
>> probably lies somewhere "fully productive" and "severely restricted".
>
> Do you mean to say that C programmers are *less* productive, as a rule,
> than C++ programmers?
As a rule - yes, they are. That fact that *you* don't grok OOP doesn't
prevent a great many others from benefiting from it.
>> I think you would probably be OK. You mention web-sites being a primary
>> focus, The CGI module has both an OO and a procedural interface.
>
> Good to know! Is that typical of most modules, or only a selected few? Is
> there a (slick) way of determining this?
CGI.pm is definitely in the minority in this respect. The way to determine
whether a given module uses OOP is to read its docs.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 17 Nov 2006 20:24:25 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Do I *have* to use 'OOP' to use modules?
Message-Id: <Xns987E928DA40C1castleamber@130.133.1.4>
Merrilee Larson <merrile@telus.net> wrote:
> Hi...
>
> I'm not sure why, but I can't stand OOP. That's it!
Why?
> Sooo....is it possible to be fully productive using Perl5 in a non-OOP
> fashion? Can I still use modules, etc? Or would I be severely
> restricting myself?
Since some modules are OO only, yes.
But what's the problem of using
my $object = Foo::Bar->new()
$object->foo();
over
Foo::Bar::foo()
Maybe you should study OO? It sounds like you try to avoid OO because you
*think* it eats time.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Fri, 17 Nov 2006 20:48:51 +0000
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Do I *have* to use 'OOP' to use modules?
Message-Id: <g69veldbxzg.fsf@lifelogs.com>
On 17 Nov 2006, cwilbur@chromatico.net wrote:
> That said, insisting on not using object-oriented approaches in
> programming is like insisting that you'll never turn left while
> driving: you can still get where you want to go, but you're setting
> yourself up for a lot of silly useless complexity. If you insist on
> avoiding OO, you can still be productive in Perl; but avoiding OO is
> severely restricting yourself independent of what language you choose.
Maybe in Perl this is true, but please don't generalize to
"programming." It's a very narrow view of the field (to continue your
analogy, you'd be driving in the left lane only, so left turns will
seem most natural).
Emacs Lisp comes to mind. It is very useful without using OOP. There
are many other examples. The problem domain and programmer experience
should make the OOP/procedural/functional/etc. choice.
Ted
------------------------------
Date: 17 Nov 2006 16:29:03 -0500
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Do I *have* to use 'OOP' to use modules?
Message-Id: <87irhdpxsw.fsf@mithril.chromatico.net>
>>>>> "TZ" == Ted Zlatanov <tzz@lifelogs.com> writes:
TZ> On 17 Nov 2006, cwilbur@chromatico.net wrote:
>> That said, insisting on not using object-oriented approaches in
>> programming is like insisting that you'll never turn left while
>> driving: you can still get where you want to go, but you're
>> setting yourself up for a lot of silly useless complexity. If
>> you insist on avoiding OO, you can still be productive in Perl;
>> but avoiding OO is severely restricting yourself independent of
>> what language you choose.
TZ> Maybe in Perl this is true, but please don't generalize to
TZ> "programming." It's a very narrow view of the field (to
TZ> continue your analogy, you'd be driving in the left lane only,
TZ> so left turns will seem most natural).
Er, it's true across the board: if you eliminate object oriented
approaches up front, you *are* limiting yourself. It might be the
case that the problem you're trying to solve is best solved through
other means, in which case the limit is not a problem; but if you
eliminate any object oriented technique up front regardless of the
problem you're trying to solve, you're limiting yourself, and in many
cases eliminating the clearest solution to the problem.
Sometimes, you can get where you want to go by only turning left. In
those cases, deciding up front that you're only going to turn left is
not a problem. Other times, you'll want to turn right -- either
because that's the most natural route, or because taking *one* right
turn means you get to avoid an extra hour of driving.
TZ> Emacs Lisp comes to mind. It is very useful without using
TZ> OOP. There are many other examples. The problem domain and
TZ> programmer experience should make the
TZ> OOP/procedural/functional/etc. choice.
You can't do OOP in Lisp? This is news to me.
You may find that another approach (such as, if you're using Lisp, a
functional approach) is better suited to the problem; but that is
*not* the same thing as deciding, independently of the problem domain,
that object oriented techniques are not to be considered.
Charlton
--
Charlton Wilbur
cwilbur@chromatico.net
------------------------------
Date: Fri, 17 Nov 2006 12:34:23 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: FAQ 5.11 How can I write() into a string?
Message-Id: <171120061234237890%jgibson@mail.arc.nasa.gov>
In article <4s6bcgFtkfaaU1@mid.individual.net>, Wayne M. Poe
<louisREMOVE@REMOVEh4h.com> wrote:
> PerlFAQ Server wrote:
> > This is an excerpt from the latest version perlfaq5.pod, which
> > comes with the standard Perl distribution. These postings aim to
> > reduce the number of repeated questions as well as allow the community
> > to review and update the answers. The latest version of the complete
> > perlfaq is at http://faq.perl.org .
> >
> > --------------------------------------------------------------------
> >
> > 5.11: How can I write() into a string?
> >
> >
> > See "Accessing Formatting Internals" in perlform for an swrite()
> > function.
> >
> >
> >
> > --------------------------------------------------------------------
>
> While I am grateful for the great docs and to those who maintain them,
> as an FAQ post on a news group, this one just seems like such a waste.
> Why not bundle the entry this one refers to ("Accessing Formatting
> Internals") ? Yes, one can use their local perldoc, but still, if this
> is meant for a news group, then it's a waste of a post as is :P
From the explanation above: "These postings aim to ... allow the
community to review and update the answers." The entry wasn't designed
with Usenet in mind. If you don't like the entry (or any other posted
here), suggest an alternative. The FAQ maintainer is a regular and will
consider your suggestion.
>
> Also, I just now checked, and that reference doesn't seem to be very
> helpful either...
>
> $ perldoc -q "Accessing Formatting Internals"
> No documentation for perl FAQ keyword `Accessing Formatting Internals'
> found
>
> $ perldoc -f "Accessing Formatting Internals"
> No documentation for perl function `Accessing Formatting Internals'
> found
You have to do:
perldoc perlform
and search for /Accessing/.
------------------------------
Date: 17 Nov 2006 20:48:32 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: FAQ 5.11 How can I write() into a string?
Message-Id: <4s6lh0Fu7auaU1@mid.dfncis.de>
Wayne M. Poe <louisREMOVE@REMOVEh4h.com> wrote in comp.lang.perl.misc:
> PerlFAQ Server wrote:
> > This is an excerpt from the latest version perlfaq5.pod, which
> > comes with the standard Perl distribution. These postings aim to
> > reduce the number of repeated questions as well as allow the community
> > to review and update the answers. The latest version of the complete
> > perlfaq is at http://faq.perl.org .
> >
> > --------------------------------------------------------------------
> >
> > 5.11: How can I write() into a string?
> >
> >
> > See "Accessing Formatting Internals" in perlform for an swrite()
> > function.
> >
> >
> >
> > --------------------------------------------------------------------
>
> While I am grateful for the great docs and to those who maintain them,
> as an FAQ post on a news group, this one just seems like such a waste.
> Why not bundle the entry this one refers to ("Accessing Formatting
> Internals") ? Yes, one can use their local perldoc, but still, if this
> is meant for a news group, then it's a waste of a post as is :P
These postings are from the general Perl FAQ, they are not specifically
written for a newsgroup. The header (which you quoted) says as much.
The reason for posting them here is not primarily educational, it is
to give them a chance to be critically read and, if necessary, corrected
or rewritten.
> Also, I just now checked, and that reference doesn't seem to be very
> helpful either...
>
> $ perldoc -q "Accessing Formatting Internals"
> No documentation for perl FAQ keyword `Accessing Formatting Internals'
> found
>
> $ perldoc -f "Accessing Formatting Internals"
> No documentation for perl function `Accessing Formatting Internals'
> found
Did you read what it says? It doesn't say to look in the FAQ, nor
does it say to look in perlfunc. It says to look in perlform.
Your criticism would be more valid if you had actually read the
text you're criticizing.
Anno
------------------------------
Date: 17 Nov 2006 12:02:42 -0800
From: gmclee@21cn.com
Subject: help CGI in perl and C
Message-Id: <1163793761.988406.314200@m73g2000cwd.googlegroups.com>
hi there,
I am trying to use CGI in my my homepage. The server is running in
win2003 and the network admin said it support ASP as well as
ActivePerl. I have no idea what CGI and perl is before I read a brief
introduction of CGI. I have written a simple perl to test if it works
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print "It works fine";
exit;
Of course, it works fine. However, I would like to write the CGI in C
language. I try the following code and compile it into test.exe,
renamed as test.cgi
#include <stdio.h>
int main(int argc,char ** argv,char ** arge)
{
printf("content-type:text/html\r\n\r\n");
printf("abc\r\n<br>");
return 0;
}
However, when I run the program. The server returns
'xxx\cgi-bin\test.cgi' script produced no output
Would anyone please tell me what's going on? Some one told me CGI is
just an interface and can be written in many languages. So why it works
fine for perl code but fail for C?????
Thanks in advance.
------------------------------
Date: Fri, 17 Nov 2006 15:12:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: help CGI in perl and C
Message-Id: <m2wt5tx26b.fsf@Sherm-Pendleys-Computer.local>
gmclee@21cn.com writes:
> hi there,
> I am trying to use CGI in my my homepage. The server is running in
> win2003 and the network admin said it support ASP as well as
> ActivePerl. I have no idea what CGI and perl is before I read a brief
> introduction of CGI. I have written a simple perl to test if it works
>
> #!/usr/bin/perl
You should get in the habit of enabling strictures and warnings - they're
good for you:
use strict;
use warnings;
> print "Content-type:text/html\n\n";
> print "It works fine";
> exit;
Calling exit() is completely unnecessary here. A Perl program "falls off the
end" when it's done.
> Of course, it works fine. However, I would like to write the CGI in C
> language.
...
> Would anyone please tell me what's going on?
Okay, what's going on is, you're asking a question in a Perl group that has
nothing whatsoever to do with Perl.
> Some one told me CGI is
> just an interface and can be written in many languages.
They're right.
> So why it works
> fine for perl code but fail for C?????
False dichotomy here. The fact that a particular CGI/C program fails to run
cannot be taken to imply that CGI programs cannot be written in C. They can
be, and many of them are.
This is the wrong place to get help with a C program, whether it's a CGI or
not. Try asking in the comp.infosystems.www.authoring.cgi group.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 17 Nov 2006 20:29:03 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: help CGI in perl and C
Message-Id: <Xns987E93574657Fcastleamber@130.133.1.4>
gmclee@21cn.com wrote:
[ C (!) code ]
> However, when I run the program. The server returns
>
> 'xxx\cgi-bin\test.cgi' script produced no output
Does it when called from the command line? Also, the C related group is
that way --->
Even though there are Perl programmers that can help you, if they do so,
where is the end? Your next question might be how to cook salmon.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 17 Nov 2006 14:38:13 -0600
From: Lawrence Statton XE2/N1GAK <yankeeinexile@gmail.com>
Subject: Re: help CGI in perl and C
Message-Id: <878xi924i2.fsf@gmail.com>
John Bokma <john@castleamber.com> writes:
> gmclee@21cn.com wrote:
>
> [ C (!) code ]
>
> > However, when I run the program. The server returns
> >
> > 'xxx\cgi-bin\test.cgi' script produced no output
>
> Does it when called from the command line? Also, the C related group is
> that way --->
>
> Even though there are Perl programmers that can help you, if they do so,
> where is the end? Your next question might be how to cook salmon.
>
I write CGI in Perl, and my boss is coming to dinner. Do you have any
good salmon recipes that would show I know how to write good Perl
code? :)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer software consists of only two components: ones and
zeros, in roughly equal proportions. All that is required is to
sort them into the correct order.
------------------------------
Date: Fri, 17 Nov 2006 15:58:40 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: help CGI in perl and C
Message-Id: <x74psx6b9b.fsf@mail.sysarch.com>
>>>>> "LSX" == Lawrence Statton XE2/N1GAK <yankeeinexile@gmail.com> writes:
LSX> John Bokma <john@castleamber.com> writes:
>> gmclee@21cn.com wrote:
>>
>> [ C (!) code ]
>>
>> > However, when I run the program. The server returns
>> >
>> > 'xxx\cgi-bin\test.cgi' script produced no output
>>
>> Does it when called from the command line? Also, the C related group is
>> that way --->
>>
>> Even though there are Perl programmers that can help you, if they do so,
>> where is the end? Your next question might be how to cook salmon.
>>
LSX> I write CGI in Perl, and my boss is coming to dinner. Do you have any
LSX> good salmon recipes that would show I know how to write good Perl
LSX> code? :)
i write perl and love to cook salmon. i just bought about 1lb of wild
salmon today from a great local fishmonger for $14/lb. i will probably
broil or grill it with possibly an herbed butter for a topping. yum! i
should write a cpan module on this.
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: Fri, 17 Nov 2006 22:06:18 +0100
From: Richard <critterstown@googlemail.com>
Subject: Re: help CGI in perl and C
Message-Id: <ejl8co$v2n$1@online.de>
gmclee@21cn.com schrieb:
> hi there,
> I am trying to use CGI in my my homepage. The server is running in
> win2003 and the network admin said it support ASP as well as
> ActivePerl. I have no idea what CGI and perl is before I read a brief
> introduction of CGI. I have written a simple perl to test if it works
>
> #!/usr/bin/perl
> print "Content-type:text/html\n\n";
> print "It works fine";
> exit;
>
> Of course, it works fine. However, I would like to write the CGI in C
> language. I try the following code and compile it into test.exe,
> renamed as test.cgi
>
> #include <stdio.h>
> int main(int argc,char ** argv,char ** arge)
> {
> printf("content-type:text/html\r\n\r\n");
> printf("abc\r\n<br>");
> return 0;
> }
Well you should look at your own code in the perl example you wrote \n\n
and in the C version you do \r\n which is incorrect.
If you see simple samples you should try to copy them line by line:-)
>
> However, when I run the program. The server returns
>
> 'xxx\cgi-bin\test.cgi' script produced no output
>
> Would anyone please tell me what's going on? Some one told me CGI is
> just an interface and can be written in many languages. So why it works
> fine for perl code but fail for C?????
>
> Thanks in advance.
>
------------------------------
Date: Fri, 17 Nov 2006 12:24:45 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: How to make Perl's regex engine "halt" after a match
Message-Id: <171120061224453186%jgibson@mail.arc.nasa.gov>
In article <4s6arsFu8n52U1@mid.individual.net>, Wayne M. Poe
<louisREMOVE@REMOVEh4h.com> wrote:
> [This is a reply to a thread from earlier this year
> Reply generated from source post with full headers
> from groups.google.com]
>
> robic0 wrote:
> > On 18 Feb 2006 07:48:30 -0800, "Dominic van der Zypen"
> > <dominic.zypen@gmail.com> wrote:
> >
[OP snipped]
> >
> > This is trivial. Why would you need this?
> > I would consider this a waste of my time to even read such a
> > proposition.
> > If you can't post a real world problem/question then don't post
> > here...
>
> I was reading this on google groups archives and I just had to reply to
> it. I understand I'm a few months late, but being in the hospital at
> that time fighting cancer I hope is a good enough reason.
>
> I'm actually surprised no one responded to this post at the time it was
> originally posted.
>
> Since when can one not post a simplified version of the problem to make
> it easier to trouble shoot? Isn't that what you are SUPPOSED to do?
> Rather than posting a longer code snippet where one would have to sift
> through the code to find the real problem?
>
> Or maybe that's just me.
robic0 is a known troll. Many or most of the regulars here simply
ignore his posts, for good reason.
------------------------------
Date: Fri, 17 Nov 2006 14:12:44 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: howto POST and leave site?
Message-Id: <m2k61tyjir.fsf@Sherm-Pendleys-Computer.local>
"botfood" <botfood@yahoo.com> writes:
> Seems that the perl newsgroup is the same as ever, brilliant, but with
> an aweful lot of attitude. You must admit, the perl/cgi lines are
> sometimes indistinct
I "must" admit no such thing. The lines are clear as glass. If the answer
to your question would be the same if you were writing in Python, C, Ruby,
or whatever, then it's not a Perl question.
How much simpler could the distinction be?
Example: "What environment var. do I look at to get the client's IP addr.?"
The answer is, of course, "the same one you'd look at if you were writing
in some other language." It's a question about the CGI spec, not about Perl.
Note that I'm not "taking sides" here - I didn't read your question, and I'm
not saying whether it was a Perl question or not. I'm just saying that in
most cases it's really quite easy to tell what is or isn't.
>> here: many (most?) people using Perl are not using it for CGI.)
> -----
> ...I wonder. That really is ALL I use perl for; not being a sys admin,
I haven't touched a CGI in years. Virtually all the webbish stuff I do uses
mod_perl (by definition, not a CGI since it's running as part of Apache, not
in a child process). I also do non-webby stuff with Perl, like writing GUI
applications.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: 17 Nov 2006 20:22:00 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: OT: O'Reilly 'Perl CD Bookshelf' - gone for good?
Message-Id: <Xns987E922537F05castleamber@130.133.1.4>
zentara <zentara@highstream.net> wrote:
> Look for old copies at amazon.com or ebay.
The point is "old".
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 17 Nov 2006 19:21:53 GMT
From: xhoster@gmail.com
Subject: Re: Perl redirection to browser timeout ...
Message-Id: <20061117142230.135$px@newsreader.com>
"JKH" <newsgroup@cleanmymailbox.com> wrote:
> I have a Perl script that is called by a web browser. The script may
> take up to 60 seconds or more to complete processing before
> redirecting the browser to a destination URL. The problem I'm
> experiencing is that when the processing time is between 30
> and 60 seconds, it returns a DNS error to the browser.
Why would it return a DNS error? That seems like an odd error to be
returned upon a CGI timeout. Do you know who is producing the error, your
CGI, or the httpd, or is the browser just making it up? Does your CGI
script perform DNS look ups?
> If
> under 30 seconds, the redirection is fine.
>
> How can I prevent this?
you could keep redirecting back yourself until your script is done, then
redirect to the final destination.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 17 Nov 2006 15:03:15 -0800
From: "JKH" <newsgroup@cleanmymailbox.com>
Subject: Re: Perl redirection to browser timeout ...
Message-Id: <1163804594.952139.200070@b28g2000cwb.googlegroups.com>
xhoster@gmail.com wrote:
> "JKH" <newsgroup@cleanmymailbox.com> wrote:
> > I have a Perl script that is called by a web browser. The script may
> > take up to 60 seconds or more to complete processing before
> > redirecting the browser to a destination URL. The problem I'm
> > experiencing is that when the processing time is between 30
> > and 60 seconds, it returns a DNS error to the browser.
>
> Why would it return a DNS error? That seems like an odd error to be
> returned upon a CGI timeout. Do you know who is producing the error, your
> CGI, or the httpd, or is the browser just making it up? Does your CGI
> script perform DNS look ups?
>
> > If
> > under 30 seconds, the redirection is fine.
> >
> > How can I prevent this?
>
> you could keep redirecting back yourself until your script is done, then
> redirect to the final destination.
>
> Xho
>
I ended up just printing "...\n" until the process was done. Not the
cleanest, but it works!
Thank you for all your suggestions.
JKH
------------------------------
Date: Fri, 17 Nov 2006 22:48:26 +0000
From: Brian Raven <brian.raven@osbsl.co.uk>
Subject: Re: threads crash on XP (in Tk script)
Message-Id: <r6w13d1h.fsf@osbsl.co.uk>
zentara <zentara@highstream.net> writes:
> On Thu, 16 Nov 2006 23:10:46 +0000, Brian Raven
> <brian.raven@osbsl.co.uk> wrote:
>
>>"MoshiachNow" <lev.weissman@creo.com> writes:
>
>>> Running a Tk script on my XP I always get an error.
>>>
>>> Code:
>>> ########################################################################################
>>> #use warnings;
>>> use strict;
>>> use Win32::OLE qw( in );
>>> use Win32::Lanman;
>>> use Net::Domain qw(hostname hostfqdn hostdomain);
>>> use Socket 'inet_ntoa';
>>> use Sys::Hostname 'hostname';
>>> use Data::Validate::IP qw(is_ipv4);
>>> use Net::Ping;
>>> use Tk;
>>> use Tk::Text;
>>> use Tk::Scrollbar;
>>> use Tk::Pane;
>>> use threads;
>>>
>>> threads->create(sub { print("I am a thread\n"); })->join();
>>>
>>> Error:
>>> I am a thread
>>> Free to wrong pool 1822b00 not 222770 during global destruction.
>>>
>>> Any ideas?
>>
>>One idea would be that threads, and modules that are not thread safe
>>do not mix very well. I don't know about any of the other modules that
>>you use, but Tk is not thread safe.
>>
>>HTH
>
> Yeah, but he has not invoked any Tk statements before he builds the
> thread. It should work, and it does work fine on linux.
True, but I suspect that this is not real code, but a small example to
demonstrate the problem.
>
> Tk will work fine with threads, IF you build the thread before invoking
> any Tk statements, AND don't try to share objects across thread
> boundaries.
Again true (I have done that myself), but those restrictions make it
more difficult to write decent code. Enough so that it is probably
better (IMHO) to consider alternative designs/modules first.
>
> But you are probably right, that one of the use statements is causing
> it. I would try removing them all, and adding them back, 1 by 1, until
> you find which one causes it.
Which suggests that Tk is not the only thread unsafe module being
loaded. In which case, a single threaded approach may be less
problematic.
HTH
--
Brian Raven
------------------------------
Date: 17 Nov 2006 11:39:41 -0800
From: "doolittle" <spam.meplease@ntlworld.com>
Subject: Re: what the difference between these loops?
Message-Id: <1163792380.919541.165320@f16g2000cwb.googlegroups.com>
Jim Gibson wrote:
> If you really want to understand, then you should post a short program
> that demonstrates the concept with which you are having difficulty.
> There will be many here who can explain why your program behaves the
> way it does.
After trying and failing to create such a program, i think i have found
the source of the error.
Basically i think putting information into the key of a hash ( with
$key = join( ',' , $foo , $bar) ) with the idea of later extracting
that information using split (or substr), is dodgy. Especially if you
use join( '' , $foo , $bar), and later try to extract the information
with substr.
Really i need a more complex data structure which contains the hash
value, $foo and $bar.
Thanks for all the advice.
------------------------------
Date: 17 Nov 2006 20:18:56 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: what the difference between these loops?
Message-Id: <Xns987E919FBAE55castleamber@130.133.1.4>
"doolittle" <spam.meplease@ntlworld.com> wrote:
> Tad McClellan wrote:
>> Please retain enought context for folks to be able to tell what you
>> are talking about.
>>
>
> Sometimes its difficult to find a good compromise between too little,
> and too much context. I have seen far more people criticized (sp?) for
> including all previous posts and replies in a reply, than for not
> including enough.
There is a simple test: reread what before you post and wonder: does this
make sense when I read *only* this message after a month or 3 from now on?
> I think its reasonable to assume that if someone only reads the last
> post in a thread, they won't get the whole story.
But it's not reasonable to assume that they have to read the *previous*
message in order to understand the current one.
> I still don't understand why the 'each' loop worked when the keys were
> defined one way, but not another.
Without a smallest piece of code that shows this behavior we can't even
guess.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 17 Nov 2006 20:21:31 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: what the difference between these loops?
Message-Id: <Xns987E920FE3ABAcastleamber@130.133.1.4>
"doolittle" <spam.meplease@ntlworld.com> wrote:
>
> Jim Gibson wrote:
>
>> If you really want to understand, then you should post a short program
>> that demonstrates the concept with which you are having difficulty.
>> There will be many here who can explain why your program behaves the
>> way it does.
>
> After trying and failing to create such a program, i think i have found
> the source of the error.
>
> Basically i think putting information into the key of a hash ( with
> $key = join( ',' , $foo , $bar) ) with the idea of later extracting
> that information using split (or substr), is dodgy. Especially if you
> use join( '' , $foo , $bar), and later try to extract the information
> with substr.
All depends on what's in $foo and $bar. If you use substr you have to make
sure that foo always has the same length.
If you use split, you must make sure that the character you split on can
only occur exactly once in your key (since you want foo and bar).
> Really i need a more complex data structure which contains the hash
> value, $foo and $bar.
Depends on what you're doing. I have used composite keys in the past, and
I am sure others have done so.
Again, without a minimal example we can only guess.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Fri, 17 Nov 2006 15:55:51 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: what the difference between these loops?
Message-Id: <x78xi96be0.fsf@mail.sysarch.com>
>>>>> "JB" == John Bokma <john@castleamber.com> writes:
JB> Depends on what you're doing. I have used composite keys in the
JB> past, and I am sure others have done so.
and that is supported in perl (even perl4!) as pseudo multilevel
hashes. look for $; in perlvar for more.
but to the OP, a multilevel hash is the way to go. merging keys can be a
useful technique as john says but it isn't that common.
as for the OP's original issue, it seems he didn't rtfm properly about
each and how it works and is reset.
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: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9977
***************************************