[24989] in Perl-Users-Digest
Perl-Users Digest, Issue: 7239 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 13 09:07:13 2004
Date: Wed, 13 Oct 2004 06:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 13 Oct 2004 Volume: 10 Number: 7239
Today's topics:
Re: Creating a random uniqie directory <tadmc@augustmail.com>
Re: Creating a random uniqie directory <jurgenex@hotmail.com>
Re: Creating a random uniqie directory chris-usenet@roaima.co.uk
Re: Creating a random uniqie directory <jurgenex@hotmail.com>
deleting data from a text file (Shaf)
Re: Fetching to and from and subject from MIME:Parser <mritty@gmail.com>
hard references/arrays <tintin@invalid.invalid>
Re: hard references/arrays (Anno Siegel)
Re: hard references/arrays <nobull@mail.com>
Re: hard references/arrays <mritty@gmail.com>
Re: Help! Sendmail on Mac OS X Server <vilain@spamcop.net>
Re: how do i automatically close a Msgbox based on a ti <josef.moellers@fujitsu-siemens.com>
Re: How to flush a stinkin' socket? (J. Romano)
Re: Lagrange Interpolating Polynomial (Anno Siegel)
One liner to produce string of n '?'s separated by comm <richard@zync.co.uk>
Re: One liner to produce string of n '?'s separated by <dzluk8fsxsw0001@sneakemail.com>
Re: One liner to produce string of n '?'s separated by <mritty@gmail.com>
Re: One liner to produce string of n '?'s separated by <richard@zync.co.uk>
Range lookup (Yash)
Sorting Array of String Backward <nntp@rogers.com>
Re: Sorting Array of String Backward <mritty@gmail.com>
Re: Sorting Array of String Backward <jurgenex@hotmail.com>
Re: String and Array Programming in Perl (Anno Siegel)
Re: String and Array Programming in Perl <tadmc@augustmail.com>
Re: Trying to force 32-bit in pack() <sammie-nospam@greatergreen.com>
Re: undef takes forever (Anno Siegel)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Oct 2004 23:15:56 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Creating a random uniqie directory
Message-Id: <slrncmpavs.1fe.tadmc@magna.augustmail.com>
[ Newsgroups trimmed ]
Deke <Deke@nospam.com> wrote:
> I wanted to create a unique temporary directory
^^^^^^^^^
> Will someone suggest some efficient CPAN or
> builtin function or code for that?
I will suggest that you check the Perl FAQ *before* posting
to the Perl newsgroup.
perldoc -q temporary
How do I make a temporary file name?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 13 Oct 2004 05:06:35 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Creating a random uniqie directory
Message-Id: <vJ2bd.2646$y71.59@trnddc02>
Deke wrote:
> I wanted to create a unique temporary directory for temporary
> processing in Perl - since the perl script may be run by several
> processes at one time by multiple users. Will someone suggest some
> efficient CPAN or builtin function or code for that?
Please see "perldoc -q temp":
"How do I make a temporary file name?"
Using that name to create a directory instead of a plain file is left as an
exercise.
jue
------------------------------
Date: Wed, 13 Oct 2004 13:10:28 +0100
From: chris-usenet@roaima.co.uk
Subject: Re: Creating a random uniqie directory
Message-Id: <kiiv32-v4u.ln1@moldev.cmagroup.co.uk>
"Jürgen Exner" <jurgenex@hotmail.com> wrote:
> Please see "perldoc -q temp":
I'd argue that the determination of $temp_dir in that section's example
is wrong. Normal *IX approaches imply that $TMPDIR should override the use
of /tmp, whereas the example only considers $TMPDIR if /tmp doesn't exist.
Is this a documentation "fault" and if so, is posting here sufficient?
Chris
------------------------------
Date: Wed, 13 Oct 2004 12:53:57 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Creating a random uniqie directory
Message-Id: <Fz9bd.2722$MY.899@trnddc03>
chris-usenet@roaima.co.uk wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote:
>> Please see "perldoc -q temp":
>
> I'd argue that the determination of $temp_dir in that section's
> example is wrong. Normal *IX approaches imply that $TMPDIR should
> override the use of /tmp, whereas the example only considers $TMPDIR
> if /tmp doesn't exist.
Good catch! I agree, the way $temp_dir is determined
my $temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMP} || $ENV{TEMP};
does not behave as most people would expect.
> Is this a documentation "fault" and if so, is posting here sufficient?
See "perldoc perlbug". You found it, the honors are yours.
jue
------------------------------
Date: 11 Oct 2004 10:28:37 -0700
From: ahs12@pitt.edu (Shaf)
Subject: deleting data from a text file
Message-Id: <27a89114.0410110928.252c87d2@posting.google.com>
I am new to Perl and have a question regarding deleting header data
from a text file. I have a set of files that I need to delete data
from. Is there something in Perl to delete string data? What is the
best way for me to handle this?
------------------------------
Date: Wed, 13 Oct 2004 12:26:35 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Fetching to and from and subject from MIME:Parser
Message-Id: <%99bd.3778$UR6.897@trndny07>
"Deke" <Deke@nospam.com> wrote in message
news:10mp8u7c99t3ff4@news.supernews.com...
> When using MIME:Parser, how can one fetch the subject:, to: and from:
> fields from the email message?
Have you read the supporting documentation for the class you're using?
perldoc MIME::Parser:
Before reading further, you should see MIME::Tools to make
sure that you understand where this module fits into the
grand scheme of things.
doing what it says, we go to
perldoc MIME::Tools:
Parsing messages
You usually start by creating an instance of MIME::Parser
and setting up certain parsing parameters: what directory to
save extracted files to, how to name the files, etc.
You then give that instance a readable filehandle on which
waits a MIME message. If all goes well, you will get back a
MIME::Entity object (a subclass of Mail::Internet), which
consists of...
o A MIME::Head (a subclass of Mail::Header) which holds
the MIME header data.
I will leave the following the remainder of the documentation trail as
an exercise to the reader.
*After* you've read all the appropriate documentation, if you don't
understand some of it or your code doesn't do what you think it should
based on the documentation, *then* you should post again asking for
help.
Paul Lalli
------------------------------
Date: Wed, 13 Oct 2004 22:01:33 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: hard references/arrays
Message-Id: <2t495mF1s5ereU1@uni-berlin.de>
I'm wanting to set up a loop of array names like:
#!/usr/bin/perl
use strict;
use diagnostics;
my (@name1, @name2, @name3);
foreach my $array qw(name1 name2 name3) {
foreach my $row (@$array) {
print "$row\n";
}
}
This doesn't compile of course and outputs:
Can't use string ("name1") as an ARRAY ref while "strict refs" in use at
/tmp/p
line 7 (#1)
(F) Only hard references are allowed by "strict refs". Symbolic
references are disallowed. See perlref.
So I looked up hard references in perlref, but couldn't see how it applied
to my problem.
Am I on the right track with the construct?
------------------------------
Date: 13 Oct 2004 09:23:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: hard references/arrays
Message-Id: <ckis65$fj$2@mamenchi.zrz.TU-Berlin.DE>
Tintin <tintin@invalid.invalid> wrote in comp.lang.perl.misc:
> I'm wanting to set up a loop of array names like:
>
> #!/usr/bin/perl
> use strict;
> use diagnostics;
>
> my (@name1, @name2, @name3);
>
> foreach my $array qw(name1 name2 name3) {
> foreach my $row (@$array) {
> print "$row\n";
> }
> }
You want
foreach my $array ( \ @name1, \ @name2, \ @name3 ) {
...or
foreach my $array ( \ ( @name1, @name2, @name3) ) {
Anno
------------------------------
Date: Wed, 13 Oct 2004 13:31:21 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: hard references/arrays
Message-Id: <ckj6u2$8b1$2@sun3.bham.ac.uk>
Anno Siegel wrote:
> Tintin <tintin@invalid.invalid> wrote in comp.lang.perl.misc:
>
>>my (@name1, @name2, @name3);
>>
>>foreach my $array qw(name1 name2 name3) {
>
> You want
>
> foreach my $array ( \ @name1, \ @name2, \ @name3 ) {
Surely it's far more likey the OP really wants a single array of arrays.
perldoc perllol
------------------------------
Date: Wed, 13 Oct 2004 12:40:01 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: hard references/arrays
Message-Id: <Bm9bd.5421$275.4070@trndny01>
"Tintin" <tintin@invalid.invalid> wrote in message
news:2t495mF1s5ereU1@uni-berlin.de...
> I'm wanting to set up a loop of array names like:
No you don't. First read
perldoc -q "variable name"
and then search Google for the absurdly large number of posts dealing
with "variable as a variable name" and "symrefs", including more than a
few in the last week.
> #!/usr/bin/perl
> use strict;
> use diagnostics;
>
> my (@name1, @name2, @name3);
>
> foreach my $array qw(name1 name2 name3) {
Why would you want to loop through the *names* of the arrays instead of
the arrays themselves?
> foreach my $row (@$array) {
> print "$row\n";
> }
> }
>
> This doesn't compile of course and outputs:
>
> Can't use string ("name1") as an ARRAY ref while "strict refs" in use
at
> /tmp/p
> line 7 (#1)
> (F) Only hard references are allowed by "strict refs". Symbolic
> references are disallowed. See perlref.
>
> So I looked up hard references in perlref, but couldn't see how it
applied
> to my problem.
Because you've ill-defined your problem. This is basically an XY issue.
You have issue X, which is that you want to access each array one at a
time. You've decided the solution to that is Y, to loop through the
names of the arrays. Your method for Y doesn't work, so you're trying
to figure out a different way of doing Y, instead of figuring out the
proper way of doing X.
> Am I on the right track with the construct?
No.
In the general case, loop through the arrays themselves instead of the
array names:
foreach my $arr (\@array1, \@array2, \@array3) {
foreach my $row (@$arr) {
print "$row\n";
}
}
HOWEVER, in this case all you're doing is printing each element of each
array, followed by a newline. Why even bother looping?
{
local $, = "\n";
print @array1, @array2, @array3;
}
print "\n";
Paul Lalli
------------------------------
Date: Wed, 13 Oct 2004 02:15:42 -0700
From: "Michael Vilain <vilain@spamcop.net>"
Subject: Re: Help! Sendmail on Mac OS X Server
Message-Id: <vilain-844F91.02154213102004@comcast.dca.giganews.com>
In article <Xns9580D6A74A2Dasu1cornelledu@132.236.56.8>,
"A. Sinan Unur" <usa1@llenroc.ude.invalid> wrote:
> "Michael Vilain <vilain@spamcop.net>" wrote in
> news:vilain-55EBED.17552612102004@comcast.dca.giganews.com:
>
> > In article <Xns9580BED4ADA90asu1cornelledu@132.236.56.8>,
> > "A. Sinan Unur" <usa1@llenroc.ude.invalid> wrote:
> >
> >> "Michael Vilain <vilain@spamcop.net>" wrote in
> >> news:vilain-CAEA01.15275512102004@comcast.dca.giganews.com:
> >>
> >> > I have a contact.cgi script that does the following:
> >> >
> >> > open (MAIL, "|/usr/sbin/sendmail $recipient") || die "Can't open
> >> > $mailprog!\n";
> >>
> >> There is no point in passing possibly dangerous data on to the shell.
> >>
> >> You should take Keith's advice and use one of the Mail:: modules on
> >> CPAN.
>
> > Unfortunately, my hosting company won't change their perl or php
> > configuration for me, so I'm stuck using what works.
>
> Not true.
>
> perldoc -q lib
>
> > I see the point in this problem and will fix this approach but
> > can't use CPAN modules beyond what they have installed.
> > I don't think anything short of my own co-located server
> > which would cost way more than $30/month would get me
>
> See what you can get for that money.
>
> http://www.linode.com/products/linodes.cfm
This looks like a virtual domain service that offers email-only support
with a 6-hour guaranteed turnaround 'depending on the time of day'.
There's no mention of backups, data restores or live phone support.
>
> On the cheap side, try:
>
> http://www.digitalspace.net/webhosting/
These guys are cheaper, but they're in Lopoc, a 6-hour drive. I asked
and they also won't install additional CPAN modules on their system.
With my current ISP, I get a UNIX sysadmin with 20+ years experience on
the 2nd ring most times between 7am-12am weekdays and 8am-10pm weekends.
They do backups daily and maintain a climate controlled computer center
with network monitoring.
They're also located a mere a 30 minute drive across the bay if I need
to go over there. Colocation only really works effectively if you can
lay your hands on the system at any time, just as if it were in your
office's computer room. There are lots of little ISPs here in the SF
Bay area, some even only 1 hop away from the Mbone.
My current ISP has Net::SMTP installed. I'll see what I can do to make
that work instead of using sendmail directly.
Thanks for the advise and hosting options. I guess I didn't really look
outside the Bay area.
--
DeeDee, don't press that button! DeeDee! NO! Dee...
------------------------------
Date: Wed, 13 Oct 2004 10:16:50 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: how do i automatically close a Msgbox based on a timer?
Message-Id: <ckio42$vor$1@nntp.fujitsu-siemens.com>
Darc wrote:
> that's great Josef. how does the script look like?
#! /usr/bin/perl
use warnings;
use strict;
use Tk;
die "usage: $0 file" unless @ARGV =3D=3D 1;
my $cdrom =3D '/media/cdrom';
my $movie =3D $cdrom . $ARGV[0];
my $player =3D '/opt/kde3/bin/kaffeine';
sub ismounted($) {
my $m =3D shift;
local *MOUNTS;
my $ismounted =3D 0;
if (open(MOUNTS, "< /proc/mounts")) {
while (<MOUNTS>) {
my @f =3D split /\s+/;
if ($f[0] eq $m || $f[1] eq $m) {
$ismounted =3D 1;
last;
}
}
close MOUNTS;
}
return $ismounted;
}
sub isrunning($) {
my $cmd =3D shift;
local *CMDLINE;
my $isrunning =3D 0;
foreach (</proc/*/cmdline>) {
next unless open(CMDLINE, "< $_");
my $cmdline =3D <CMDLINE>;
$isrunning =3D ((split /\0/, $cmdline)[0] eq $cmd) if=20
(defined($cmdline));
close CMDLINE;
last if $isrunning;
}
return $isrunning;
}
sub eject {
system("eject");
}
sub check($$) {
my ($file, $widget) =3D @_;
system("mount $cdrom");
if (-e $file) {
$widget->destroy();
return;
}
eject;
$widget->after(5*1000, [ \&check, $movie, $widget ]);
}
unless (ismounted $cdrom || system("mount $cdrom"), -e $movie) {
my $top =3D new MainWindow;
$top->Label(-text =3D> "Bitte CDROM einlegen", -bg =3D> 'red')->pack=
();
$top->geometry('+500+300');
$top->after(5*1000, [ \&check, $movie, $top ]);
MainLoop;
}
system("$player -pf $movie");
# Kaffeine runs in the background ...
while (isrunning $player) {
sleep 15;
}
system("umount $cdrom");
eject;
exit 0;
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 11 Oct 2004 07:41:30 -0700
From: jl_post@hotmail.com (J. Romano)
Subject: Re: How to flush a stinkin' socket?
Message-Id: <b893f5d4.0410110641.1d06e866@posting.google.com>
Henry Law <lawshouse.public@btconnect.com> wrote in message news:<hu9dm01jh4olgr9b75rqsg3lnai7h8st1q@4ax.com>...
>
> I've no idea whether or not this post answers the question (sounds
> plausible to me ...) but I had to post my admiration at such a
> comprehensively helpful and beautifully written response. Worth a
> virtual cup of coffee, maybe even a virtual beer!
Thank-you, Henry! I appreciate your comment.
Of course, some of the credit goes to others in the Perl community,
because they helped me a year ago when I had my own similar problem.
Without their help, I wouldn't have known enough to post a response.
(How about a virtual cup of hot cocoa instead?) ;)
Thanks again,
Jean-Luc
------------------------------
Date: 13 Oct 2004 07:36:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Lagrange Interpolating Polynomial
Message-Id: <ckiltj$pv9$1@mamenchi.zrz.TU-Berlin.DE>
Bidek <darek56@yahoo.com> wrote in comp.lang.perl.misc:
> Brian,
> Have you tries the Newton's method instead, here's a suggestion.
>
> The following Perl program estimates the roots of a polynomial using
> Newton's method and Horner's rule.
[code snipped]
That's zero-finding, not interpolation -- an entirely different
problem.
There *is* a Newtonian method (different from Lagrange's) for polynomial
interpolation, but that doesn't seem to be what you are talking about.
Anno
------------------------------
Date: Wed, 13 Oct 2004 13:15:40 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <ckj69c$4up$1@news.freedom2surf.net>
Anyone for golf?
I can't think of anything shorter
$n = 10;
$vals = join ',', split //,'?' x $n;
In case anyone was wondering, this _is_ SQL related ;-)
------------------------------
Date: Wed, 13 Oct 2004 14:27:41 +0200
From: "Jonas Nilsson" <dzluk8fsxsw0001@sneakemail.com>
Subject: Re: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <ckj6vq$sq$1@news.island.liu.se>
"Richard Gration" <richard@zync.co.uk> wrote in message
news:ckj69c$4up$1@news.freedom2surf.net...
> I can't think of anything shorter
>
> $n = 10;
> $vals = join ',', split //,'?' x $n;
How about:
$n=10;
chop($vals = '?,' x $n);
/jN
------------------------------
Date: Wed, 13 Oct 2004 12:32:05 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <9f9bd.5419$275.161@trndny01>
"Richard Gration" <richard@zync.co.uk> wrote in message
news:ckj69c$4up$1@news.freedom2surf.net...
> Anyone for golf?
>
> I can't think of anything shorter
>
> $n = 10;
> $vals = join ',', split //,'?' x $n;
Why bother creating a string only to spilt it?
$vals = join ',', ('?')x10;
Paul Lalli
------------------------------
Date: Wed, 13 Oct 2004 13:40:00 +0100
From: "Richard Gration" <richard@zync.co.uk>
Subject: Re: One liner to produce string of n '?'s separated by commas ... ?
Message-Id: <ckj7mv$5e7$1@news.freedom2surf.net>
In article <9f9bd.5419$275.161@trndny01>, "Paul Lalli" <mritty@gmail.com>
wrote:
> "Richard Gration" <richard@zync.co.uk> wrote in message
> news:ckj69c$4up$1@news.freedom2surf.net...
>> Anyone for golf?
>>
>> I can't think of anything shorter
>>
>> $n = 10;
>> $vals = join ',', split //,'?' x $n;
> Why bother creating a string only to spilt it?
Well, that's kinda what prompted me to ask :-)
> $vals = join ',', ('?')x10;
The idea of using ('?') x 10 never occured to me. My mind did not suggest
it as valid syntax. Excuse me while I read perlop ...
Cheers
R
------------------------------
Date: 13 Oct 2004 05:56:45 -0700
From: yashgt@yahoo.com (Yash)
Subject: Range lookup
Message-Id: <5a373b1d.0410130456.4f12e63d@posting.google.com>
I have a set of ranges such as
<0.1%
0.1-0.2%
0.2-0.3%
0.3-0.4%
0.4-0.5%
0.5-0.6%
0.6-0.7%
0.7-0.8%
0.8-0.9%
0.9-1.0%
1.0-1.5%
1.5-2.0%
2.0-2.5%
2.5-3.0%
3-20%
20-30%
30-40%
>40%
and I have to identify the range that contains an input value such as
1.25. The above set of ranges is not fixed and is configurable in a
text file.
Can somebody suggest the most efficient way to do this, in terms of
the data structure to use and the lookup technique to apply.
Thanks
------------------------------
Date: Wed, 13 Oct 2004 08:32:12 -0400
From: "nntp" <nntp@rogers.com>
Subject: Sorting Array of String Backward
Message-Id: <Z5-dnZFLBa_3vfDcRVn-pA@rogers.com>
I have an array of strings I need to sort from backward, such as in this
order.
cba
dba
eba
I perldoc -f sort, but I can not see it has this feature. Basically, if I
can reverse the string, sort them, then rever them back will do the trick.
The reverse function in perl only do on arrays not on strings.
------------------------------
Date: Wed, 13 Oct 2004 12:59:44 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Sorting Array of String Backward
Message-Id: <4F9bd.3872$wV6.394@trndny06>
"nntp" <nntp@rogers.com> wrote in message
news:Z5-dnZFLBa_3vfDcRVn-pA@rogers.com...
> I have an array of strings I need to sort from backward, such as in
this
> order.
>
> cba
> dba
> eba
These seem sorted pretty normally to me. How is this backwards?
I shall assume for the remainder of the post that you mean you want a
sorted order along the lines of
abc bba cab ==> bba cab abc
ie, sorted by last character first, then second to last character, etc.
> I perldoc -f sort, but I can not see it has this feature. Basically,
if I
> can reverse the string, sort them, then rever them back will do the
trick.
> The reverse function in perl only do on arrays not on strings.
What makes you believe that?
perldoc -f reverse
reverse LIST
In list context, returns a list value consisting of
the elements of LIST in the opposite order. In
scalar context, concatenates the elements of LIST
and returns a string value with all characters in
the opposite order.
$s = 'abc';
$r = reverse $s;
print "$r\n";
__END__
cba
You pass sort a function that defines how you want to sort the elements.
So you could simply do:
my @sorted = sort { (reverse $a) cmp (reverse $b) } @unsorted
However, you may also wish to consider using a Schwartzian Transform, to
minimize the performance hit of reversing every string every time the
sort subroutine is called:
my @sorted =
map $_->[0],
sort { $a->[1] cmp $b->[1] }
map [$_, scalar(reverse $_)],
@unsorted;
Paul Lalli
------------------------------
Date: Wed, 13 Oct 2004 13:08:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Sorting Array of String Backward
Message-Id: <aN9bd.2$dI6.1@trnddc03>
nntp wrote:
> I have an array of strings I need to sort from backward, such as in
> this order.
>
> cba
> dba
> eba
>
> I perldoc -f sort, but I can not see it has this feature.
Well, no.
sort() cannot possibly provide options for sorting in every imaginable way.
That's why you can pass a comparison function of your own.
> Basically,
> if I can reverse the string, sort them, then rever them back will do
> the trick. The reverse function in perl only do on arrays not on
> strings.
What?
Were you fooled by the "LIST" in the header of the reverse() entry in
perldoc?
"reverse LIST"
First you can always pass a list with one element.
And second you should have continued to read:
[...] In scalar context, concatenates
the elements of LIST and returns a string value with all
characters in the opposite order.
The line
print scalar reverse "foobar";
prints a nice
raboof
for me.
jue
------------------------------
Date: 13 Oct 2004 09:35:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: String and Array Programming in Perl
Message-Id: <ckissm$fj$3@mamenchi.zrz.TU-Berlin.DE>
A. Sinan Unur <usa1@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
> I think it was Tad who put it most eloquently: You can't just make s**t up
> and expect it to work!
I've always heard it attributed to MJD, though the quote as I know it
also contains the word "retardo".
Anno
------------------------------
Date: Wed, 13 Oct 2004 05:58:05 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: String and Array Programming in Perl
Message-Id: <slrncmq2ht.2ir.tadmc@magna.augustmail.com>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> A. Sinan Unur <usa1@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
>
>> I think it was Tad who put it most eloquently: You can't just make s**t up
>> and expect it to work!
>
> I've always heard it attributed to MJD, though the quote as I know it
> also contains the word "retardo".
That's how I found the link I posted, I googled for "retardo perl".
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 13 Oct 2004 01:43:09 -0700
From: "Brad Walton" <sammie-nospam@greatergreen.com>
Subject: Re: Trying to force 32-bit in pack()
Message-Id: <hNSdnWACju-Ud_HcRVn-sg@comcast.com>
"Brad Walton" <sammie-nospam@greatergreen.com> wrote in message
news:_bKdnaJVkOV1BvHcRVn-iw@comcast.com...
> > What is the application protocol?
>
> Not sure how to answer that, but this is what is sent to/from:
>
> Size,RequestID,Command,String1,String2(String 2 is always null "")
>
> > Do you realize that recv is for UDP whereas you have specified a tcp
> > socket?
>
> No, I did not. One problem I am having, is the response is sent without a
> newline. I tried:
>
> $response = <$sock>;
>
> But that expects a newline (right?). I need some way to figure out the
> length of data being sent, then read it. I also need to be able to receive
> multiple responses to one request. I got lots of issues...
>
> Thanks,
> Brad
I got it to work. After some research (emails), I found out it needed
little-endian 32 bit 'V'. Thanks again for your help. It is appreciated!
Brad
------------------------------
Date: 13 Oct 2004 09:10:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: undef takes forever
Message-Id: <ckire9$fj$1@mamenchi.zrz.TU-Berlin.DE>
Bart Lateur <bart.lateur@pandora.be> wrote in comp.lang.perl.misc:
> KKramsch wrote:
>
> >so the current version of the script tests for the soundness of
> >the stored file by saving the hash to a dummy file first, then
> >retrieving the hash from memory into a temporary variable $temp,
> >and making sure that $temp is defined and that %$temp has the right
> >number of keys. If all this is as it should be, then the dummy
> >file is used to overwrite the old version of the hash stored on
> >disk.
> >
> > It turns out, however, that this version of the script is about
> >10x slower than the original version,
>
> I think the extra slowness is due to your memory being full,causing
> extensive swapping.
>
> I'd try to move the check to an external script, which needn't be so
> careful about carefully releasing all memory. If necessary, you can
> shortcircuit the garbage collection for that external script using a
> carefully chosen exec().
How so? Did you mean exit()?
...or even POSIX::_exit? That bypasses detailed de-allocation and
frees all memory at once -- much faster. It also bypasses any
DESTROY calls and END blocks, so it isn't always applicable.
Anno
------------------------------
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 7239
***************************************