[13729] in Perl-Users-Digest
Perl-Users Digest, Issue: 1139 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 21 09:06:29 1999
Date: Thu, 21 Oct 1999 06:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940511111-v9-i1139@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 21 Oct 1999 Volume: 9 Number: 1139
Today's topics:
Re: Associative Array <gellyfish@gellyfish.com>
Re: Card shuffling <rhomberg@ife.ee.ethz.ch>
Re: Card shuffling <rhomberg@ife.ee.ethz.ch>
Re: Card shuffling <rhomberg@ife.ee.ethz.ch>
Re: Card shuffling (Anno Siegel)
Re: CGI Form Problem <ceesbakk@casema.nl>
Re: Comments in Perl (Martien Verbruggen)
Debugger and IE5 <omar@solve2000.co.uk>
E-Mail via script Perl ? <garnier@ifsic.univ-rennes1.fr>
Re: E-Mail via script Perl ? <ceesbakk@casema.nl>
Re: E-Mail via script Perl ? <tyndiuk@ftls.org>
Re: E-Mail via script Perl ? (Martien Verbruggen)
Re: E-Mail via script Perl ? <rhomberg@ife.ee.ethz.ch>
Re: E-Mail via script Perl ? <gellyfish@gellyfish.com>
Re: Examining Win32 processes mirak63@yahoo.com
Re: file upload <@mdo.net>
Re: Formating text <gellyfish@gellyfish.com>
Re: formatting text with filling '.'s <frank.mower@east.sun.com>
Re: Help - Can't figure this out <perlguy@inlink.com>
Re: How to send & recv via UDP ... with IO:: ?? <ceesbakk@casema.nl>
Re: Ignore the idiots <slanning@bu.edu>
Re: Ignore the idiots (Mitchell Morris)
Is @INC lying to me? <nick.condon@tamesis.com>
newbie problem writing/reading a file <Rik@fast-speed.demon.nl>
Re: Perl certification? (Martien Verbruggen)
Re: PerlScript for ASP installation problem <devx@hotmail.com>
Re: SGML/HTML parsing tool kent@darwin.eeb.uconn.edu
Re: stealing the news: how hard can it be? (Eric Bohlman)
Re: Wall Street E-Commerce <dan@tuatha.sidhe.org>
Re: Win32 install problem <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 21 Oct 1999 12:04:31 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Associative Array
Message-Id: <380ef33f_2@newsread3.dircon.co.uk>
Govindaraj <umungo01@shafika.vetri.com> wrote:
>
> I just like to know this...!!! Sorry, I am not able to find this in any
> perl references.....!!!
>
> I have Perl Script like below:
>
> =====================================
> %Year = ( "Jan" => "One", "Feb" => "Two", "Mar" => "Three", "April" =>
> "Four" );
>
>
> while ( ($key, $value) = each ( %Year ) )
> {
> print "Key : $key\n";
> print "Value : $value\n";
> }
>
> Output:
> =======
>
> Why I cannot get the Output in the order I have give in the
> Associative Array...why like this....not seems to be reverse order
> also...how the perl working on the Associate Array....kidding....!!!
>
from perlfaq4:
How do I sort a hash (optionally by value instead of key)?
Internally, hashes are stored in a way that prevents you from imposing
an order on key-value pairs. Instead, you have to sort a list of the
keys or values:
@keys = sort keys %hash; # sorted by key
@keys = sort {
$hash{$a} cmp $hash{$b}
} keys %hash; # and by value
Here we'll do a reverse numeric sort by value, and if two keys are
identical, sort by length of key, and if that fails, by straight ASCII
comparison of the keys (well, possibly modified by your locale --
see perllocale).
@keys = sort {
$hash{$b} <=> $hash{$a}
||
length($b) <=> length($a)
||
$a cmp $b
} keys %hash;
/J\
--
"Some saw Noel Edmonds as a stinking slimy downmarket local rep from a
package holiday firm. His critics were less kind" - Victor Lewis-Smith,
TV Offal
------------------------------
Date: Thu, 21 Oct 1999 12:47:22 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Card shuffling
Message-Id: <380EEF3A.F6AE2FD3@ife.ee.ethz.ch>
Kragen Sitaker wrote:
> A little fiddling around with GNU bc [1] suggests we need at least 226
> bits of randomness to shuffle a card deck properly. By default,
> random() uses 31 long ints, which is 31 * 32 = 992 bits of state.
> While the random() function's man page claims it has a period of 16 *
> 2^31 -- i.e. 2^35 -- I assume it can actually produce 2^992 different
> random sequences or so.
that would be 2^(992-35) different seqences.
But as there are only 2^32 different seeds, I suspect that there are
only
2^32 different sequences that could be accessed. If indeed there are
different sequences (which wouldn't make sense to me). So we still fall
far short of our goal of at least 226 bits of randomness.
> Using Linux's /dev/random might be helpful, but might be rather slow --
> especially for a web server, since bits of randomness are not collected
> from network activity or timer interrupts. The TrulyRandom module is
> probably a viable solution, though -- again -- slow.
/dev/random suffers a bit on a webserver: no mouse, no kbd
but if we add some true randomness to a good pseudorandom generator, we
should be random enough
> >Best to quote Knuth here (from the mind)
> >
> >"It is not good to construct a random number generator randomly. Some
> >theory should be used"
>
> I believe he was describing the interesting phenomenon that, if you
> construct a random set of numerical operations to use as a RNG, it is
> likely that they will have a short period -- not what we're concerned
> about here.
But still it is important to use theory by comparing the number of
possibilities with the maximum period instead of saying "this method
must be random". Besides, I like that part in Knuths book. Especially
the complicated random number generator that immediately converged to a
single value :-)
- Alex
------------------------------
Date: Thu, 21 Oct 1999 13:14:46 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Card shuffling
Message-Id: <380EF5A6.7F2A05CD@ife.ee.ethz.ch>
Anno Siegel wrote:
> If predictability from the first few cards is a problem (there may
> be situations where it would), you can re-seed the generator every
> so-many cards. Just how sophisticated you are about choosing the
> seed depends on what is at stake.
And how do you choose the new seed? If you use another pseudo random
number generator, you (probably) added some bits. If you use a truly
random process, you get away from the pseudo in the right direction.
> More generally, why is the fact that a random generator is unable
> to produce all permutations of a deck so worrisome? It will still
> draw a representative sample of all permutations, and a big enough
^^^^^^^^^^^^^^^^^^^^^
How do you know that? It depends entirely on how you map the 2^32 random
numbers to the 56! possibilities. I'm sure, given enough time, one could
produce a shuffle function that looks great but has 20 cards at the same
place for every seed of your favorite pseudo random number generator.
> sample to last for a lifetime. After all, when you buy a real deck
> of cards and start playing, you won't produce all possible
> permutations either. No-one frets about that.
No, but I don't exclude all but a fraction of about 10^-57 of the
possibilities a priori. If it could be proved that this is
representative sample, it would be less of a problem (or none). But the
definition of a representative sample depends on the game and the
player, so this proof is IMHO impossible.
The other problem is still that if I know all permutations the number
generator can produce, I need to see only very few cards to know all of
them
- Alex
------------------------------
Date: Thu, 21 Oct 1999 13:23:38 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Card shuffling
Message-Id: <380EF7BA.FF9D16F0@ife.ee.ethz.ch>
Lynn Wilson wrote:
>
> Visit http://www.swcp.com/~lynn/ and look at the shoe.pm module that I
> am preparing for CPAN. It uses rand() but allows a user to override and
> supply their own rand-function for the method to use.
Be aware that shuffling n decks to play black jack has
(52*n)!/[(4*n)!^9*(16*n)!] possible permutations that are different when
playing (colors are the same, 10-K are the same) and
(52*n)!/(n!^52) different permutations for the card counter.
For six decks, the first number is about 2^930, the second 2^1646
That plugin random generator should offer quite some bits of randomness
- Alex
------------------------------
Date: 21 Oct 1999 12:29:40 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Card shuffling
Message-Id: <7un0vk$nq5$1@lublin.zrz.tu-berlin.de>
Alex Rhomberg <rhomberg@ife.ee.ethz.ch> wrote in comp.lang.perl.misc:
>Anno Siegel wrote:
[snip]
>> More generally, why is the fact that a random generator is unable
>> to produce all permutations of a deck so worrisome? It will still
>> draw a representative sample of all permutations, and a big enough
> ^^^^^^^^^^^^^^^^^^^^^
>How do you know that? It depends entirely on how you map the 2^32 random
>numbers to the 56! possibilities. I'm sure, given enough time, one could
>produce a shuffle function that looks great but has 20 cards at the same
>place for every seed of your favorite pseudo random number generator.
What's the probability that this happens with a given pseudo-random
sequence? Bigger than that it happens in a sequence of real-life
shuffles? I don't know, but I'm ready to take the chance.
>> sample to last for a lifetime. After all, when you buy a real deck
>> of cards and start playing, you won't produce all possible
>> permutations either. No-one frets about that.
>
>No, but I don't exclude all but a fraction of about 10^-57 of the
>possibilities a priori.
Apriori shmapriori. That's a red herring in a discussion of
statistics. Both methods exclude all but a tiny fraction of
all permutations.
> If it could be proved that this is
>representative sample, it would be less of a problem (or none). But the
>definition of a representative sample depends on the game and the
>player, so this proof is IMHO impossible.
Let me sketch a proof: Given a class of pseudo-random generators
defined by properties *mumble*, I'm going to prove that every
permutation has an equal (minute) chance to be produced by any
given member. The hard part is to specify *mumble* so that the
proof is possible, but this kind of thing is done by statisticians
all the time.
Anno
------------------------------
Date: Thu, 21 Oct 1999 12:38:31 +0200
From: "Mark Bakker" <ceesbakk@casema.nl>
Subject: Re: CGI Form Problem
Message-Id: <380eecf4$0$4062@reader1.casema.net>
What is your knowledge about perl?
Or do we have to write the whole commercial thing???
Martin Elliott <martin@mert.globalnet.co.uk> schreef in berichtnieuws
7ul7im$ple$1@gxsn.com...
> I've used a few on-line tutorials and still can't get this right.
>
> I basically need a CGI that takes the contents of a form (an order form,
> with a quantity field), checks that against a flat file database, and if
the
> quantity wanted is in the flat file, writes the order to another file and
> ammends the database.
>
> Can any one help, or steer me in the right direction ??
>
> Thanks a lot,
>
> Martin
>
>
------------------------------
Date: 21 Oct 1999 10:49:51 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Comments in Perl
Message-Id: <slrn80ts0l.a5b.mgjv@wobbie.heliotrope.home>
On 20 Oct 1999 03:46:27 -0500,
Abigail <abigail@delanet.com> wrote:
> Alan Curry (pacman@defiant.cqc.com) wrote on MMCCXLI September MCMXCIII
>
> ^^ my ($width, /*$depth,*/ $height);
>
> my ($width, #$depth,
> $height);
>
> One byte less on Unix, same amount of bytes on Windows.
Only in a file. :)
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 12:05:29 +0100
From: "Omar Aslam" <omar@solve2000.co.uk>
Subject: Debugger and IE5
Message-Id: <7ums8r$p45$1@news1.cableinet.co.uk>
Hi,
Environment:
NT 4.0 Server running PerlIS and ActiveState Debugger
IE5 on NT 4.0 Workstation
Prob:
Debugger loads and immediately unloads while IE5 cannot open file (removing
'#! Perl -d' loads file ok)
All I want is to see where I am in the source code while navigating the
application from within my browser.
Any pointers please?
omar@solve2000.couk
------------------------------
Date: Thu, 21 Oct 1999 11:35:34 +0200
From: Laurent-Andre Garnier - licence <garnier@ifsic.univ-rennes1.fr>
Subject: E-Mail via script Perl ?
Message-Id: <380EDE66.BF927322@ifsic.univ-rennes1.fr>
Je cherche a envoyer un mail via un script perl sur un systeme unix.
La commande Unix "sendmail" doit repondre a cela mais je ne sais pas
comment l'uitiliser.
Quel est le script minimum a ecrire ???
Merci.
------------------------------
Date: Thu, 21 Oct 1999 12:35:49 +0200
From: "Mark Bakker" <ceesbakk@casema.nl>
Subject: Re: E-Mail via script Perl ?
Message-Id: <380eec53$0$4048@reader1.casema.net>
Can you PLEASE repeat your questing in English???
I think I know the answer, because I user email very much in perl scripts...
But I dont understand french!
With kind regards,
Mark Bakker
Laurent-Andre Garnier - licence <garnier@ifsic.univ-rennes1.fr> schreef in
berichtnieuws 380EDE66.BF927322@ifsic.univ-rennes1.fr...
>
> Je cherche a envoyer un mail via un script perl sur un systeme unix.
> La commande Unix "sendmail" doit repondre a cela mais je ne sais pas
> comment l'uitiliser.
> Quel est le script minimum a ecrire ???
> Merci.
>
------------------------------
Date: Thu, 21 Oct 1999 12:58:10 +0200
From: Frederic TYNDIUK <tyndiuk@ftls.org>
To: Laurent-Andre Garnier - licence <garnier@ifsic.univ-rennes1.fr>
Subject: Re: E-Mail via script Perl ?
Message-Id: <380EF1C2.6F318031@ftls.org>
Please Use fr.comp.lang.perl to post in french....
If you want use Sendmail, you can use this :
$mailprog = "/usr/sbin/sendmail";
$to = "sername\@host.com";
open(MAIL,"|$mailprog $to") || die "Can't open $mailprog, error $!\n";
# Send Infos
print MAIL <<"EOF";
From: Postmaster\@host.com
To: $to
Subject: Test
Mime-Version: 1.0\nContent-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Your message
EOF
close(MAIL);
But it's you can use Perl Module (Mail::Mailer) :
$mailer = Mail::Mailer->new();
$mailer->open({ From => "Postmaster\@host.com",
To => "username\@host.com",
Subject => "Test"}) || die "Can't open: $!\n";
print $mailer <<"EOF";
Your message
EOF
$mailer->close();
Bye...
FTLS
Laurent-Andre Garnier - licence wrote:
>
> Je cherche a envoyer un mail via un script perl sur un systeme unix.
> La commande Unix "sendmail" doit repondre a cela mais je ne sais pas
> comment l'uitiliser.
> Quel est le script minimum a ecrire ???
> Merci.
--
*-----------------------------------------------------------*
| FTLS E-Mail: - tyndiuk@ftls.org |
|(TYNDIUK Frederic) |
| WWW Perso : - http://www.ftls.org/ |
*-----------------------------------------------------------*
------------------------------
Date: 21 Oct 1999 10:57:01 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: E-Mail via script Perl ?
Message-Id: <slrn80tse3.a5b.mgjv@wobbie.heliotrope.home>
[Your newsreader has a chronology problem. Your answer to the question
actually came _before_ the question itself. Remarkable]
On Thu, 21 Oct 1999 12:35:49 +0200,
Mark Bakker <ceesbakk@casema.nl> wrote:
> Laurent-Andre Garnier - licence <garnier@ifsic.univ-rennes1.fr> schreef in
> berichtnieuws 380EDE66.BF927322@ifsic.univ-rennes1.fr...
I hardly think berichtnieuws is the correct word there.
> >
> > Je cherche a envoyer un mail via un script perl sur un systeme unix.
> > La commande Unix "sendmail" doit repondre a cela mais je ne sais pas
> > comment l'uitiliser.
> > Quel est le script minimum a ecrire ???
> > Merci.
> >
> Can you PLEASE repeat your questing in English???
> I think I know the answer, because I user email very much in perl scripts...
> But I dont understand french!
I could repeat it in Dutch for you, if you want? :) Nah. People won't
like it if I do that. So, in English, and summarising:
He's looking for a way to send email from a Perl script (and of course
we all know that he's the only one who ever asked this question here)
for Unix, and he doesn't know how to use sendmail.
I'll answer it as well:
Get Mail::Sendmail from CPAN at http://www.cpan.org/. There are a whole
bundle of other ones around as well, but on a Unix box Mail::Sendmail is
most natural.
Martien
--
Martien Verbruggen |
Interactive Media Division | Failure is not an option. It comes
Commercial Dynamics Pty. Ltd. | bundled with your Microsoft product.
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 13:51:33 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: E-Mail via script Perl ?
Message-Id: <380EFE45.CF54BEDC@ife.ee.ethz.ch>
[Le script a envoye soi-meme par email]
Laurent-Andre Garnier - licence wrote:
> Je cherche a envoyer un mail via un script perl sur un systeme unix.
> La commande Unix "sendmail" doit repondre a cela mais je ne sais pas
> comment l'uitiliser.
> Quel est le script minimum a ecrire ???
> Merci.
#!/usr/bin/perl -w
#use 5.005;
use strict;
open MSG, "|/usr/lib/sendmail -t" or die ;
#voir 'man sendmail'
print MSG 'To: Laurent-Andre Garnier - licence
<garnier@ifsic.univ-rennes1.fr>';
print MSG "\n";
print MSG "From: rhomberg\@ife.ee.ethz.ch\n";
print MSG "Subject: Le contenu do ce script\n";
print MSG "\n"; # Fin du "header"
@ARGV = ($0);
print MSG <>;
close MSG;
------------------------------
Date: 21 Oct 1999 13:46:26 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: E-Mail via script Perl ?
Message-Id: <380f0b22_2@newsread3.dircon.co.uk>
Laurent-Andre Garnier - licence <garnier@ifsic.univ-rennes1.fr> wrote:
>
> Je cherche a envoyer un mail via un script perl sur un systeme unix.
perlfaq9:
How do I send mail?
> La commande Unix "sendmail" doit repondre a cela mais je ne sais pas
> comment l'uitiliser.
man sendmail
> Quel est le script minimum a ecrire ???
There is an example in the above cited FAQ entry:
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";
From: User Originating Mail <me\@host>
To: Final Destination <you\@otherhost>
Subject: A relevant subject line
Body of the message goes here after the blank line
in as many lines as you like.
EOF
close(SENDMAIL) or warn "sendmail didn't close nicely";
/J\
--
"I can't believe Elton John recorded that song again. Exactly how do you
live your life like a spurgis in the wind?" - Ronnie, Veronica's Closet
------------------------------
Date: Thu, 21 Oct 1999 15:51:38 GMT
From: mirak63@yahoo.com
Subject: Re: Examining Win32 processes
Message-Id: <380f3614.703375@news.vnet.net>
On Wed, 20 Oct 1999 17:54:37 GMT, michel.dalle@usa.net (Michel Dalle)
wrote:
>In article <380e24a3.17138104@news.vnet.net>, mirak63@yahoo.com wrote:
>>I need to examine the System Idle process to see how long it has been
>>running. I've checked the Perl for win32 book by Dave Roth. It shows
>>clearly how to create and manipulate your own processes. However, I
>>can't seem to find any way to access the standard processes.
>
>Is this a disguised way of determining how long ago the system was started ?
>If so, you might try another Win32 API function, namely GetTickCount :
>
>The GetTickCount function retrieves the number of milliseconds that have
>elapsed since Windows was started.
>
>DWORD GetTickCount(VOID)
>
>See the documentation of Win32::API for more details on how to use this.
>
>Have fun,
>
>Michel.
The only problem with this is that every 47 days or so the counter
resets itself... Or maybe I'm reading something wrong. In any case an
example of any PERL script that has been written would be appreciated.
thanks,
Kairm
------------------------------
Date: Thu, 21 Oct 1999 08:30:30 -0400
From: "CS" <@mdo.net>
Subject: Re: file upload
Message-Id: <WEDP3.24649$E_1.1349307@typ11.nn.bcandid.com>
>but the file that is uploaded, gets corrupted, or at least
>pictures get messed up,
You have to use binmode before you do any reading or writing to your files.
open INFILE, "<$myfile";
binmode(INFILE);
# whatever else you do to that file here.
open OUTFILE, ">$yourfile";
binmode(OUTFILE);
# etc.
------------------------------
Date: 21 Oct 1999 12:57:54 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Formating text
Message-Id: <380effc2_2@newsread3.dircon.co.uk>
J-P Theberge <jphil@act.oda.fr> wrote:
>
> Hi,
>
> I want to take some text (coming from
> a <textarea> form) and output it like
> this message (i.e. with a maximum
> line length and a fixed left margin).
>
> Is there a specific module to help me
> do it? Or can you give me some hints
> on how to do it?
>
The module Text::Format may be what you are looking for.
/J\
--
"It's times like this I wish I had a penis" - Duckman
------------------------------
Date: Wed, 20 Oct 1999 20:09:30 -0400
From: Frank Mower <frank.mower@east.sun.com>
Subject: Re: formatting text with filling '.'s
Message-Id: <380E59BA.35A75B71@east.sun.com>
SmFyZWQgRXZhbnMgd3JvdGU6DQoNCj4gSGksDQo+DQo+IElzIHRoZXJlIGFuIGVhc3kgd2F5
IHRvIHByb2R1Y2UgdGhpcyBvdXRwdXQ6DQo+DQo+IEVnZ3MuLi4uLi4uLi4uLi4uLiQyLjAw
DQo+IEJhY29uLi4uLi4uLi4uLi4uLiQzLjAwDQo+IE9uZSBnYWxsb24gTWlsay4uLiQ0LjAw
DQo+DQo+IEFzIHlvdSBjYW4gc2VlIHRoZSBwcmljZXMgYXJlIGFsbCBsaW5lZCB1cCBhbmQg
dGhlIGFyZWEgYmV0d2VlbiB0aGUNCj4gaXRlbSBhbmQgcHJpY2VzIGFyZSBmaWxsZWQgd2l0
aCAnLicgaW5zdGVhZCBvZiBzcGFjZXMuDQo+DQo+IEkgY291bGQgZG8gY2hhcmFjdGVyIGNv
dW50aW5nIGFuZCBhZGQgdGhlIHJpZ2h0IG51bWJlciBvZiBkb3RzIHRvIGVhY2ggbGluZSwN
Cj4gYnV0IGFtIHdvbmRlcmluZyBpZiB0aGVyZSB3YXMgYSBkaXJ0eSBuJyBlYXN5IHRyaWNr
IHRvIGRvIHdpdGggd2l0aCBzb21ldGhpbmcNCj4gbGlrZSBGb3JtYXQ/DQo+DQo+IEphcmVk
DQoNCkhvdyBhYm91dCB1c2luZyB0aGUgbWF4aW11bSBzdHJpbmcgd2lkdGggb3B0aW9uIGlu
IHByaW50ZjoNCg0KcHJpbnRmICIlLjE4cyVzXG4iLCAkaXRlbSAuICIuIiB4IDE4LCAkcHJp
Y2U7DQoNCkZyYW5rDQoNCi0tTXkgb3BpbmlvbnMgYXJlIG15IG93biBhbmQgSSBkbyBub3Qg
c3BlYWsgZm9yIFN1biBNaWNyb3N5c3RlbXMuLS0NCg==
------------------------------
Date: Thu, 21 Oct 1999 06:45:50 -0500
From: Brent Michalski <perlguy@inlink.com>
Subject: Re: Help - Can't figure this out
Message-Id: <380EFCEE.886E6365@inlink.com>
MAN, what a bitchy answer!
;^)
|siv|
Elaine -HFB- Ashton wrote:
>
> Jonathan Stowe wrote:
> > > somebody in here is a bitch and a half...
> >
> > I think Abigail might have overestimated on the 'teenage' attitude ...
>
> Often, too often, when a female of the species threatens the male of the
> species, she is deemed 'bitch' regardless of age or maturity level. It
> is a word used too casually I think.
>
> e.
------------------------------
Date: Thu, 21 Oct 1999 12:40:06 +0200
From: "Mark Bakker" <ceesbakk@casema.nl>
Subject: Re: How to send & recv via UDP ... with IO:: ??
Message-Id: <380eed53$0$4065@reader1.casema.net>
One little questing why do you want to use the UDP protocol if you can use
TCP?
I think TCP is a much better way (error correction ect.).
John Stumbles <visstmbl@reading.ac.uk> schreef in berichtnieuws
Pine.WNT.4.10.9910201813130.195-100000@supc16.rdg.ac.uk...
> Hi,
>
> I'm trying to get data from one unix (Solaris) host to another
> using UDP. I've looked at the examples in the manual (pod/perlipc) and
> Camel and can do this with TCP. I especially like the IO:: package
> versions: Interactive Client with IO::Socket and TCP Servers with
> IO::Socket (reproduced below - please excuse the bandwidth).
>
> s/tcp/udp/ on the scripts don't work however ;-)
>
> Actually on the client the script runs, though I'm far from sure
> it would work if I had a corresponding server (and connecting to
> chargen/19 or time/37 produces nothing).
>
> On the server code using udp instead of tcp in the constructor:
>
> $server = IO::Socket::INET->new( Proto => 'udp',
> LocalPort => $PORT,
> Listen => SOMAXCONN,
> Reuse => 1);
>
> gives the error:
> IO::Socket::INET: Operation not supported on transport endpoint at
> IO_UDP_serv.pl line 8
>
> (but _what_ specific aspect of the Operation?)
>
>
> I know this is a pretty simple-minded (OK, clueless :-) approach:
> UDP is connectionless and so some of the abstractions in the OO model for
> TCP have no equivalents for UDP. Can anybody show me how it should be
> done?
>
>
> tia
>
> [btw email Cc: of newsgroupd replies would be appreciated - news can
> expire here sometimes before it arrives!]
>
> --
> John Stumbles
j.d.stumbles@reading.ac.uk
> I.T. Services Centre, University of Reading
http://www.rdg.ac.uk/~visstmbl
>
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
+
> *** client ***
> #!/usr/bin/perl -w
> use strict;
> use IO::Socket;
> my ($host, $port, $kidpid, $handle, $line);
>
> unless (@ARGV == 2) { die "usage: $0 host port" }
> ($host, $port) = @ARGV;
>
> # create a tcp connection to the specified host and port
> $handle = IO::Socket::INET->new(Proto => "tcp",
> PeerAddr => $host,
> PeerPort => $port)
> or die "can't connect to port $port on $host: $!";
>
> $handle->autoflush(1); # so output gets there right away
> print STDERR "[Connected to $host:$port]\n";
>
> # split the program into two processes, identical twins
> die "can't fork: $!" unless defined($kidpid = fork());
>
> # the if{} block runs only in the parent process
> if ($kidpid) {
> # copy the socket to standard output
> while (defined ($line = <$handle>)) {
> print STDOUT $line;
> }
> kill("TERM", $kidpid); # send SIGTERM to child
> }
> # the else{} block runs only in the child process
> else {
> # copy standard input to the socket
> while (defined ($line = <STDIN>)) {
> print $handle $line;
> }
> }
>
> *** server ***
> #!/usr/bin/perl -w
> use diagnostics;
> use IO::Socket;
> use Net::hostent; # for OO version of gethostbyaddr
>
> $PORT = 9000; # pick something not in use
>
> $server = IO::Socket::INET->new( Proto => 'tcp',
> LocalPort => $PORT,
> Listen => SOMAXCONN,
> Reuse => 1);
>
> die "can't setup server" unless $server;
> print "[Server $0 accepting clients]\n";
>
> while ($client = $server->accept()) {
> $client->autoflush(1);
> print $client "Welcome to $0; type help for command list.\n";
> $hostinfo = gethostbyaddr($client->peeraddr);
> printf "[Connect from %s]\n", $hostinfo->name || $client->peerhost;
> print $client "Command? ";
> while ( <$client>) {
> next unless /\S/; # blank line
> if (/quit|exit/i) { last; }
> elsif (/date|time/i) { printf $client "%s\n", scalar
localtime; }
> elsif (/who/i ) { print $client `who 2>&1`; }
> elsif (/cookie/i ) { print $client `/usr/games/fortune
2>&1`; }
> elsif (/motd/i ) { print $client `cat /etc/motd 2>&1`; }
> else {
> print $client "Commands: quit date who cookie motd\n";
> }
> } continue {
> print $client "Command? ";
> }
> close $client;
> }
>
>
------------------------------
Date: 21 Oct 1999 06:51:56 -0400
From: Scott Lanning <slanning@bu.edu>
Subject: Re: Ignore the idiots
Message-Id: <kusyacxnfzn.fsf@strange.bu.edu>
Nick Condon <nick.condon@tamesis.com> writes:
> I couldn't agree more. The stench of elitism is overpowering.
I think it's an acquired smell.
--
"I teach you the Superman. Man is something that has to be surpassed.
What have you done to surpass him?" --Nietzsche
------------------------------
Date: 21 Oct 1999 13:00:06 GMT
From: mgm@unpkhswm04.bscc.bls.com (Mitchell Morris)
Subject: Re: Ignore the idiots
Message-Id: <slrn80u3il.n3k.mgm@unpkhswm04.bscc.bls.com>
In article <380ED962.71408EDD@tamesis.com>, Nick Condon wrote:
>Benjamin Vargas wrote:
>
>> I think the simple and most polite way to cope with this situation is to
>> ignore the posts you don't wish to read or respond to. I don't understand
>> why someone would take the time to respond to a question that was posted,
>> but choose to try to intimidate or belittle the person asking the question
>> instead of providing useful advice. How does this help to promote the use
>> and development of the Perl language?
>
>Indeed. Nor does it reduce the amount of low-value posts this group gets, which
>is what some of the elitists appear to be complaining about. However low value a
>simple question may be, an abusive answer is lower.
>
>If you think it's stupid question, bite your tongue, don't reply to it. Or if
>you must abuse other posters, do it by email.
QUESTION I (50 pts):
Should you do the same with stupid and/or incorrect answers? Discuss,
especially in light of the fact that the default Perl installation includes
thousands of pages of documentation already indexed and available for both
perusal and searching. Make sure you address the necessity of advocacy in all
question-response pairs that might arise in a newsgroup devoted to the
programming language in question and whether or not there is an obligation on
all parties to promote the use and development of the language given that the
target audience of the posts in question are, by definition, people not
already perl-aware. For extra credit, discuss the change in credibility given
to an adherent who claims that any single tool is appropriate for all
contexts.
>> I think some might choose not to use or learn the language if they were to
>> read some of the posts in this newsgroup. I feel some of the messages
>> posted do not attract Perl newbies. They don't say, "Come and try your hand
>> at this wonderful language". Instead, they seem to say, "Don't you dare try
>> learning Perl unless you are an experienced programmer who does not ask stupid
>> questions."
>
>I couldn't agree more. The stench of elitism is overpowering.
QUESTION II (50 pts):
Consider the ramifications of making it feasible (if not actually
recommended) for anyone who wishes to learn to juggle to begin with
chainsaws. Compare and contrast this (admittedly poor) analogy to the current
question of whether people who are not educated nor trained as programmers
trying to learn the craft without benefit of on-site mentors. Make sure that
your essay addresses the situation where these same people are unable or
unwilling to perform any basic research on their own, including reading
materials already installed on their systems, or searching via readily
available web-based tools.
You may use no more than one blue book per question, but may write on both
sides of the pages. You have three hours remaining.
>
>--
>Nick Condon
>
>
ObPerl: Shouldn't this be considered a FAQ by now? Would a large blinking
text box on www.perl.org and www.activestate.com that says "FULL SEARCHABLE
INDEXED DOCUMENTATION INCLUDED AND INSTALLED AUTOMATICALLY!!!!! PERLDOC IS
YOUR FRIEND!!!!" help?
--
Mitchell Morris
Today's Excuse:
Our POP server was kidnapped by a weasel.
------------------------------
Date: Thu, 21 Oct 1999 11:04:07 +0100
From: Nick Condon <nick.condon@tamesis.com>
Subject: Is @INC lying to me?
Message-Id: <380EE517.63713FED@tamesis.com>
I'm trying to build mod_perl for Apache, and I get this far:
% make test
perl -e 'use Test::Harness qw(&runtests $verbose); $verbose=0; runtests
@ARGV;' t/*.t
Can't locate loadable object for module Apache::Constants in @INC
(@INC contains <..snip..> /usr/local/lib/perl5/5.005/sun4-solaris-thread
<..snip>)
% find /usr/local/lib/perl5 -name 'Constants*' -print
/usr/local/lib/perl5/5.005/sun4-solaris-thread/Apache/Constants
/usr/local/lib/perl5/5.005/sun4-solaris-thread/Apache/Constants.pm
What's going on?
(bandwidth wasting flames by email, please)
--
Nick Condon
------------------------------
Date: Thu, 21 Oct 1999 14:10:22 +0200
From: Rik Driever <Rik@fast-speed.demon.nl>
Subject: newbie problem writing/reading a file
Message-Id: <opG8bBAuKwD4Iwf4@fast-speed.demon.nl>
Hi All,
I have a form on my website and I want to store the values in a textfile
when the user clicks on submit. Then I want to re-direct him/her to a
page where the entire textfile is shown (in a nice format).
I'm *very* new to Perl, but I do know JavaScript, C++ and a little bit
Unix, so I thought it wouldn't be that difficult to make something like
this in Perl....WRONG WRONG WRONG
I read some tutorials and downloaded some scripts from the internet, but
I can't get any of the scripts to work...the only one which actually
worked was the 'Hello World' script, but that's no help :-)
So my question is: Is there somebody out there who would be so kind to
give me some code? I would REALLY appreciate it!
Thanks very much in advantage,
greetings,
Rik Driever
Holland.
------------------------------
Date: 21 Oct 1999 10:48:00 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Perl certification?
Message-Id: <slrn80trt6.a5b.mgjv@wobbie.heliotrope.home>
On Tue, 19 Oct 1999 22:05:22 -0400,
Tad McClellan <tadmc@metronet.com> wrote:
> Martien Verbruggen (mgjv@comdyn.com.au) wrote:
> ( pssst. Uhhh. You're supposed to collect the fee
> *before* you hand them out...
> )
D'oh!
That's why I'm still programming, instead of working on Wall Street.
Martien
--
Martien Verbruggen |
Interactive Media Division | In the fight between you and the
Commercial Dynamics Pty. Ltd. | world, back the world - Franz Kafka
NSW, Australia |
------------------------------
Date: Thu, 21 Oct 1999 11:54:10 +0100
From: "DeveloperX" <devx@hotmail.com>
Subject: Re: PerlScript for ASP installation problem
Message-Id: <7umran$gfo$1@starburst.uk.insnet.net>
For future reference, if anyone else has this problem, the key to installing
PerlScript on PWS is to install Option Pack 4 on the server beforehand.
-Tony
DeveloperX wrote in message <7uk08d$esf$1@starburst.uk.insnet.net>...
>>I need to replace most of the hardware on my bicycle.
>
>It sounds like you've got a bit of a problem there, perhaps if you
explained
>the problem I'd be more able to help.
>
>-nuff said
>
>-tony
>
>
------------------------------
Date: 21 Oct 1999 07:58:45 -0400
From: kent@darwin.eeb.uconn.edu
Subject: Re: SGML/HTML parsing tool
Message-Id: <wk4sflsz62.fsf@darwin.eeb.uconn.edu>
>>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:
Randal> For #1, I'm currently building a tool using
Randal> Parse::RecDecent that takes a DTD to generate a recursive
<snip>
Randal> I can now see why SGML/HTML is a dead-end, and XML/XHTML
Randal> will rock. Those optional close-tags are *hard*, and XML
Randal> has none such.
Just curious, are you using Parse::RecDescent rather than SGMLS
because it allows a pure Perl solution, or is there some other
advantage?
Kent
--
Kent E. Holsinger Kent@Darwin.EEB.UConn.Edu
http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology
-- University of Connecticut, U-43
-- Storrs, CT 06269-3043
------------------------------
Date: 21 Oct 1999 10:13:53 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: stealing the news: how hard can it be?
Message-Id: <7ump11$kdm$3@nntp2.atl.mindspring.net>
Randal L. Schwartz (merlyn@stonehenge.com) wrote:
: And it's funny you should bring that up, because my next WebTechniques
: column is precisely that. Well, it pulls up a list of news services,
: gets the headlines, and then sends mail of only the new headlines.
Just out of curiosity, what format are you using for the list of
services? OCS?
------------------------------
Date: Thu, 21 Oct 1999 14:45:41 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Wall Street E-Commerce
Message-Id: <pGFP3.1988$IZ5.27398@news.rdc1.ct.home.com>
lt lindley <ltl@rgsun40.viasystems.com> wrote:
> Larry Rosler <lr@hpl.hp.com> wrote:
> :>In article <7ulo2a$23l$1@nnrp1.deja.com> on Thu, 21 Oct 1999 00:51:27
> :>GMT, TODD MURRAY <kipbrak@my-deja.com> says...
> :>> I need to speak with the Guru's who are ready to accept this challenge
> :> ^
> :>You don't know the difference between plurals and possessives.
> Hold on there Larry. If the guy is for real and he is talking over
> $200K/year, some of us might be willing to move (or commute) to N.Y.,
> even if he is ignorant about writing proper English. :-)
Hey might not be, or he may be completely full of sh*t, but that sort of money
is available in Manhattan. Normal salary range is a bit lower, but $100k's
nothing to sneeze at. The commute's not too bad either if you live on or
near one of the commuter rail lines. (i.e. in northern Jersey, along the
Connecticut coast, or up the Hudson river)
Dan
------------------------------
Date: 21 Oct 1999 12:59:24 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Win32 install problem
Message-Id: <380f001c_2@newsread3.dircon.co.uk>
Yann Duplaix <yduplaix@netscape.com> wrote:
> Hi,
>
> I have just tried to install the last version of ActivePerl (v 521).
> All was fine, but it seems that one file is missing: <perl.dll>, which is quite
> important!
> An another install did the same (with the same version or on older one).
> Does anyone have any feedback on this perl distribution?
>
Yes It works fine - are you sure you downloaded the full distribution
rather than the Updater (which only has the changed bits from the last
release).
/J\
--
"I came on the train but I think I managed to pass it off as an asthma
attack" - Jenny Eclair
------------------------------
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 1139
**************************************