[10502] in Perl-Users-Digest
Perl-Users Digest, Issue: 4094 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 28 15:06:11 1998
Date: Wed, 28 Oct 98 12:00:21 -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 Wed, 28 Oct 1998 Volume: 8 Number: 4094
Today's topics:
Re: ActiveState Perl: problem with PerlPacketManager: p <perlguy@technologist.com>
Re: Checking for only numbers <minich@globalnet.co.uk>
Re: Checking for only numbers <rootbeer@teleport.com>
Re: Checking for only numbers <ChintanA@worldnetcorp.com>
Re: Checking for only numbers (EXCHANGE:CRK:5T11)
Checking Input for Exactly 2 numbers <support@counter.w-dt.com>
Re: Checking Input for Exactly 2 numbers (I R A Aggie)
Re: clean interupt !!! <jdporter@min.net>
Re: Comparative modularization (was: Not to start a lan <laheadle@boguscs.uchicago.edu>
Database Search with Perl fcga@my-dejanews.com
Re: Email address Checker (Danny Groppo)
Re: END{exit(1)} stuart_poulin@nospam.yahoo.com
Re: getopts question <ChintanA@worldnetcorp.com>
Initializing a hash of arrays <seldenn@psi.com>
Re: Monitoring a child process. (EXCHANGE:CRK:5T11)
Re: Monitoring a child process. (Sean McAfee)
Re: new to perl (maybe) <perlguy@technologist.com>
Perl & SNMP <somckit@u.washington.edu>
Re: Perl & SNMP (Brand Hilton)
PERL FORM jhardy3747@my-dejanews.com
Re: PERL FORM <rootbeer@teleport.com>
Re: Perl Y2K copmliance (John Rixon)
Re: persistent variables ? <Paul.Coleman@CoSeCo.com>
script editing a file <sernc@mailserv.rz.fh-muenchen.de>
Re: script editing a file <minich@globalnet.co.uk>
Re: Set Operators. <jdporter@min.net>
Re: Sorry <support@safetygain.com>
Re: Syntactic flexibility (was: Re: psychology of langu (Dave Kirby)
Trying to kill processes on win32 system... <shanny@iona.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Oct 1998 18:14:55 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: ActiveState Perl: problem with PerlPacketManager: ppm.pl (proxy/internet)
Message-Id: <36375F1F.1DECDD23@technologist.com>
I had a problem with version 0.9.1 but when I switched back to 0.9 it
worked. See if you can find the earlier version...
HTH,
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Wed, 28 Oct 1998 18:19:23 -0000
From: "Martin" <minich@globalnet.co.uk>
Subject: Re: Checking for only numbers
Message-Id: <717n7s$c7c$1@newnews.global.net.uk>
>How do you check to make sure they only enter numbers and not any other
>characters?
print "There's a non-number here!" if $foo =~ /\D/s;
(among other ways)
Martin
------------------------------
Date: Wed, 28 Oct 1998 18:24:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Checking for only numbers
Message-Id: <Pine.GSO.4.02A.9810281023470.3421-100000@user2.teleport.com>
On Wed, 28 Oct 1998, Mike wrote:
> How do you check to make sure they only enter numbers and not any
> other characters?
Take away the rest of the keys on their keyboard.
But maybe you want the FAQ's entry on validating input. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 28 Oct 1998 12:51:01 -0600
From: Chintan Adhyapak <ChintanA@worldnetcorp.com>
Subject: Re: Checking for only numbers
Message-Id: <36376795.5AD4BCB@worldnetcorp.com>
if ($foo !~ /^[0-9]+$/)
{ print "foo has non digits\n"; }
Mike wrote:
>
> How do you check to make sure they only enter numbers and not any other
> characters?
--
________________
Chintan Adhyapak
------------------------------
Date: Wed, 28 Oct 1998 14:08:19 -0500
From: "Bowler, Michael (EXCHANGE:CRK:5T11)" <mkbowler@americasm01.nt.com>
Subject: Re: Checking for only numbers
Message-Id: <36376BA3.83F47773@americasm01.nt.com>
Mike wrote:
>
> How do you check to make sure they only enter numbers and not any other
> characters?
Maybe this will help:
$input = <STDIN>;
chop $input;
if ($input =~ /^\d+$/) {
print "Input is only numbers.\n";
}
--
Michael Bowler Phone: 613-765-3432
IC Design Tools - 5T11 ESN: 39+53432
Nortel Semiconductors Email: mkbowler@nt.com
------------------------------
Date: Wed, 28 Oct 1998 13:10:19 -0600
From: Mike <support@counter.w-dt.com>
Subject: Checking Input for Exactly 2 numbers
Message-Id: <36376C1B.26C3B2CD@counter.w-dt.com>
How would you check the input then to make sure it has exactly two
numbers inputed. Not more not less.
------------------------------
Date: Wed, 28 Oct 1998 14:37:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Checking Input for Exactly 2 numbers
Message-Id: <fl_aggie-2810981437120001@aggie.coaps.fsu.edu>
In article <36376C1B.26C3B2CD@counter.w-dt.com>, Mike
<support@counter.w-dt.com> wrote:
+ How would you check the input then to make sure it has exactly two
+ numbers inputed. Not more not less.
/^\d\d$/
The ^ and $ anchoring may be overkill, tho...
James
------------------------------
Date: Wed, 28 Oct 1998 12:54:28 -0500
From: John Porter <jdporter@min.net>
Subject: Re: clean interupt !!!
Message-Id: <36375A54.8E917A73@min.net>
Michael Renshaw wrote:
>
> "onitr" which basically when you interupted a program with CTR-C
>
> Does anyone know how to emulate this is perl?
Check out the %SIG special variable.
Not emulation, but the real thing.
John Porter
------------------------------
Date: Wed, 28 Oct 1998 18:26:46 GMT
From: Lyn A Headley <laheadle@boguscs.uchicago.edu>
Subject: Re: Comparative modularization (was: Not to start a language war but..)
Message-Id: <wr3pvbcbl09.fsf@yeenoghu.cs.uchicago.edu>
claird@Starbase.NeoSoft.COM (Cameron Laird) writes:
> More pertinent is that Scheme *lacked* a module system
> during the interval when the developers referenced earl-
I think it is most pertinent to say that *Scheme* lacks a module
system. :)
-Lyn
------------------------------
Date: Wed, 28 Oct 1998 19:00:14 GMT
From: fcga@my-dejanews.com
Subject: Database Search with Perl
Message-Id: <717pju$15e$1@nnrp1.dejanews.com>
I'd like to obtain some information on how to do a perl program that searchs
a database created with Access97. The search could be costumized by me
because my database has a lot of tables to search on. Please, could someone
help me? Thank You
Felipe
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 28 Oct 1998 18:40:53 GMT
From: gosdpads@yahoo.com (Danny Groppo)
Subject: Re: Email address Checker
Message-Id: <3637645c.1215624074@nntp.cts.com>
You might want to try page 313-316 for a Email Regex Program in
O'Reilly's Mastering Regular Expressions by Jeffrey Friedl.
On Tue, 27 Oct 1998 02:49:11 GMT, cdtoad@hotmail.com wrote:
>Theres a new book out called the Perl Cookbook and it has an example of how to
>use regular expression to do it... Although you can't tell if it's a REAL
>account or not. Just a validly formed email.
>
>Dave
>
>In article <70t5e0$mos$1@news.cc.ucf.edu>,
> fwf27775@pegasus.cc.ucf.edu (Fritz W Feuerbacher) wrote:
>> Has anyone written a sub function that checks an email address for
>> vilidity?
>>
>> --
>> Linux - The choice of a gnu generation.
>> ‰
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Danny Groppo
gosdpads@yahoo.com
------------------------------
Date: Wed, 28 Oct 1998 11:18:22 -0800
From: stuart_poulin@nospam.yahoo.com
Subject: Re: END{exit(1)}
Message-Id: <36376DFE.20808AD4@nospam.yahoo.com>
Thanks, that does it.
Ilya Zakharevich wrote:
>
> [A complimentary Cc of this posting was sent to
> <stuart_poulin@nospam.yahoo.com>],
> who wrote in article <36367E5C.2F9B3F61@nospam.yahoo.com>:
> > I would like to exit from a script using the END block and and exit
> > value. Is this possible?
> >
> > perl -Mdiagnostics -e 'END{exit(0)}'; echo $?
> > 0
> > perl -Mdiagnostics -e 'END{exit(1)}'; echo $?
> > Callback called exit (#1)
>
> Did you try POSIX::_exit?
>
> Ilya
------------------------------
Date: Wed, 28 Oct 1998 13:25:56 -0600
From: Chintan Adhyapak <ChintanA@worldnetcorp.com>
Subject: Re: getopts question
Message-Id: <36376FC4.B5A6EC05@worldnetcorp.com>
Larry Rosler wrote:
> > > > If @ARGV = () (IE The @ARGV list equals an empty list) then there are no
> > > > more arguments.
> > >
> > > It is difficult to test for @ARGV to equal an empty list, as your non-
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What I was really getting at is this: If I have
getopts('abc');
and someone invokes "myprog.pl a" or "myprog.pl somearg"
these awill both not cause getopts to generate an error. It simply
won't process any arguments for lack of a leading '-'. Is there
someway, I could detect this by looking at @ARGV?
I want to trap even an invocation "myprog.pl -abc somearg"
Essentially I want to know if there is any extra argument that getopts
will ignore.
Thanks,
________________
Chintan Adhyapak
------------------------------
Date: Wed, 28 Oct 1998 14:25:51 -0500
From: "Selden, Neil" <seldenn@psi.com>
Subject: Initializing a hash of arrays
Message-Id: <36376FBE.DE4606D0@psi.com>
Is there a way to initialize a hash of arrays at the time you declare
the variable?
I.E. somthing akin to:
my $var = 0;
but would effectively initialize the entire hash?
E.G.
my %hash = ();
Which I tried, but does not successfully initialize the hash.
Thanks,
Neil
------------------------------
Date: Wed, 28 Oct 1998 14:00:05 -0500
From: "Bowler, Michael (EXCHANGE:CRK:5T11)" <mkbowler@americasm01.nt.com>
Subject: Re: Monitoring a child process.
Message-Id: <363769B5.E6848430@americasm01.nt.com>
Sean McAfee wrote:
> if (kill 0, $pid) {
> # child is alive
> }
Ok, now how do I tell if the child has gone defunct? The above still returns
true if this is the case.
Thanks,
--
Michael Bowler Phone: 613-765-3432
IC Design Tools - 5T11 ESN: 39+53432
Nortel Semiconductors Email: mkbowler@nt.com
------------------------------
Date: Wed, 28 Oct 1998 19:48:59 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Monitoring a child process.
Message-Id: <LyKZ1.3967$fS.12834885@news.itd.umich.edu>
In article <363769B5.E6848430@americasm01.nt.com>,
Bowler, Michael (EXCHANGE:CRK:5T11) <mkbowler@americasm01.nt.com> wrote:
>Sean McAfee wrote:
>> if (kill 0, $pid) {
>> # child is alive
>> }
>Ok, now how do I tell if the child has gone defunct? The above still returns
>true if this is the case.
Something like this, I suppose:
open(PS, "ps -ef |") || die "Can't open pipe: $!\n";
while (<PS>) {
next unless (split)[1] == $pid;
print "Process is defunct\n" if /<defunct>$/;
last;
}
close(PS);
You may need to customize this somewhat for your particular version of ps.
I see there's a Proc::ProcessTable module on CPAN, but it's currently only
advertised to work on Linux, and it's alpha software, at that. You may be
able to cannibalize the code to produce one that works on your particular
OS.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Wed, 28 Oct 1998 18:13:09 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: new to perl (maybe)
Message-Id: <36375EB5.E2A7F17B@technologist.com>
Perl works great on NT!
I use it to work-around many of the bugs/problems/annoyances when
dealing with my NT systems.
I have also written a document management system using Perl on an NT
system. I wrote an article on it which is online at http://www.perl.com
I use it for a lot of CGI programming and database access.
Good luck!
Brent
--
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ Brent Michalski $
$ -- Perl Evangelist -- $
$ E-Mail: perlguy@technologist.com $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
------------------------------
Date: Wed, 28 Oct 1998 09:25:25 -0800
From: Somckit Khemmanivanh <somckit@u.washington.edu>
Subject: Perl & SNMP
Message-Id: <36375385.5068@u.washington.edu>
Hi,
I am a newbie PERL person. I would like to get some pointers on web
pages, FAQs, or books on how to use PERL to access SNMP MIBs.
Thanks.
Somckit
------------------------------
Date: 28 Oct 1998 19:10:24 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Perl & SNMP
Message-Id: <717q70$9qv8@mercury.adc.com>
In article <36375385.5068@u.washington.edu>,
Somckit Khemmanivanh <somckit@u.washington.edu> wrote:
>Hi,
>
>I am a newbie PERL person. I would like to get some pointers on web
>pages, FAQs, or books on how to use PERL to access SNMP MIBs.
http://www.perl.com/CPAN-local/modules/by-module/SNMP/
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Wed, 28 Oct 1998 17:49:28 GMT
From: jhardy3747@my-dejanews.com
Subject: PERL FORM
Message-Id: <717lf7$piv$1@nnrp1.dejanews.com>
Is it possible to have PERL recieve incoming data from a form
Print out the data for the user to see, ask the user if it is correct, then
allow the user to press a continue button and continue printing out
the remaining information on the same page ??
So far I have it reading in the form information and printing it out for the
user to view. The script then continues to do some SQL SELECT and INSERT
routines.
But before it does those routines I would like the user to verify the first
bit of information that was printed and then press a continue button and have
the script perform the SQL statements and continue printing out the returned
value from the SQL statements on the same page with out having to create
another HTML page.
I hope I have explained this properly.
Thanks for any help
John
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 28 Oct 1998 18:28:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: PERL FORM
Message-Id: <Pine.GSO.4.02A.9810281026090.3421-100000@user2.teleport.com>
On Wed, 28 Oct 1998 jhardy3747@my-dejanews.com wrote:
> Subject: PERL FORM
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> Is it possible to have PERL recieve incoming data from a form Print
> out the data for the user to see, ask the user if it is correct, then
> allow the user to press a continue button and continue printing out
> the remaining information on the same page ??
If it's possible using Perl, it's possible using any competent language.
What you ask should be possible, if the protocols you're using allow it,
though. Check the docs, FAQs, and newsgroups about CGI programming and
related topics. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 28 Oct 1998 18:56:01 GMT
From: nospam@sable.ox.ac.uk (John Rixon)
Subject: Re: Perl Y2K copmliance
Message-Id: <717pc1$6uu$1@news.ox.ac.uk>
Organization: Sacred Penguin
Distribution:
Brian Fuller (brian@Emma.COM) wrote:
: In reference to the Subject:. What the hell does copmliance mean? Come
: on people, lets take a little care in spelling.
Why not take a little care about your grammer? :)
--
john@
areti.com
------------------------------
Date: Wed, 28 Oct 1998 14:36:01 -0500
From: "_Paul Coleman" <Paul.Coleman@CoSeCo.com>
Subject: Re: persistent variables ?
Message-Id: <363773d2.0@news3.paonline.com>
As an exercise, keep on reading this ng for 2 weeks, and don't respond to
any questions unless you have an answer to the question, regardless of how
badly you feel the need to teach someone a lesson.
Paul Coleman
Tk Soh wrote in message <36372122.A1C8ED26@email.sps.mot.com>...
>If you have been following this newsgroup, you should the degree of
>contamination of this newsgroup by questions like "when can I find GNU
>zip?", "how do I do this for my webpages", just to name a few.
>
>My apology if I have made the wrong assumption, but it was the only
>assumption base on you post. Perhaps next time you should be more
>precise on your question.
>
>As an excercise, keep on reading this ng for 2 weeks, then tell us if
>you still think your original post was Perl specific.
>
>-tk
------------------------------
Date: Wed, 28 Oct 1998 18:49:09 +0100
From: "Matevz Sernc" <sernc@mailserv.rz.fh-muenchen.de>
Subject: script editing a file
Message-Id: <717lep$r5n$1@sparcserver.lrz-muenchen.de>
hi again.
here is the script (many thanks to Martin!!), but it doesnt seem to work.
What i should say: i dont have linux installed at home, as this is a script
for an online server. And when i try to get scripts at work it always lasts
more hours, thats expensive here in Germany :(
But for script:
What i need it to do:
* The script must get an URL, a user submites to this script through a form.
(name=input)
* Then it must make a copy of an existing file. ($template ---> $filename)
* Then it must ADD a line to $filename.
- This line must include first a text ("start_url: ") AND the
submitted URL (from the form).
Thats it... can anyone please change the below script to do this ?
Thanks a lot
Matevz Sernc
----
#!/usr/local/bin/perl
$filename = "/home/websearch/conf/htdig.conf";
$template = "/home/websearch/conf/nourl.conf";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}
open(FOO,$filename) || die("$filename does not exist \n\n$!");
open(TMP,">temp.tmp") || die("Couldn't make a tempory file \n\n$!");
while(<FOO>) {
$out = chomp;
print TMP if $out;
print TMP $FORM{'input'} unless $out;
}
close(TMP);
close(FOO);
unlink($filename);
rename("temp.tmp",$filename);
exit;
------------------------------
Date: Wed, 28 Oct 1998 18:17:58 -0000
From: "Martin" <minich@globalnet.co.uk>
Subject: Re: script editing a file
Message-Id: <717n57$c5d$1@newnews.global.net.uk>
>here is the script (many thanks to Martin!!), but it doesnt seem to work.
>
>* The script must get an URL, a user submites to this script through a
form.
>(name=input)
>* Then it must make a copy of an existing file. ($template ---> $filename)
>* Then it must ADD a line to $filename.
> - This line must include first a text ("start_url: ") AND the
>submitted URL (from the form).
What you originally said was:
>Can anyone help me in making a cgi script which can open a text file and
>deletes the last line + inserts what a user has entered in a form.
BTW, before anyone asks, I didn't use CGI.pm as it isn't installed on my Web
Space Provider's Server but, since they're cheap, I don't grumble <g>
Martin
------------------------------
Date: Wed, 28 Oct 1998 12:50:32 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Set Operators.
Message-Id: <36375968.275EEFC5@min.net>
Stuart Rison wrote:
>
> Are there any predefined set operators for Perl which work on arrays?
No, but...
> Anything better out there?
Check CPAN for modules that do what you want.
> PS. please cc to me: stuart@NO_JUNKludwig.ucl.ac.uk
Nope, sorry.
John Porter
------------------------------
Date: Wed, 28 Oct 1998 10:14:41 -0800
From: dB <support@safetygain.com>
Subject: Re: Sorry
Message-Id: <36375F11.48E40DB2@safetygain.com>
"Am not!!"
"Are too!!"
"Am not!!"
"Are too!!"
No more need be said - dB
Ronald J Kimball wrote:
> Lee Brandson <rlb@intrinsix.ca> wrote:
>
> > In article <1dgyuxt.1s9yanzvwev18N@bos-ip-1-106.ziplink.net>,
> > rjk@coos.dartmouth.edu (Ronald J Kimball) wrote:
> >
> > > [posted and mailed]
> >
> > Why? Posting was sufficient.
>
> Because I wanted to make sure you read it, of course.
>
> I did not CC this one. I hope you read it anyway.
>
> > > Lee Brandson <rlb@intrinsix.ca> wrote:
> > >
> > > > As an occasional watcher of this ng and its predecessor for some two years
> > > > now, I would like to ask whether it is strictly necessary to be as rude as
> > > > possible when answering (or not answering, as the case may be) a question?
> > > > Is this what it takes to be "in the club?
> > >
> > > If you were more than an "occasional" watcher of this ng and its
> > > predecessor, then you would know that this very question has been asked
> > > numerous times. No, it's not in the FAQ. That's probably because there
> > > is no agreed upon answer; instead it just leads to another drawn-out
> > > debate between people who are unlikely to be convinced to change their
> > > own opinion on the matter.
> >
> > The question was not the topic of my comment. I was addressing the nature
> > of the reply. More generally, I was addressing the general tone of replies
> > throughout this ng. This is not say that all replies are rude, dismissive,
> > insulting, quarrelsome... but opportunities for such replies are seldom
> > overlooked.
>
> You completely misunderstood. I was referring to *your* question.
> [In fact, I don't see any other questions asked in the thread leading up
> to your post. What else could I have been referring to? :-) ]
>
> "As an occasional watcher of this ng and its predecessor for some two
> years now, I would like to ask whether it is strictly necessary to be as
> rude as possible when answering (or not answering, as the case may be) a
> question? Is this what it takes to be 'in the club'?"
>
> That question has been asked numerous times. No, it's not in the FAQ.
> That's probably because there is no agreed upon answer; instead it just
> leads to another drawn-out debate between people who are unlikely to be
> convinced to change their own opinion on the matter.
>
> > > > Do you enjoy the unending long threads of justifications for such
> > > > rudeness?
> > >
> > > Oh, apparently you do know. No, I don't enjoy the threads. And thank
> > > you *so much* for starting yet one more!
> >
> > I did not start it. I merely jumped in to suggest that a polite reply
> > would have all of the benefits and none of the unfortunate side effects of
> > a rude reply.
>
> Yes, you did start the thread. Your post is the one which started the
> justification for such rudeness. [1]
>
> Once again, thank you *so much*.
>
> [1] I'm sure you'll try to say that you didn't. To save you the
> trouble, please refer to dejanews and answer the following questions:
>
> How many posts justifying rudeness are sent in response to posts asking
> FAQs?
>
> How many posts justifying rudeness are sent in response to rude replies
> to FAQs?
>
> How many posts justifying rudeness are sent in response to posts
> condemning rude replies?
>
> --
> _ / ' _ / - aka - rjk@coos.dartmouth.edu
> ( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
> / http://www.ziplink.net/~rjk/
> "It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 28 Oct 1998 19:40:01 GMT
From: dkirby@see.sig.for.addr (Dave Kirby)
Subject: Re: Syntactic flexibility (was: Re: psychology of language choice (was Re: language war ...))
Message-Id: <363767f0.2935173@read.news.global.net.uk>
On Wed, 28 Oct 1998 12:32:23 -0500, John Porter <jdporter@min.net>
wrote:
>mvanier@my-dejanews.com wrote:
>>
>> For instance, there are many different control structures built into perl,
>> but AFAIK no way to add new ones of your own. Contrast this with, say,
>> scheme or dylan where the macro system is powerful enough to allow
>> programmers to define their own control structures (or anything else). For
>> instance, I find it amusing that in guile scheme I can do this:
>>
>> (define def define)
>> (def (square x) (* x x))
>> (square 10)
>> 100
>>
>> You've created a new name for the fundamental defining word! Not that this
>> is useful per se, but it shows that scheme takes perl's "no limits"
>> philosophy one step further wrt syntax.
>
>It seems to me that all you've done here is change the semantics of one
>of the language's key words. You can get the same effect with any ol'
>macro language. (You could get the same effect with Perl by preprocessing
>the program through the C preprocessor, by simply adding -P to the cmdline.)
>You haven't changed the syntax of the language at all.
>How would you add a new syntactic construct in Guile?
I dont know Scheme or Guile, but you can certainly add new language
constructs to TCL or FORTH. In his book Ousterhout gives an example of
adding a completely new looping construct to TCL, and most of FORTH is
written in FORTH. However my recollection of those languages is that
this ability is easily abused and can lead to unreadable &
unmaintainable code, though there are times when it can be useful.
>
>I think it's cool that in Perl I can do things like this:
>
> @result = map2
> {
> my( $x, $y ) = @_;
> $x << 8 + $y # some sample function of (x,y)
> }
> [ 4, 5, 6 ], # the x values
> [ 1, 2, 3 ]; # the y values
>
>This is example illustrates the use of a 2-dimensional mapping
>function, analogous to the (1-dimensional) built-in function 'map'.
>(Note, I'm not saying this is an example of a totally new syntactic
>construct. It's just a way of simulating the syntax of some of the
>existing language features.)
Is map2 a recent addition to the perl language or a user defined
function? You have been able to do the same in python all along:
>>> map( lambda a, b: a<<8 + b, [4, 5, 6], [1, 2, 3] )
[2048, 5120, 12288]
(For the perlers out there the >>> is the interactive command prompt,
map does pretty much the same as in perl, and lambda defines a
nameless function.).
Unlike in perl, map works with any number of parameters:
>>> map( lambda a, b, c: a<<16L + b << 8L + c, [4, 5, 6], [1, 2, 3], [7, 8, 9] )
[17179869184L, 85899345920L, 412316860416L]
running it interactively shows that it doesn't do what the original
poster (presumably) intended, since + binds tighter than << in both
perl and python, which is why I had to switch to arbitrary precision
integers in the last example. What I think he really meant was the
equivalent of:
>>> map( lambda a, b: (a<<8) + b, [1, 2, 3], [4, 5, 6] )
[260, 517, 774]
This may seem like nit-picking, but it illustrates how easy it is to
test code interractively in python. This is part of the reason that
python is so easy to learn and program - I rarely have to look up how
some language feature works, since it is so quick and easy to try it
and see what happens.
Dave K
--------------------------------------------------
All great ideas start as heresy and end as dogma.
dkirby@ <-figure this out, spambots!
bigfoot. My opinions are my own,
com but I'm willing to share.
------------------------------
Date: Wed, 28 Oct 1998 14:43:43 -0500
From: Sean Shanny <shanny@iona.com>
Subject: Trying to kill processes on win32 system...
Message-Id: <363773EE.97FC83C8@iona.com>
To all,
I work in a mixed system environment and am trying to write somewhat
portable perl modules to control process launching and terminating of
test executables. I am using the ActiveState 5.00502 version on NT4
SP3. Not a problem doing process control in UNIX. :-) I use the
WIN32::Process module and can create processes just fine. When I call
->kill() on them thought it looks like the implementation is using
TerminateProcess which does not allow my signal handlers or destructors
that exist in the executable to be called. If I could either refine the
kill call to use ExitProcess or SIGINT or get the pid back from the
->create()call I could work around this problem.
I have seen requests by folks on this on how to get the pid back but I
have not seen any replies. :-( Any help or pointers would be
appreciated in solving this problem.
Thanks
Sean Shanny
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4094
**************************************