[17605] in Perl-Users-Digest
Perl-Users Digest, Issue: 5025 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 4 14:06:25 2000
Date: Mon, 4 Dec 2000 11:05:17 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <975956716-v9-i5025@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 4 Dec 2000 Volume: 9 Number: 5025
Today's topics:
Re: changing file permissions with a perl command (not <mischief@velma.motion.net>
Re: changing file permissions with a perl command (not (Flint Slacker)
Re: Counting (Abigail)
Re: DBD::CSV or TEXT::CSV <jeff@vpservices.com>
Error compiling perl, 5.6.0 or 5.7.0 with Linux 2.4.0 a <david+nntpspam@kalifornia.com>
Re: for each file in dir ? (Csaba Raduly)
Re: free database <jeff@vpservices.com>
Getting the user's domain <cleon42@my-deja.com>
Re: Getting the user's domain nobull@mail.com
Re: Help with sendmail (Chris Fedde)
Re: Help with sendmail <mischief@velma.motion.net>
How can I read a variable without evaluating it ? <nospam@me.com>
Re: how to sort a List of Hashes (Anno Siegel)
Re: how to sort a List of Hashes (Robert Hallgren)
Re: how to sort a List of Hashes (Anno Siegel)
Re: how to sort a List of Hashes (Robert Hallgren)
image type not available - WHY? fhinchey@my-deja.com
Re: image type not available - WHY? <jeff@vpservices.com>
Re: Multiple fork()s? (Anno Siegel)
Re: Multiple ICMP pings (Anno Siegel)
Re: need help with warnings <rick.delaney@home.com>
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
newbie question: stopping premature killing of processe <luke@lindsay7777.freserve.co.uk>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 04 Dec 2000 18:25:45 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: changing file permissions with a perl command (not from unix promt!)
Message-Id: <t2nod9fbemeefe@corp.supernews.com>
Bostjan Kocan <webmajster@fiver.si> wrote:
> Yes I upload them with my FTP software (BuletProofFTP).... but I need to
> change permissions of 200 files. I can't do that at once because they are in
> various directories and crawling from one to another and changing
> permissions one by one is a everyday pain.... I need to automate this
> process... Well I don't need to do it with perl but need to do it somehow...
> Is it possible to automate this process with some FTP program like when it
> uploads the file it changes the permission automatically to 777? Is there
> any other ways to do it than manualy with FTP???
> Thanks!
I'd be happy to write code for you that automatically changes
everything that's uploaded to file mode 777, as long as you
give me access to upload it to the server. LOL. Maybe in the
/etc directory and the /bin directory?
Why the hell would you want to make anything uploaded 777?
That means that anyone who can upload can run arbitrary code.
Bad juju there, my friend. I can solve your code problem, but
I won't because someone needs to save you from the specification.
Chris
--
Christopher E. Stith - mischief@motion.net
"We are not robots. We therefore are not required by nature to
follow the Laws of Robotics. The world would be much safer if,
in fact, we were."
------------------------------
Date: Mon, 04 Dec 2000 18:46:37 GMT
From: flint@flintslacker.com (Flint Slacker)
Subject: Re: changing file permissions with a perl command (not from unix promt!)
Message-Id: <3a2de441.13246760@news.tcn.net>
On Mon, 4 Dec 2000 11:42:58 +0100, "Bostjan Kocan"
<webmajster@fiver.si> wrote:
# use unix
use Shell qw(chmod);
chmod "666", "$_";
# now use perl
$mode = oct("0666");
# 777 is real bad, 666 isn't much better, but it's your data
CORE::chmod($mode, $_);
Flint
>I have a replace script that replaces certain strings in 200 files every
>day... First I copy all 200 files from my local to a server... then I run
>this script... the script cannot replace strings because it cannot open the
>file for writing with a 644 permission.... so before that I have two
>choices:
>
>- to change permission of every of 200 files from 644 to 777 by hand using
>unix promt
>-or to change permissions of all files automaticaly with a script which
>first changes permissions from 644 to 777 and then replaces strings and
>changes permissions back to 644.
>
>I need a perl command which will change that permissions...
>
>Does anyone have any idea how it looks?
>
>Please don't give me 'perldoc -f chmod' because I don't have the telnet
>access to server and cannot execute that command but you can send me a copy
>of what that 'perldoc -f chmod' command returns after it's executed.
>
>Thank you!
>
------------------------------
Date: 4 Dec 2000 14:58:17 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Counting
Message-Id: <slrn92nc89.vnu.abigail@tsathoggua.rlyeh.net>
On Sat, 02 Dec 2000 10:09:44 -0600, Todd Anderson (todd@mrnoitall.com) wrote in comp.lang.perl.misc <URL: news:<3A29196F.5EB73403@mrnoitall.com>>:
++ Dear Persons,
++ The code below is designed to extract the first number from a vertical
++ list and then reprint the remaining numbers. It is extracting the first
++ number but then it prints the list without leaving the first number out.
++
++ Any advice is appreciated. Thanks in advance for your help.
++
++ open(LIST,"$location_of_file");
++
++ @numbers =<LIST>;
++ $number_count = @numbers;
++ close (LIST);
++ $count = "0";
++ foreach $number(@numbers){
++ $count++;
++ chop $number;
++ if($count == 1){
++ $in{'user_name'} = $number;
++ }
++ else {
++ $remaining_numbers .= "$number\n";
++ }
++ }#foreach
++ print LIST "$remaining_numbers\n";
Urg. Too much code, no indentation, redundant quotes and no checking of
return values. Bad, bad, bad.
open LIST, "<+ $location_of_file" or die "Failed to open: $!";
my $first = <LIST>;
$in {user_name} = $first if defined $first;
my @rest = <LIST>;
seek LIST, 0, 0 or die "Failed to seeL $!";
print LIST, @rest;
truncate LIST, tell LIST or die "Failed to truncate: $!";
close LIST or die "Failed to close: $!";
Abigail
------------------------------
Date: Mon, 04 Dec 2000 08:31:23 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBD::CSV or TEXT::CSV
Message-Id: <3A2BC6DB.173D71B5@vpservices.com>
[please put your reply after a suitably trimmed version of the thing you
are replying to, thanks]
Chris Sparnicht wrote:
>
> I want to learn SQL without having to use login procedures,
> so I'll probably ask them to install DBD::CSV.
>
> This means I also need to ask my host to install the
> TEXT::CSV_XS module as well?
They can just install Bundle::DBD::CSV which installs everything at
once, but if they do it separately, they will need to install DBI,
DBD::CSV, Text::CSV_XS and SQL::Statement because all are needed to run
DBD::CSV. DBD::RAM makes use of some of those same files, and allows
the same SQL access without login procedures.
--
Jeff
------------------------------
Date: Mon, 04 Dec 2000 11:04:39 -0800
From: "david" <david+nntpspam@kalifornia.com>
Subject: Error compiling perl, 5.6.0 or 5.7.0 with Linux 2.4.0 and glibc 2.2
Message-Id: <bVRW5.127791$w61.88679@dfw-read.news.verio.net>
The compile went fine several months ago when I put 5.6.0 on here, but
since I installed glibc 2.2 automake segfaults inside perl. So I've been
trying to recompile perl. Here is the failure, note that I've tried
numerous options. My standard is to use the defaults but that doesn't
work.
Making DynaLoader (static)
make[1]: Entering directory `/usr/src/perl-5.7.0/ext/DynaLoader'
Makefile out-of-date with respect to ../../lib/Config.pm ../../config.h
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1 || /bin/sh -c true
../../miniperl "-I../../lib" "-I../../lib" Makefile.PL "INSTALLDIRS=perl" "LIBPERL_A=libperl.a"
Processing hints file hints/linux.pl
Writing Makefile for DynaLoader
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command. <==
false
make[1]: *** [Makefile] Error 1
make[1]: Leaving directory `/usr/src/perl-5.7.0/ext/DynaLoader'
make config failed, continuing anyway...
make[1]: Entering directory `/usr/src/perl-5.7.0/ext/DynaLoader'
../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib DynaLoader_pm.PL DynaLoader.pm
../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib XSLoader_pm.PL XSLoader.pm
cp XSLoader.pm ../../lib/XSLoader.pm
cp DynaLoader.pm ../../lib/DynaLoader.pm
AutoSplitting ../../lib/DynaLoader.pm (../../lib/auto/DynaLoader)
make[1]: Leaving directory `/usr/src/perl-5.7.0/ext/DynaLoader'
gcc -L/usr/local/lib -o perl perlmain.o lib/auto/DynaLoader/DynaLoader.a libperl.a `cat ext.libs` -lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
gcc: lib/auto/DynaLoader/DynaLoader.a: No such file or directory
make: *** [perl] Error 1
Does anyone have any ideas, suggestions?
-d
------------------------------
Date: Mon, 4 Dec 2000 18:30:27 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: for each file in dir ?
Message-Id: <Xns9000BDD63quuxi@194.203.134.135>
A million monkeys weren't enough! It took tadmc@metronet.com (Tad
McClellan) on 30 Nov 2000 to produce
<slrn92cjn0.6ge.tadmc@magna.metronet.com>:
>Csaba Raduly <real.email@signature.this.is.invalid> wrote:
>>A million monkeys weren't enough! It took "M.I. Planchant"
>><M.I.Planchant@ncl.ac.uk> on 29 Nov 2000 to produce
>><902hdh$qvi$1@ucsnew1.ncl.ac.uk>:
>>
>>>Im trying to write a script that works as below :
>>>
>>>foreach file in a directory
>>> cat file >> aNewFile
>>>
>>>Each file in a specified directory is appended to a new file in
>>>turn.
>>
>>
>>system('cat /path/to/directory/* >>aNewFile')
> ^^
>
>There is no need for append since the single cat process is
>collecting all of the files.
Whoops, you're right !
>
>There is, of course, no need for 'cat' at all. We have Perl!
>
>
> perl -pe1 /path/to/directory/* >aNewFile
>
>
I was writing mine under the assumption to be incorporated in a script
(as M.I. Planchant originally wrote). If it was down to one-liners, I'd
written it this way:
perl -perl /path/to/directory/* >aNewFile
(what this loses in golf makes up in obfuscation :-)
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
... you'll be the first against -Wall -W -pedantic
------------------------------
Date: Mon, 04 Dec 2000 08:27:55 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: free database
Message-Id: <3A2BC60B.D54074E0@vpservices.com>
richard_dobson@my-deja.com wrote:
>
> Hi, does anyone know of free database software available for win32. I
> have looked into mySQL but there appears to be a license fee. I need to
> put data into and retrieve from the database using perl cgi. Any other
> tips would be appreciated. I will be downloading win32:ODBC
I would recommend that you do not download that, but rather look into
the Perl DBI (database interface), a much more widely applicable and
portable interface to databases and one more widely known and accepted
in the Perl community. win32::ODBC has its uses, but unless you know
what they are and whether you need them, you are probably much better
off with DBI which includes an alternate interface to ODBC called
DBD::ODBC. Listings of tutorials, books, and software for it are
available at:
http://www.symbolstone.org/technology/perl/DBI/
As for which particular database to use, you are probably better off
asking that question in a newsgroup that has database or win32 in its
title but some of the possibilities include MySQL (you might want to
have a closer look at the licensing, I am not sure you are correct about
fees), Interbase, Berkeley DB, or, depending on the complexity of your
needs simple text file based databases such as CSV, fixed width, or
XBase.
--
Jeff
------------------------------
Date: Mon, 04 Dec 2000 15:53:16 GMT
From: Adam Levenstein <cleon42@my-deja.com>
Subject: Getting the user's domain
Message-Id: <90gel7$330$1@nnrp1.deja.com>
Hey all,
Anybody know how to get the user's domain in Perl CGI script? I know
it's something ridiculously simple, but damned if I know what.
Adam
-------------------------------------------------
Adam Levenstein
cleon42@deja.com
"Extraordinary claims require extraordinary evidence."
-- Carl Sagan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 04 Dec 2000 17:38:49 +0000
From: nobull@mail.com
Subject: Re: Getting the user's domain
Message-Id: <u9lmtwytli.fsf@wcl-l.bham.ac.uk>
Adam Levenstein <cleon42@my-deja.com> writes:
> Anybody know how to get the user's domain in Perl CGI script?
What do you mean by "user's domain"? Do you mean the DNS name of the
user's local machine?
Have you looked at the methods offered by CGI.pm or the environment
variables defined by the CGI API? The answer is remote_host() or
$ENV{REMOTE_HOST} respectively.
Anyhow the real answer is you can't. The best you can do it get the
name of their HTTP proxy. If they are not using a proxy then (they
should be shot and) you'll get the DNS of the client.
See numerous previous threads for details. If this is the question I
think it is then it is asked at least once a week.
> Sent via Deja.com http://www.deja.com/
Did you know that deja.com has a search engine?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Mon, 04 Dec 2000 14:49:06 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Help with sendmail
Message-Id: <C9OW5.32$T3.170617344@news.frii.net>
In article <V9JW5.2422$NN6.12910@newsfeed.slurp.net>,
Ted Weber <tweber@abcdefg.com> wrote:
>>post a small fragment of code that is failing and the readers
>>of this group will have a much better chance of pointing out the
>>problem.
>
>OK, here we go and thanks for your help:
>
>First, a snippet from the data def lib
>
>###$mailserver = "sendmail"; #sendmail works everywhere unix'ish
>$mailserver = "smtp"; # or smtp if you use smtp mailer.
>$smtpserver = "smtp.skyenet.net"; # server name if you use SMTP
>
>############# note the one not being used is remmed out.
>
>Now the function code in the common.lib
>
>(again, when I use sendmail, I get a script crash error. When I use the smtp
>option, I get the error "Bad SMTP IP address in SENDEMAIL. (common.lib)' )
>This code has been working fine for over a year until they started jacking
>with our servers and mail servers last month.
>
>
The SMTP part of the code looks like it might work if everything
goes right. There is very little testing for potential problems in
that frag. I'd recommend rewriting that segment using Net::SMTP.
The code will be much easier to understand. And it should be more
robust.
Good Luck
chris
--
This space intentionally left blank
------------------------------
Date: Mon, 04 Dec 2000 18:14:29 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help with sendmail
Message-Id: <t2nno5i0mt9g08@corp.supernews.com>
Ted Weber <tweber@abcdefg.com> wrote:
>>post a small fragment of code that is failing and the readers
>>of this group will have a much better chance of pointing out the
>>problem.
So true. Hard to see the problem when you can't see the code the
problem is in.
> (again, when I use sendmail, I get a script crash error. When I use the smtp
> option, I get the error "Bad SMTP IP address in SENDEMAIL. (common.lib)' )
> This code has been working fine for over a year until they started jacking
> with our servers and mail servers last month.
This I seriously doubt. At least it did not work as shown,
with the data provided to it here.
> First, a snippet from the data def lib
>
> ###$mailserver = "sendmail"; #sendmail works everywhere unix'ish
> $mailserver = "smtp"; # or smtp if you use smtp mailer.
> $smtpserver = "smtp.skyenet.net"; # server name if you use SMTP
Notice how $smtpserver is set to a domain address, which is
not the same as a dotted-decimal IP address. This is important
later.
I had to re-indent the whole subroutine to make looking at it
more bearable. It's not important that your indention style
is the same as mine or as anyone else's, but please make sure
you have a style that is self-consistent. Your code was all
over the place.
>sub sendemail {
> if ($mailserver eq "sendmail") {
### here goes code that isn't important to the
### problem of the error message the OP is getting.
> } else {
> use Socket;
> $REMOTE=$smtpserver;
> $TO=$_[0]; @TO=split('\0',$TO);
> $FROM=$_[1];
> $SUBJECT=$_[2];
> $REPLYTO = $_[3];
> $THEMESSAGE = $_[4];
############################################################
### Here is the OP's problem. The next line of code asks ###
### specifically, q<Is the remote formatted as digits, ###
### dot, digits, dot, digits, dot digits?> The answer, ###
### of course, is no. q<smtp.skyenet.net> is not at all ###
### a dotted-decimal IP address. The program (at least ###
### at this point) is fine. The data is broken. Garbage ###
### In, Garbage Out (GIGO). ###
############################################################
> if ($REMOTE =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) {
> $addr = pack('C4', $1, $2, $3, $4);
> } else {
############################################################
### This is an q<else> clause. This is where control is ###
### after the q<if> statement fails above. Note the only ###
### code run here. I haven't seen the subroutine code ###
### for the sub q<dieerror>, but since it is an error ###
### report, the error it reports matches the error the ###
### OP is getting, and the logic of the program dictates ###
### that this is where we are following program flow ###
### using the provided data, I would have to say that ###
### this is where the `problem' lies. GIGO. ###
############################################################
> &dieerror('Bad SMTP IP address in SENDEMAIL. (common.lib)');
> }
### more code useless to demonstration of the problem
### snipped.
> }
>}
### end of code for OP's problem.
There are a couple of things to do here (besides learning to
follow program flow, learning what the regular expressions
do, and learning to properly indent code so it is easier to
follow). This program could continue to use dotted decimal
notation only, if you are willing to give it only dotted decimal
notation for the server address. You could also read the docs
about gethostbyname. The best docs for that are under
man(3), or in W. Richard Steven's book
_Unix_Network_Programming_,_Volume_1,_Sockets_and_XTI_
for those who prefer paper. I'd recommend any book by Stevens,
and own a few. He uses C, but Perl remains true to its roots
and makes the procedural style of the socket functions almost
mirror C.
Please, in the future, pare down the code to a more manageable
size that still reproduces the problem before posting. Please
try to trace code execution yourself before posting. Please
make sure your code is indented in some recognizable style,
preferably one of those mentioned in Kernighan and Pike's
_The_Practice_of_Programming_. If you do all of this, you may
very well find that you do not need to post in the first place,
since these are the same steps I used to find the problem in the
assumptions of the OP.
Chris
--
Christopher E. Stith - mischief@motion.net
"Who ate all the scones?"
------------------------------
Date: Mon, 04 Dec 2000 19:07:52 +0200
From: Marcelo Montagna <nospam@me.com>
Subject: How can I read a variable without evaluating it ?
Message-Id: <3A2BCF68.BCEADBF@me.com>
Hello everyone,
I have a hash like
MyHash = (
FirstName => $FORM{fname},
Email => $FORM{email}
);
Now, I'd like to know what value is assigned to each key, without
evaluating it, I mean, something that will return exactely
"$FORM{email}" (Dollar sign, letter "F",...etc) as a string and not its
value.
I'm sure it must be possible, but after hours searching the net, I
couldn't find a way to do it.
Thank you in advance for any replies.
--
Marcelo Montagna
marcelo1 ---at--- forum ---dot--- nu
------------------------------
Date: 4 Dec 2000 14:14:01 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to sort a List of Hashes
Message-Id: <90g8r9$vj4$1@lublin.zrz.tu-berlin.de>
Robert Hallgren <sandhall@swipnet.se> wrote in comp.lang.perl.misc:
>On Sat, 2 Dec 2000 03:53:53 -0500,
> Hsien-Hsin Lee <linear@eecs.umich.edu> wrote:
>
>> A trivial question, but baffled me. Could some experts show me how to
>> sort a List of Hashes data structure by a particular field (e.g. last
>> as follow) ?
>
>perldoc -q sort
>
>Example:
>
> my @sorted = map { $_->[0] }
> sort { $a->[1] cmp $b->[1] }
> map { [ $_, uc($_->{last}) ] } @friends;
Why do you assume the original poster wants to ignore case while
sorting? He said nothing of that sort.
In any case, offering a Schwartz transform for a trivial sorting
problem is probably not going to help as much as it could. The
answer is actually in
perlfaq4: How do I sort an array by (anything)?
Anno
------------------------------
Date: Mon, 04 Dec 2000 14:52:18 GMT
From: sandhall@swipnet.se (Robert Hallgren)
Subject: Re: how to sort a List of Hashes
Message-Id: <slrn92nbul.3td.sandhall@poetry.lipogram>
On 4 Dec 2000 14:14:01 -0000,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Robert Hallgren <sandhall@swipnet.se> wrote in comp.lang.perl.misc:
>
> >perldoc -q sort
> >
> >Example:
> >
> > my @sorted = map { $_->[0] }
> > sort { $a->[1] cmp $b->[1] }
> > map { [ $_, uc($_->{last}) ] } @friends;
>
> Why do you assume the original poster wants to ignore case while
> sorting? He said nothing of that sort.
It was an _example_, as stated. Not _the_ solution (since I don't
assume anything).
> In any case, offering a Schwartz transform for a trivial sorting
> problem is probably not going to help as much as it could. The
> answer is actually in
>
> perlfaq4: How do I sort an array by (anything)?
I know. And 'perldoc -q sort' is a way to get there (same faq, same
answer and same example of the Schwartzian Transform).
Forgive me for asking, but what did you provide that I didn't?
Robert
--
Robert Hallgren <sandhall@swipnet.se>
PGP: http://www.lipogram.com/pgpkey.asc
5F1E 95C2 F0D8 25A3 D1BE 0F16 D426 34BD 166A 566C
------------------------------
Date: 4 Dec 2000 15:13:38 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: how to sort a List of Hashes
Message-Id: <90gcb2$voe$1@lublin.zrz.tu-berlin.de>
Robert Hallgren <sandhall@swipnet.se> wrote in comp.lang.perl.misc:
>On 4 Dec 2000 14:14:01 -0000,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
>> Robert Hallgren <sandhall@swipnet.se> wrote in comp.lang.perl.misc:
>>
>> >perldoc -q sort
>> >
>> >Example:
>> >
>> > my @sorted = map { $_->[0] }
>> > sort { $a->[1] cmp $b->[1] }
>> > map { [ $_, uc($_->{last}) ] } @friends;
>>
>> Why do you assume the original poster wants to ignore case while
>> sorting? He said nothing of that sort.
>
>It was an _example_, as stated. Not _the_ solution (since I don't
>assume anything).
>
>> In any case, offering a Schwartz transform for a trivial sorting
>> problem is probably not going to help as much as it could. The
>> answer is actually in
>>
>> perlfaq4: How do I sort an array by (anything)?
>
>I know. And 'perldoc -q sort' is a way to get there (same faq, same
>answer and same example of the Schwartzian Transform).
>
>Forgive me for asking, but what did you provide that I didn't?
I provided a pointer to an answer that clarifies instead of muddying
the waters.
The immediate solution of the OPs problem is
@sorted = sort { $a->{ last} cmp $b->{ last}} @friends;
Because the sort field is already accessible directly from each
list element, there is no benefit in a Schwartz transform here
(well, very little anyway). The rationale of the ST is to save
sort field extractions, and it doesn't pay when sort field
extraction is cheap to begin with.
So what you did was answer a question that wasn't asked, offering
a solution that is inadequate for the original problem.
Anno
------------------------------
Date: Mon, 04 Dec 2000 16:53:23 GMT
From: sandhall@swipnet.se (Robert Hallgren)
Subject: Re: how to sort a List of Hashes
Message-Id: <slrn92nj18.lv.sandhall@poetry.lipogram>
On 4 Dec 2000 15:13:38 -0000,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> Robert Hallgren <sandhall@swipnet.se> wrote in comp.lang.perl.misc:
>
> >I know. And 'perldoc -q sort' is a way to get there (same faq,
> >same answer and same example of the Schwartzian Transform).
> >
> >Forgive me for asking, but what did you provide that I didn't?
>
> I provided a pointer to an answer that clarifies instead of
> muddying the waters.
What are you talking about? What's wrong with 'perldoc -q sort'?
> The immediate solution of the OPs problem is
>
> @sorted = sort { $a->{ last} cmp $b->{ last}} @friends;
>
> Because the sort field is already accessible directly from each
> list element, there is no benefit in a Schwartz transform here
> (well, very little anyway).
That I overlooked, I'll admit. But why not point that out from the
beginning then? No need to get nasty.
[...]
> So what you did was answer a question that wasn't asked, ...
Mmm, very deep.
Robert
--
Robert Hallgren <sandhall@swipnet.se>
PGP: http://www.lipogram.com/pgpkey.asc
5F1E 95C2 F0D8 25A3 D1BE 0F16 D426 34BD 166A 566C
------------------------------
Date: Mon, 04 Dec 2000 16:40:18 GMT
From: fhinchey@my-deja.com
Subject: image type not available - WHY?
Message-Id: <90ghdg$5lo$1@nnrp1.deja.com>
This is probably supposed to go in the CGI forum, but it is written in
perl, so I thought someone here might know what's going on. I have form
where a user can insert an image name. On submit, I created a CGI that
automatically adds a "_small" to the end of the image name and then
sends a <img src=""> to the browser with the new image name. The weird
thing is the image path and name comes up fine but the image comes up
broken. When I look at the image properties I get a "Type: Not
Available". I have other images on the page that work fine - it's just
the ones whose names I manipulated. Somehow the browser can't detect
that it's looking for an images, but why? HELP!
Here's my code for the image name manipulation...
******************************************
$name= $query->param('image');
$imageinsert = "<img src=\"../../images/new/";
($shortname,$tag) = split( /\./, $name );
$shortname = "$shortname\_small$\.$tag";
$imageinsert = $imageinsert$shortname\">;
print (qq{Content-type: text/html\n\n<html>
$imageinsert
});
*********************************************
Thanks,
Frank
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 04 Dec 2000 09:01:19 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: image type not available - WHY?
Message-Id: <3A2BCDDF.9085F6F@vpservices.com>
fhinchey@my-deja.com wrote:
> $shortname = "$shortname\_small$\.$tag";
Does that really produce the URL to the image you want? What is "$\."
suppossed to mean?
> $imageinsert = $imageinsert$shortname\">;
That doesn't even compile. If you want the assistance of this
newsgroup, please cut and paste real code that compiles rather than
something you retype. Otherwise we end up looking for mistakes that
aren't really part of your code in the first place.
--
Jeff
------------------------------
Date: 4 Dec 2000 14:36:48 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Multiple fork()s?
Message-Id: <90ga60$vm5$1@lublin.zrz.tu-berlin.de>
Rodney Ramos <rodneyra@my-deja.com> wrote in comp.lang.perl.misc:
>I´m having a problem like this one, but with Solaris 2.6. I made a
>script to ping 500 routers, using fork, and at the end a receive a
>message of "segment fault" and a core dump file is genarated.
If you are trying to fork 500 processes at once, I'm not amazed.
Try to throttle that some.
Anno
------------------------------
Date: 4 Dec 2000 14:26:47 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Multiple ICMP pings
Message-Id: <90g9j7$vkl$1@lublin.zrz.tu-berlin.de>
Rodney Ramos <rodneyra@my-deja.com> wrote in comp.lang.perl.misc:
>Does anyone know how can I make a scrip to ping several hosts at same
>time? I mean, I want to ping several hosts without having to wait one
>finish to ping the next, because I have to do this in a short period of
>time and I have more than 1,000 hosts.
Have you searched CPAN? Found the Net::Ping module? Tested and
considered its possibilities and limitations? Considered using
the system ping instead?
Do that. If you have specific questions, ask again.
Anno
------------------------------
Date: Mon, 04 Dec 2000 14:20:03 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: need help with warnings
Message-Id: <3A2BAB7A.B618AAB0@home.com>
[posted to clpmisc and cc'ed module author]
John Hunter wrote:
>
[earlier...]
> Prototype mismatch: sub main::tag (@_) vs none at myhtml2texi line 28.
> Subroutine tag redefined at myhtml2texi line 14.
> >>>>> "Rick" == Rick Delaney <rick.delaney@home.com> writes:
>
> Rick> It could have been defined in this one.
>
> >> use Text::Autoformat;
>
> Rick> Or maybe this one, though I doubt that also. Or maybe in
> Rick> some module or library called from any one of these.
>
> Yep, that was it. Text::Autoformat provides 'sub tag(@_)'.
Ah, so this module is evil. It exports its subroutines into your
namespace (main) without you asking for it AND WITHOUT SAYING SO IN THE
DOCUMENTATION. Looking at the source you will find this in the import
sub:
foreach (@EXPORT_OK) { *{caller() . "::$_"} = \&$_ }
I'm speechless.
And what kind of prototype is (@_) anyway? This appears to be a bug in
Perl since all kinds of weird prototypes are accepted without complaint.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Mon, 04 Dec 2000 16:34:48 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <t2nht823dg2ccc@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 27 Nov 2000 16:50:04 GMT and ending at
04 Dec 2000 13:17:01 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2000 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 168 (40.9% of all posters)
Articles: 296 (23.2% of all articles)
Volume generated: 604.3 kb (26.2% of total volume)
- headers: 223.2 kb (4,580 lines)
- bodies: 373.9 kb (12,789 lines)
- original: 300.5 kb (10,509 lines)
- signatures: 6.9 kb (160 lines)
Original Content Rating: 0.804
Averages
========
Posts per poster: 1.8
median: 1.0 post
mode: 1 post - 113 posters
s: 2.5 posts
Message size: 2090.4 bytes
- header: 772.0 bytes (15.5 lines)
- body: 1293.4 bytes (43.2 lines)
- original: 1039.7 bytes (35.5 lines)
- signature: 24.0 bytes (0.5 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
25 97.5 ( 18.7/ 77.9/ 77.9) PerlFAQ Server <faq@denver.pm.org>
13 18.6 ( 9.3/ 9.3/ 7.9) simbean@my-deja.com
8 16.5 ( 4.4/ 12.1/ 5.2) OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net>
7 15.5 ( 7.0/ 8.5/ 3.4) SPAM_loginprompt@yahoo.com
6 7.6 ( 4.2/ 3.5/ 1.8) "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
5 5.8 ( 3.6/ 2.1/ 1.7) lightfoote@my-deja.com
5 9.1 ( 4.6/ 3.3/ 1.8) Ilmari Karonen <usenet11289@itz.pp.sci.fi>
4 5.9 ( 3.0/ 2.8/ 1.7) tmills@total-care.com
4 7.4 ( 3.4/ 3.9/ 1.7) Ned <ned911@home.com>
4 6.7 ( 2.6/ 3.4/ 2.5) Henry_Barta <hbarta@enteract.com>
These posters accounted for 6.3% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
97.5 ( 18.7/ 77.9/ 77.9) 25 PerlFAQ Server <faq@denver.pm.org>
29.4 ( 1.6/ 27.8/ 26.6) 2 "Kos" <kseterba@chello.no>
26.7 ( 2.0/ 24.7/ 18.3) 3 neurofase@my-deja.com
18.6 ( 9.3/ 9.3/ 7.9) 13 simbean@my-deja.com
16.5 ( 4.4/ 12.1/ 5.2) 8 OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net>
15.5 ( 7.0/ 8.5/ 3.4) 7 SPAM_loginprompt@yahoo.com
12.5 ( 3.8/ 8.6/ 4.5) 4 "Steve Bourgeois" <sb299@netzero.net>
9.5 ( 1.5/ 8.0/ 7.9) 2 richard_papworth@my-deja.com
9.1 ( 4.6/ 3.3/ 1.8) 5 Ilmari Karonen <usenet11289@itz.pp.sci.fi>
7.6 ( 4.2/ 3.5/ 1.8) 6 "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
These posters accounted for 10.5% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
1.000 ( 2.4 / 2.4) 3 "Jerry" <jfdecd@execpc.com>
1.000 ( 77.9 / 77.9) 25 PerlFAQ Server <faq@denver.pm.org>
0.853 ( 7.9 / 9.3) 13 simbean@my-deja.com
0.789 ( 1.7 / 2.1) 5 lightfoote@my-deja.com
0.743 ( 18.3 / 24.7) 3 neurofase@my-deja.com
0.742 ( 1.0 / 1.3) 3 Gert Brinkmann <gbrinkmann@dimedis.de>
0.739 ( 2.5 / 3.4) 4 Henry_Barta <hbarta@enteract.com>
0.731 ( 2.2 / 3.1) 3 "Bostjan Kocan" <webmajster@fiver.si>
0.683 ( 2.1 / 3.1) 3 "Adrian Clark" <adrian.clark@baesystems.com>
0.584 ( 1.7 / 2.8) 4 tmills@total-care.com
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.581 ( 1.7 / 3.0) 3 "eriky" <erik.ykema@usa.net>
0.562 ( 1.8 / 3.3) 5 Ilmari Karonen <usenet11289@itz.pp.sci.fi>
0.524 ( 1.8 / 3.5) 6 "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
0.522 ( 4.5 / 8.6) 4 "Steve Bourgeois" <sb299@netzero.net>
0.518 ( 2.2 / 4.2) 3 Gary Burton <glburton@mindspring.com>
0.431 ( 5.2 / 12.1) 8 OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net>
0.427 ( 1.7 / 3.9) 4 Ned <ned911@home.com>
0.412 ( 0.6 / 1.5) 3 "Joe" <mantisman@usa.net>
0.401 ( 3.4 / 8.5) 7 SPAM_loginprompt@yahoo.com
0.329 ( 1.1 / 3.4) 4 Ken <ka@pacific.net>
20 posters (11%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
23 comp.lang.perl.modules
19 alt.perl
6 comp.lang.perl
5 de.comp.lang.perl.misc
5 fr.comp.lang.perl
5 pl.comp.lang.perl
3 comp.protocols.snmp
2 comp.answers
2 microsoft.public.xml
2 misc.books.technical
Top 10 Crossposters
===================
Articles Address
-------- -------
4 Tore Nestenius <info@programmersheaven.com>
4 OTR Comm <otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net>
4 "Harley Green" <ep@w3dzine.net>
2 Hilkiah Lavinier <hl198@doc.ic.ac.uk>
2 Karl <karl@nsal.com>
1 "Ryan Buterbaugh" <webmaster@duckpaw.com>
1 Michael Salleo <michael@omon.net.au>
1 Henry_Barta <hbarta@enteract.com>
1 Jim <waitword@mindspring.com>
0 Bill Wang <wangbill18@hotmail.com>
------------------------------
Date: Mon, 4 Dec 2000 16:37:45 -0000
From: "Luke Lindsay" <luke@lindsay7777.freserve.co.uk>
Subject: newbie question: stopping premature killing of processes when the user presses stop
Message-Id: <90gh1l$5td$1@news.ox.ac.uk>
I am writing a perl program that processes cgi data. I want to make sure
that even if the user presses stop, back etc on their browser, the process
lives
long enough to complete writing information to disk if it has started doing
so. I.e. I don't want the user to be able to leave the data stored on the
disk in an inconsistent state. What is the best way of doing this?
Sorry, I realise this is a rather unfocused question.
TIA
Luke
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 5025
**************************************