[7919] in Perl-Users-Digest
Perl-Users Digest, Issue: 1544 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 28 22:07:16 1997
Date: Sun, 28 Dec 97 19:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 28 Dec 1997 Volume: 8 Number: 1544
Today's topics:
*Square Roots* <ordway@iwshost.net>
Re: Annoying rounding problem... <aloha@shinsegi.com>
Debugging a segfault/running from core <boromir@mindspring.com>
Faster way of calculating sum of absolute values? (Tomas)
Re: Faster way of calculating sum of absolute values? <ebohlman@netcom.com>
Re: Faster way of calculating sum of absolute values? <scribble@pobox.com>
Re: Faster way of calculating sum of absolute values? (Tad McClellan)
Re: Finding the TITLE to a HTML page <rootbeer@teleport.com>
Re: Finding the TITLE to a HTML page <scribble@pobox.com>
Re: Finding the TITLE to a HTML page (Tad McClellan)
Re: flock v.s. Sun OS <rootbeer@teleport.com>
Re: HELP !!! Attachment with sendmail (Perl under linux <rootbeer@teleport.com>
Re: HELP !!! Attachment with sendmail (Perl under linux (Frank)
Re: How to get unique list value <joseph@5sigma.com>
Interprocess Communication <allank@techone.com.au>
Re: Interprocess Communication <boromir@mindspring.com>
learning perl <no1joe@geocities.com>
Re: Merry XMas perl monsters (Jonathan Stowe)
Re: Mysterious FileHandle + fork() behavior; possible P <rootbeer@teleport.com>
Re: Perl doc in .HLP format? (Ilya Zakharevich)
Re: problem with modules <rootbeer@teleport.com>
Reloading HTML <cybercom@pacific.net.sg>
Size in KB <mhanson@arrowweb.com>
Sorting files troxel@sammcgees.com
Re: SQL and PERL (Jason Costomiris)
Re: Statistics::Descriptive yields error in AUTOLOAD (Colin Kuskie)
taint (Gustav Kristoffer Ek)
Re: Which language pays most 17457 -- C++ vs. Java? <carla@ici.net>
Re: Which language pays most 17457 -- C++ vs. Java? (Lawrence Kirby)
word-wrap or insert \n every 50 bytes or less <jcotton@erols.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 28 Dec 1997 19:13:34 -0600
From: "Brandon" <ordway@iwshost.net>
Subject: *Square Roots*
Message-Id: <686tb6$nhn$1@reggie.win.bright.net>
If I have a number $mynumber how do I take the square root of it?? Post it
on here or email me at ordway@iwshost.net
Thanks!!
------------------------------
Date: Mon, 29 Dec 1997 11:14:29 +0900
From: "Yoon, SahngHo" <aloha@shinsegi.com>
Subject: Re: Annoying rounding problem...
Message-Id: <34A70785.46C1@shinsegi.com>
Nihon wrote:
>
> In writing the script for an online store, I've run into this problem. Here's the variable:
>
> $Tax = ($Subtotal * 0.06125)
>
> If $Subtotal is 100, then the resulting tax is $6.125. How do I round
> that UP to $6.13 in perl so their total is $106.13, NOT $106.125?
>
> Thanks for your help!
> To reply to this posting, remove the X, Y, and Z from my address.
> Want to contact me? http://users.itsnet.com/~nihon/contact.html
> ----------------/----------------/----------------/----------------\
> Avoid Microsoft like the plague? They ARE the plague!
$tax = int($Tax*100+0.5)/100;
Yoon, SahngHo
Shinsegi Telecomm
------------------------------
Date: Sun, 28 Dec 1997 15:21:47 -0500
From: Boris Statnikov <boromir@mindspring.com>
Subject: Debugging a segfault/running from core
Message-Id: <34A6B4DA.DF673F02@mindspring.com>
My configuration:
Running under perl 5.004_04 on Linux 2.0. Library used: libwww5.18 (and
consequently libnet and maybe some others).
My script crashed having caught SIG 139 (SIGSEGV) from the child
script. Since this is not a blatant programming error (i.e. memory
allocation), I am somewhat at a loss as to what I might have done to
eventually cause the script to crash (it is a long running, heavy duty
script exposed to a lot of processing). Now I understand that I can
catch the SIGSEGV (since my program's behavior is repeatable), but it
would take a long time to get back to the original state where it
crashed. Can I somehow debug from the core? Furthermore, can I restart
the core ignoring the error?
P.S. My script did NOT run out of memory, at least not because it wasn't
available: total memory usage at the time of crash was about 10MB with
another 140MB RAM/swap available.
Boris
------------------------------
Date: Sun, 28 Dec 1997 21:47:58 GMT
From: tj.donotspam@mbox303.swipnet.se (Tomas)
Subject: Faster way of calculating sum of absolute values?
Message-Id: <34adc905.29952150@nntpserver.swip.net>
Suppose I have two perl strings, for instance:
$string1=3D"5174";
$string2=3D"7823";
=46rom these strings I want to calculate the following sum:
abs(5-7)+abs(1-8)+abs(7-2)+abs(4-3) =3D 2+7+5+1 =3D 15
This can be done by the following code:
@string1=3Dsplit //, $string1;
@string2=3Dsplit //, $string2;
$sum=3D0;
for ($i=3D0;$i<$#string1;$i++) {
$sum+=3Dabs($string1[$i]-$string2[$i]);
}
Any suggestions of a faster implementation ?
/ Tomas /
------------------------------
Date: Sun, 28 Dec 1997 22:11:23 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Faster way of calculating sum of absolute values?
Message-Id: <ebohlmanELx6yz.AHH@netcom.com>
Tomas <tj.donotspam@mbox303.swipnet.se> wrote:
: Suppose I have two perl strings, for instance:
: $string1="5174";
: $string2="7823";
: From these strings I want to calculate the following sum:
: abs(5-7)+abs(1-8)+abs(7-2)+abs(4-3) = 2+7+5+1 = 15
[snip your code]
: Any suggestions of a faster implementation ?
Yes.
use Benchmark;
$string1="5174";
$string2="7823";
#your code
timethis(10000,<<'EO1');
@string1=split //, $string1;
@string2=split //, $string2;
$sum=0;
for ($i=0;$i<$#string1;$i++) {
$sum+=abs($string1[$i]-$string2[$i]);
}
EO1
#my code
timethis(10000,<<'EO2');
$sum=0;
for ($i=0;$i<$#string1;$i++) {
$sum+=abs(substr($string1,$i,1)-substr($string2,$i,1));
}
EO2
Results:
timethis 10000: 8 secs ( 8.58 usr 0.25 sys = 8.83 cpu)
timethis 10000: 5 secs ( 4.07 usr 0.02 sys = 4.08 cpu)
------------------------------
Date: 28 Dec 1997 16:46:14 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: Faster way of calculating sum of absolute values?
Message-Id: <686krm$lh8@tekka.wwa.com>
Tomas, who posted from the suspicious address <tj.donotspam@mbox303.swipnet.se>
and might want to look at <http://www.cauce.org/>, writes:
>Suppose I have two perl strings, for instance:
>$string1=3D"5174";
>$string2=3D"7823";
>
>=46rom these strings I want to calculate the following sum:
>abs(5-7)+abs(1-8)+abs(7-2)+abs(4-3) =3D 2+7+5+1 =3D 15
>
>This can be done by the following code:
>@string1=3Dsplit //, $string1;
>@string2=3Dsplit //, $string2;
>$sum=3D0;
>for ($i=3D0;$i<$#string1;$i++) {
> $sum+=3Dabs($string1[$i]-$string2[$i]);
>}
I don't know about faster, but here's one alternative which might
LOOK cleaner to some eyes. Assuming they are equal in length:
while (length $string1) {
$sum += abs(chop($string1) - chop($string2))
}
------------------------------
Date: Sun, 28 Dec 1997 18:21:32 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Faster way of calculating sum of absolute values?
Message-Id: <ceq686.493.ln@localhost>
Tomas (tj.donotspam@mbox303.swipnet.se) wrote:
: Suppose I have two perl strings, for instance:
: $string1=3D"5174";
: $string2=3D"7823";
: =46rom these strings I want to calculate the following sum:
: abs(5-7)+abs(1-8)+abs(7-2)+abs(4-3) =3D 2+7+5+1 =3D 15
: This can be done by the following code:
: @string1=3Dsplit //, $string1;
: @string2=3Dsplit //, $string2;
: $sum=3D0;
: for ($i=3D0;$i<$#string1;$i++) {
: $sum+=3Dabs($string1[$i]-$string2[$i]);
: }
: Any suggestions of a faster implementation ?
I have a suggestion for a more _correct_ implementation ;-)
for ($i=0; $i<=$#string1; $i++) { # dont' skip the last element
or
for ($i=0; $i<@string1; $i++) {
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 28 Dec 1997 13:05:22 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Andrew Quested <webmaster@hsv.com.au>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <Pine.GSO.3.96.971228130504.26956G-100000@user2.teleport.com>
On Sat, 27 Dec 1997, Andrew Quested wrote:
> open(HTML,$htmlfile);
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
Thanks!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 28 Dec 1997 16:54:56 -0600
From: Tushar Samant <scribble@pobox.com>
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <686lc0$m0h@tekka.wwa.com>
john@castleamber.com writes:
>Eric Bohlman <ebohlman@netcom.com> wrote
>
>> <HTML>
>> <HEAD>
>> <TITLE>
>> <!--Insert the title of the document after this
>> line but before the line that says </TITLE>-->
>> </TITLE>
>> ...
>
>weblint warns agains the use of mark up in comments. It is bad practice
>to do so.
That's hardly the point... Take out the markup and you still have
a counterexample. Why is it bad practice to have markup inside
comments, though? This is not a Perl question, but I am curious,
and asking a sincere question. What possible use can comments have
with a restriction like that?
>And yes, we all can think up numerous of examples that fail a
>regex.... If it works in 90% of the cases, it works for me 8-)
I think this one was a pretty damaging counterexample.
------------------------------
Date: Sun, 28 Dec 1997 18:31:25 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Finding the TITLE to a HTML page
Message-Id: <t0r686.t93.ln@localhost>
Tushar Samant (scribble@pobox.com) wrote:
: john@castleamber.com writes:
: >Eric Bohlman <ebohlman@netcom.com> wrote
: >
: >> <HTML>
: >> <HEAD>
: >> <TITLE>
: >> <!--Insert the title of the document after this
: >> line but before the line that says </TITLE>-->
: >> </TITLE>
: >> ...
: >
: >weblint warns agains the use of mark up in comments. It is bad practice
: >to do so.
: That's hardly the point... Take out the markup and you still have
: a counterexample. Why is it bad practice to have markup inside
: comments, though? This is not a Perl question, but I am curious,
: and asking a sincere question. What possible use can comments have
: with a restriction like that?
It is bad practice because there are bad parsers built-in to browsers.
But the browser companies are big and powerful. So we do what they
say, not necessarily what is Right.
(sure does hurt when they tug on that nose ring though...)
Patient: "Doctor, it hurts when I raise my arm"
Doctor: "I advise that you don't raise your arm"
;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 28 Dec 1997 13:21:39 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Bokma <john@castleamber.com>
Subject: Re: flock v.s. Sun OS
Message-Id: <Pine.GSO.3.96.971228131748.26956K-100000@user2.teleport.com>
On 28 Dec 1997, John Bokma wrote:
> I've problems with flock on Sun OS,
Did your perl binary pass all of the 'make test' tests when it was
compiled?
> I've written a counter based on the famous "Web Techniques" (nr 4).
> But sometimes the counter-file is cleared and, hence the counter is reset.
That's a sure sign that something is going wrong. :-) But did you try
installing Randal's original code to see whether the same problem occurs?
> pseudo code:
Do you want us to help you with pseudo debugging? :-)
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Sun, 28 Dec 1997 13:23:41 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "T. de Konink" <tkonink@horizon.nl>
Subject: Re: HELP !!! Attachment with sendmail (Perl under linux)
Message-Id: <Pine.GSO.3.96.971228132200.26956L-100000@user2.teleport.com>
On Sun, 28 Dec 1997, T. de Konink wrote:
> I don't know how to
> attach a file whitin the mail using sendmail.
If you can't find the answer in the docs for sendmail, you should probably
ask in a newsgroup about sendmail, rather than one about Perl.
> How can I attach a file to a mail-message using a Perl script under
> linux.
You could see whether there's a module which can do the job.
> open(MAIL, "|/usr/lib/sendmail tkonink@horizon.nl");
That's not good.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Mon, 29 Dec 1997 01:11:44 GMT
From: FHeasley@chemistry.com (Frank)
Subject: Re: HELP !!! Attachment with sendmail (Perl under linux)
Message-Id: <34a6f6fa.29137364@news.halcyon.com>
On Sun, 28 Dec 1997 13:10:16 +0100, "T. de Konink"
<tkonink@horizon.nl> wrote:
>Hi,
>
>I want a file from an server (linux) sended to me automaticly by mail.
>Therefore I want to
>make a Perl-script that uses "sendmail", to send me the file. But I
>don't know how to
>attach a file whitin the mail using sendmail.
Unless it's binary, you don't send it as an attachment - just as the
text body of the message.
If it is binary, you'll need to base64 or uuencode it and then send it
as an attachment, preferably using one of the appropriate modules from
CPAN.
See below for one possible text solution to your problem.
>
>QUESTION :
>How can I attach a file to a mail-message using a Perl script under
>linux. I know how to
>send a mail (see below), but I don't know how to attatch an file. If you
>know how to do
>it, I would be glad to hear from you.
>
>Thanks in advance,
>
>Thomas de Konink
>mailto:tkonink@horizon.nl
>
>PS: As far as I am:
>
open (BODY, "yourfile.txt");
while (BODY) {
{ local $/; $body = <BODY> };
}
> open(MAIL, "|/usr/lib/sendmail);
print MAIL "To: tkonink@horizon.nl\n";
> print MAIL "Reply-to: $in{'email'} ($in{'naam'})\n";
> print MAIL "Subject: Aanmelding Email Lijst\n\n";
> print MAIL "Datum : $date1 Tijd: $time1 \n\n";
> print MAIL "E-mail adres: $in{'email'} \n\n";
> print MAIL "Remote IP address: $ENV{'REMOTE_ADDR'}\n";
print MAIL "$body";
> close(MAIL);
>
Frank
------------------------------
Date: Sun, 28 Dec 1997 19:45:59 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: How to get unique list value
Message-Id: <34A70EC6.6B39F196@5sigma.com>
Here's the grep-free, temporary-free version from my book:
@uniq = sort keys %{ { map { $_, 1 } @list } }
-joseph
http://www.effectiveperl.com
Chew Keat Yeow wrote:
>
> Hi,
>
> I have a list with many item duplicated and I want to create list containing only unique values.
> The way I do it is as follows, but I have this feeling that there must be a better way to do it with Perl.
------------------------------
Date: Mon, 29 Dec 1997 09:51:28 +1100
From: "Allan Krause" <allank@techone.com.au>
Subject: Interprocess Communication
Message-Id: <686ojd$gtl1@sol.connect.usq.edu.au>
I am trying to write a client/server type application.
The client application is a perl script which will compile and link all the
components of an application. This application will run on a unix machine
(solaris).
The server application will extract all the software components to be
compiled from a configuration management repository (Microsoft SourceSafe)
using supplied utilities. This application will run on a
Windows95/WindowsNT machine (i386).
The extraction step performed by the server process will occur after the
client application has set up the specified destination environment and
before the compilation commences.
It is envisaged that the client application will send a message to the
server application which will trigger it to perform the extraction operation
and signal the client application when it is finished.
I have tried copying sample routines from several books such as "Perl 5 for
Dummies" (see attached). These routines seem to work ok when both the
client and server processes are running on the unix box. When both routines
are run on a Windows95 or WindowsNT box, the client application fails on the
'bind' statement with "unknown Error: 0x00002741 at client line 16".
I've no idea how to modify the scripts so one will run on unix and the other
on NT and have them talk to each other!!!
Does anyone out there have any idea how I can get this to work??????
begin 666 server
M(R$N+W!E<FP-"@T*)'!A=" ]("=3(&X@0S0@>#@G.PT*)&EN970@/2 R.PT*
M)&5C:&\@/2 W.PT*)'-M=' @/2 R-3L-"B1N;G1P(#T@,3$Y.PT*#0HD=&AI
M<R ]('!A8VLH)'!A="PD:6YE="PR,S0U+" P+# L,"PP*3L-"G-E;&5C="A.
M4RD[("1\(#T@,3L@<V5L96-T*'-T9&]U="D[#0H-"FEF("AS;V-K970H4RPR
M+#$L-BDI('L@<')I;G0@(G-O8VME="!O:UQN(CL@?2!E;'-E('L@9&EE("0A
M.R!]#0II9B H8FEN9"A3+"1T:&ES*2D@>R!P<FEN=" B8FEN9"!O:UQN(CL@
M?2!E;'-E('L@9&EE("0A.R!]#0II9B H;&ES=&5N*%,L-2DI('L@<')I;G0@
M(FQI<W1E;B!O:UQN(CL@?2!E;'-E('L@9&EE("0A.R!]#0IF;W(@*#L[*2![
M#0H@(" @<')I;G0@(DQI<W1E;FEN9R!A9V%I;EQN(CL-"B @("!I9B H)&%D
M9'(@/2!A8V-E<'0H3E,L4RDI('L@<')I;G0@(F%C8V5P="!O:UQN(CL@?2!E
M;'-E('L@9&EE("0A.R!]#0H-"B @("! 87)Y(#T@=6YP86-K*"1P870L)&%D
M9'(I.PT*(" @("0L(#T@)R G.PT*(" @('!R:6YT($!A<GD[('!R:6YT(")<
M;B([#0H-"B @("!W:&EL92 H/$Y3/BD@>PT*"7!R:6YT.PT*"7!R:6YT($Y3
-.PT*(" @('T-"GT-"@``
`
end
begin 666 client
M(R$N+W!E<FP-"@T*)'!A=" ]("=3(&X@0S0@>#@G.PT*)&EN970@/2 R.PT*
M)&5C:&\@/2 W.PT*)'-M=' @/2 R-3L-"B1N;G1P(#T@,3$Y.PT*)'1E<W0@
M/2 R,S0U.PT*#0HD4TE'>R=)3E0G?2 ]("=D;VMI;&PG.PT*#0HD=&AI<R ]
M('!A8VLH)'!A="PD:6YE="PP+" @(#$R."PQ-#DL,3,L-#,I.PT*)'1H870@
M/2!P86-K*"1P870L)&EN970L)'1E<W0L,3(W+# L,"PQ*3L-"@T*:68@*'-O
M8VME="A3+#(L,2PV*2D@>R!P<FEN=" B<V]C:V5T(&]K7&XB.R!](&5L<V4@
M>R!D:64@)"$[('T-"FEF("AB:6YD*%,L)'1H:7,I*2![('!R:6YT(")B:6YD
M(&]K7&XB.R!](&5L<V4@>R!D:64@)"$[('T-"FEF("AC;VYN96-T*%,L)'1H
M870I*2![('!R:6YT(")C;VYN96-T(&]K7&XB.R!](&5L<V4@>R!D:64@)"$[
M('T-"@T*<V5L96-T*%,I.R D?" ](#$[('-E;&5C="AS=&1O=70I.PT*#0II
M9B H)&-H:6QD(#T@9F]R:RD@>PT*(" @('=H:6QE("@\4U1$24X^*2![#0H)
M<')I;G0@4SL-"B @("!]#0H@(" @<VQE97 @,SL-"B @("!D;R!D;VMI;&PH
M*3L-"GT-"F5L<V4@>PT*(" @('=H:6QE("@\4SXI('L-"@EP<FEN=#L-"B @
M("!]#0I]#0H-"G-U8B!D;VMI;&P@>R!K:6QL(#DL)&-H:6QD(&EF("1C:&EL
&9#L@?0T*
`
end
------------------------------
Date: Sun, 28 Dec 1997 15:50:04 -0500
From: Boris Statnikov <boromir@mindspring.com>
Subject: Re: Interprocess Communication
Message-Id: <34A6BB7C.D2756362@mindspring.com>
Allan Krause wrote:
> I am trying to write a client/server type application.
>
> The client application is a perl script which will compile and link all the
> components of an application. This application will run on a unix machine
> (solaris).
>
> The server application will extract all the software components to be
> compiled from a configuration management repository (Microsoft SourceSafe)
> using supplied utilities. This application will run on a
> Windows95/WindowsNT machine (i386).
>
> The extraction step performed by the server process will occur after the
> client application has set up the specified destination environment and
> before the compilation commences.
>
> It is envisaged that the client application will send a message to the
> server application which will trigger it to perform the extraction operation
> and signal the client application when it is finished.
>
> I have tried copying sample routines from several books such as "Perl 5 for
> Dummies" (see attached). These routines seem to work ok when both the
> client and server processes are running on the unix box. When both routines
> are run on a Windows95 or WindowsNT box, the client application fails on the
> 'bind' statement with "unknown Error: 0x00002741 at client line 16".
>
> I've no idea how to modify the scripts so one will run on unix and the other
> on NT and have them talk to each other!!!
>
> Does anyone out there have any idea how I can get this to work??????
>
> Name: server
> server Type: unspecified type (application/octet-stream)
> Encoding: x-uuencode
>
> Name: client
> client Type: unspecified type (application/octet-stream)
> Encoding: x-uuencode
Now, I don't pretend to be an expert in this, but I think that sockets (in
general) don't work under WinNT
Posix subsystem. Definitely ask someone else about it though.
Boris
------------------------------
Date: Mon, 29 Dec 1997 13:42:23 +1100
From: Joe <no1joe@geocities.com>
Subject: learning perl
Message-Id: <34A70E0F.FD99D627@geocities.com>
hi im interested in getting started on learning perl/cgi scripts can
any1 point me to some good sites on the net to help me out or anything
else i may be interested in?
thanx in advance
Joe
------------------------------
Date: 29 Dec 1997 01:48:05 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Merry XMas perl monsters
Message-Id: <686vgl$858$1@mendelevium.btinternet.com>
In article <DKkp.30$OX1.474160@news2.voicenet.com>, nospam@domain.com
says...
>If you want information on destroying yourself this Christmas,
>then you should post to a newsgroup which specializes
>on that topic, such as alt.suicide.holiday.
>
>Hope this helps!
>--
It was more like persuading Santa to destroy himself after he outlived his
function, is there a newsgroup dedicated to the assasination of said figure
perhaps? This could be an object lesson to all of us.
Of course brian is right most of us would want to be able to make Santa do
something more useful.
Jonathan.
------------------------------
Date: Sun, 28 Dec 1997 12:57:41 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Allen Chen <achen@nssdc.gsfc.nasa.gov>
Subject: Re: Mysterious FileHandle + fork() behavior; possible Perl bug?
Message-Id: <Pine.GSO.3.96.971228125036.26956E-100000@user2.teleport.com>
On Fri, 26 Dec 1997, Allen Chen wrote:
> The problem is that after I added the forking code, I noticed some very
> strange behavior.
That can happen if you fail to check for a failed fork. You should check
the return value from fork whenever starting more than N child processes,
for some value of N. For me, N is 1. :-)
> $pid=fork();
> if ($pid==0) { # child
Yep, there it is. When that's true, that _might_ be the child process, but
it may be a failed fork. If you're trying to start 20 processes at once,
it's pretty important to check for a failed fork.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 28 Dec 1997 20:47:07 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl doc in .HLP format?
Message-Id: <686dsb$h3s$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Patrick Philippot
<patrick.philippot@hol.fr>],
who wrote in article <01bd12be$ab09e300$02000001@mainsoft>:
> Is there any .HLP version of the perl documentation available?
If you mean OS/2 .hlp format, then to produce it either
a) change one byte in .inf-format documentation;
b) follow the instructions in pod2ipf but remove /inf from ipfc line;
;-)
But since .inf documents are much more useful than .hlp documents,
then probably you are on some (unnamed) documentation-deprived
system. :-(
Ilya
------------------------------
Date: Sun, 28 Dec 1997 13:10:36 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Conrad <amilopxa@eupmt.upc.es>
Subject: Re: problem with modules
Message-Id: <Pine.GSO.3.96.971228131001.26956I-100000@user2.teleport.com>
On 27 Dec 1997, Conrad wrote:
> Can't find loadable object for module Pg in
That's a sure sign that the module is mis-installed. Re-install it and all
should be well. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 29 Dec 1997 01:53:06 GMT
From: "Ho Seng Yip" <cybercom@pacific.net.sg>
Subject: Reloading HTML
Message-Id: <01bd13fb$a817e820$LocalHost@oasis>
Hi,
I will like to ask after my perl script has written the output to a file,
how can I force the newly created html output page to reload itself once.
This is so because, although the new entry is written into the html file,
it seems that whenever I go to that page, it seems to load the previous
page from the cache and the new entry only come in when I reload the page
myself manually.
Will appreciate some help here. ;-)
Thanks.
Regards,
Seng Yip
------------------------------
Date: Sun, 28 Dec 1997 20:06:07 -0800
From: Mike <mhanson@arrowweb.com>
Subject: Size in KB
Message-Id: <34A721AF.3D40@arrowweb.com>
How do you tell the size of a string in KB. I have a string that is the
contents of a file and i want to beable to tell how large it is before i
save it to my server.
------------------------------
Date: Sun, 28 Dec 1997 19:01:13 -0600
From: troxel@sammcgees.com
Subject: Sorting files
Message-Id: <883357232.1170145290@dejanews.com>
Try using the -M file test operator or perform a stat call.
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 29 Dec 1997 02:42:23 GMT
From: jcostom@madcow.jasons.org (Jason Costomiris)
Subject: Re: SQL and PERL
Message-Id: <slrn6ae3gf.ddt.jcostom@madcow.jasons.org>
On 28 Dec 1997 12:45:33 GMT, Peter Salomonsen <pesalomo@online.no> wrote:
: Does anyone know an easy and efficient way to connect Perl and a
: SQL-database in an unix/linux environment? Is there any free code
: available?
I'm a big fan of MySQL (www.tcx.se), which has a very nice DBD driver
to use with the DBI.
--
Jason Costomiris <>< | "VMS is about as secure as a poodle
jcostom@jasons.org | encased in a block of lucite....
http://www.jasons.org/~jcostom/ | .... about as useful, too."
#include <disclaimer.h> | --some guy I read on Usenet
------------------------------
Date: 28 Dec 1997 15:14:09 -0800
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Statistics::Descriptive yields error in AUTOLOAD
Message-Id: <686mg1$d08@sarek.latticesemi.com>
In article <lbbtydkqtd.fsf@surf.usc.edu>,
Terrence Brannon <brannon@surf.usc.edu> wrote:
>
>I run my module which is depedent on Statistics::Descriptive from the
>perl debugger. After a lengthy execution, I get the following error:
[..snip..]
>I would appreciate any help in getting this code working.
I ran a test case that duplicates what you sent me in your error
report, creating a Statistic object inside of a loop and adding data to
it and extracting information from the object. I tried it with a
little bit of data and few loop iterations and with a lot of data and
many loop iterations.
I can't reproduce your error.
perl5.004_04 on SunOS
Statistics::Descriptive 2.1
7500 loop iterations with 1k and 2.5k arrays of data
Since you haven't responded to my earlier email, I'm going to assume
that you're on Christmas break, as someone from USC might be at this
time, but let me repost my email here so that other people can also
learn what kind of information is useful is this case and I can look
like a responsible module maintainer :)
1) Your version of perl (the output from perl -v)
2) Which version of Statistics::Descriptive you're using
(from inside the module)
3) You sent lots of detail about the error, but in this case, I
need more context. In particular, how much data are you working
with? How many loop iterations are you going through?
Since the problem can't be reproduced by my test script (which I'll
tack onto the bottom of this post) we may be running into a problem
with Perl's garbage collection. My gut instinct is that you're not
running a completely safe version of perl.
Please email me after you return from vacation,
Colin Kuskie
#!/usr/local/bin/perl5 -w
#Statistics::Descriptive test script
use strict;
use Statistics::Descriptive;
sub Test {
my ($P, $S);
my ($m, $sd);
my $stat;
for $P (0..50) {
for $S (0..50) {
$stat = Statistics::Descriptive::Sparse->new();
$stat->add_data(@_);
$m = $stat->mean();
$sd = $stat->standard_deviation();
}
}
}
Test(0..1000);
Test(0..1000);
Test(0..2500);
------------------------------
Date: Mon, 29 Dec 1997 01:25:45 +0100
From: stoffer@netcetera.dk (Gustav Kristoffer Ek)
Subject: taint
Message-Id: <stoffer-2912970125450001@loke.netcetera.dk>
I got the error: Insecure $ENV{ENV} while running with -T switch... when
running the following three lines, it seams to be a litle strange since I
use $ENV{PATH} = "/bin:/usr/bin";
#! /usr/bin/perl -Tw
$ENV{PATH} = "/bin:/usr/bin";
open (whoisHandle, "/usr/bin/whois|") or die "Can't open whois. $!";
how can I make'em secure?
- gustav
---------------------------------------------------------------------
Gustav Kristoffer Ek - Netcetera - Finsensvej 80 - 2000 Frederiksberg
tlf 38 88 32 22 / 20 40 00 05 / 38 88 20 38 ext 341 - Fax 38 88 30 38
Webdesign, Webhotel, Mailhotel, UUCP og mere http://www.netcetera.dk/
------------------------------
Date: 28 Dec 1997 23:44:58 GMT
From: "Alicia Carla Longstreet" <carla@ici.net>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <01bd13ea$ef4b33c0$7128b4cf@carla.ici.net>
Charles F Hankel wrote:
: Just to add to this debate, I had to look into the winsock.h file on
: my PC the other day and the first glance showed why COBOL is so much
: more easy to maintain. Anyone with a grain of sense would prefer the
: sheer readability of COBOL to the mess that I saw.
If you prefer a limited language that takes forever to type, fine. But
even COBOL can be made unreadable, and C can be made very readable.
--
Definition of BaseBall - Three minutes of action crammed into 3 hours.
****************************************************************
If at first you don't succeed -- give up! No use being a damn fool.
No job is so simple that is can't be done wrong.
You can only be young once, but you can be immature forever.
Only adults have difficulty with childproof bottles.
==========================================================
Alicia Carla Longstreet carla@ici.net
Web Page http://www.ici.net/cust_pages/carla/index.html
==========================================================
READ THE FAQ for more information:
C-FAQ ftp sites: ftp://ftp.eskimo.com or ftp://rtfm.mit.edu
Hypertext C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
------------------------------
Date: Sun, 28 Dec 97 22:52:29 GMT
From: fred@genesis.demon.co.uk (Lawrence Kirby)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <883349549snz@genesis.demon.co.uk>
In article <67l6kk$m7k$1@sparcserver.lrz-muenchen.de>
watzka@stat.uni-muenchen.de "Kurt Watzka" writes:
>fred@genesis.demon.co.uk (Lawrence Kirby) writes:
>
>>In article <67iipp$ktj$1@darla.visi.com>
>> seebs@plethora.net "Peter Seebach" writes:
>
>>>In article <ObfZp4YD9GA.296@upnetnews02.moswest.msn.net>,
>>>William J. Leary Jr. <Bill_Leary@msn.com> wrote:
>>>>Not that I've ever noticed. I frequently use C compilers to target embedded
>>>>systems.
>>>
>>>Then you're using "freestanding environments", which are a separate language.
>>>The library is, indeed, part of the hosted environment form of C.
>
>>Aren't the standard library identifiers with external linkage reserved
>>even in a freestandinhg environment?
>
>How about "In a freestanding environment the name and type of the function
>called at program startup are implementation-defined. There are otherwise
>no reserved external identifiers". I read that as excluding the reservation
>of external identifiers defined in the library clause in a freestanding
>environment. What am I missing?
Good question. I thought I remembered a discussion in comp.std.c that
mentioned that there was a ruling about this and that the standard functions
are in fact reserved. However as something a little more concrete I see that
that last sentence has been removed from the C9X draft.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
------------------------------
Date: Sun, 28 Dec 1997 21:34:29 -0500
From: Joseph Cotton <jcotton@erols.com>
Subject: word-wrap or insert \n every 50 bytes or less
Message-Id: <34A70C34.5330@erols.com>
Help. I need to word-wrap a string variable. Say:
$string01 = 'bla bla bla bla bla bla bla bla etc....';
I need to insert a \n every n bytes (or less) to word-wrap the string,
so it looks like:
$string01 = 'bla bla bla bla...\n bla bla bla bla...\n ...';
without breaking up a word.
Thanks
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 1544
**************************************