[9005] in Perl-Users-Digest
Perl-Users Digest, Issue: 2623 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 17 20:07:51 1998
Date: Sun, 17 May 98 17:00:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 17 May 1998 Volume: 8 Number: 2623
Today's topics:
Appreciation of Perl & the Perl Community! <mgregory@asc.sps.mot.com>
Re: Como crear un CHAT en WEB???/ How to create a CHAT txema@thepentagon.com
Re: Does a script run slow if it is 100 to 200K big? <rootbeer@teleport.com>
Re: Does Perl have a IDE?I don't like command line. <birgitt@order.booktraders.com>
Re: Does Perl have a IDE?I don't like command line. <birgitt@order.booktraders.com>
Re: Does Perl have a IDE?I don't like command line. patrick.mannion@us.socgen.com
form data <jlampard@quakerstate.com>
Re: form data <jlampard@quakerstate.com>
Re: form data <jlampard@quakerstate.com>
Re: I need to determine WHOLE numbers. HELP? (Shaun Sides)
Re: I need to determine WHOLE numbers. HELP? <ljz@asfast.com>
Re: Is if ($a="something") a bad style? (Mark-Jason Dominus)
Re: Is if ($a="something") a bad style? (brian d foy)
Re: Is if ($a="something") a bad style? (Ilya Zakharevich)
Is there a Perl IDE for win32 <mcjason@idirect.com>
Re: Nuclear bombing of NEW YORK! Small countries can ta (Martien Verbruggen)
Re: Perl Error Documentation <rootbeer@teleport.com>
POP up window <kira98_98@yahoo.com>
Quick Question about Perl TCP/IP <mcjason@idirect.com>
Re: Quick Question about Perl TCP/IP (Mike Stok)
Re: simple help with one-liner needed (newbie question) <rootbeer@teleport.com>
Re: simple help with one-liner needed (newbie question) <danboo@negia.net>
Re: simple help with one-liner needed (newbie question) (Shaun Sides)
Re: Startup overhead <rootbeer@teleport.com>
Re: Tip: Filehandles <mgregory@asc.sps.mot.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 May 1998 14:11:08 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Appreciation of Perl & the Perl Community!
Message-Id: <r8wwbljyqj.fsf@asc.sps.mot.com>
Hey Gang,
I recently found out another reason why perl is so good. It's because
you can ask a question here about something that seems to be broken,
and incredibly quickly have a well thought out, knowledgeable answer.
Mostly perl is not broken, and even when it is (as in my recent case),
the amazing thing is that the developers have usually already fixed
the bug that you found in the release that is just about to come out.
Thanks, Perl People!
Martin.
------------------------------
Date: Sun, 17 May 1998 23:12:23 GMT
From: txema@thepentagon.com
Subject: Re: Como crear un CHAT en WEB???/ How to create a CHAT in WEB??
Message-Id: <355f1dcf.1698390@news.mundivia.es>
El Sat, 16 May 1998 15:47:42 +0200, "alehoop!!" <chat@web.com>
escribio:
>
>alehoop!! escribis en mensaje ...
>>Hola quiero poner un CHAT en mi pagina WEB, tengo el csdigo que envmo
>>adjunto, no se como ponerlo en funcionamiento, agradecerma que me ayudaseis
>>si alguien sabe como funciona.
>>Si conociis otro csdigo u otro programa para conseguir realizar un CHAT
>>ruego me indiquiis donde conseguirlo y como funciona.
>>Gracias a todos.
?Y por que no usas los que te dan ese tipo de servicios gratis? puedes
ver un ejemplo en mi web.
Txema / txema@thepentagon.com
http://www.thepentagon.com/txema (personal web)
http://txema.home.ml.org (mirror)
------------------------------
Date: Sun, 17 May 1998 20:05:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Adam Klein <a_klein@ix.netcom.com>
Subject: Re: Does a script run slow if it is 100 to 200K big?
Message-Id: <Pine.GSO.3.96.980517130231.27629I-100000@user2.teleport.com>
On Sat, 16 May 1998, Adam Klein wrote:
> I am making an advanced CGI script. I was just wondering wheather or
> not the script runs slow if it is about 100 to 200K big?
However you define "runs slow", you can time your script and find out.
> Is there an alternative to this?
There's always an alternative! You could decide to quit programming and
try needlepoint instead. :-) But maybe you want to see the FAQ's
discussion on making your program run faster.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 17 May 1998 16:31:57 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <355F493D.49D42A8B@order.booktraders.com>
Abigail wrote:
>
> Ah, yeah, Linux. The classical answer to Windows. I'm sorry, Linux is a
> nice OS, but many things that are available for NT or commercial Unices
> aren't available for Linux. There's no Sybase for Linux, or Oracle,
> or X-runner, or a lot of other (commercial) packages.
Could it be that they will be there soon ? MySQL ? KDE ?
This is a real question, I am unable to judge.
Birgitt Funk
------------------------------
Date: Sun, 17 May 1998 17:05:54 -0400
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <355F5132.F6975B60@order.booktraders.com>
fsg@ultranet.com wrote:
>
> [courtesy cc of this posting sent to cited author via email]
>
> Tom writes:
> > In comp.lang.perl.misc, fsg@ultranet.com writes:
> > :This isn't one of those things where you want everyone else's stuff
> > :to be free, but you want to make money off teaching, is it? That
> > :would be kinda sad.
> >
> > What a despicable, mendacious, intentionally hurtful statement, Felix.
> > That was your goal, and you've succeeded. You've lied, and I'm hurt.
>
> Hold on a moment there, buddy. You said that a solution the company
> I work for was "fleeceware, just like everything else in that world."
> I asked you if you intended that we not make any money, and you accuse
> me of _lying_? I didn't even assert anything. If you're fantasizing
> that I suspect that you're trying to finesse Perl so that you make a living
> off teaching, then you have an overactive, suspicious and erroneous
> imagination.
>
> > Your allegation that I write free online perl documentation and answer
> > people's questions gratis for conspiratorious surreptitious reasons of
> > avarice say far more about what makes you tick, sir, than it does me.
>
> You're being bizarrely paranoid. I alleged nothing, and especially not
> this wild paragraph. I don't believe it, either; so normally I'd apologize
> for the misunderstanding. But since your imaginative rantings defy reason,
> I'm fairly sure it wouldn't do any good.
>
> > I tell people to access the free online stuff to learn Perl, just like
> > most of us did. If that's not good enough, then I let them make their
> > own choices. I wouldn't dream of telling someone to pay me for squat.
> > You're projecting.
>
>
> > I work very hard to make knowledge free. I intentionally edit manpages
> > before copying them into the books, because going the other way would
> > be unethical, and you wouldn't get the information for free. Tell me,
> > what have *you* done to help the free Perl community, Felix?
>
> Your ego seems pretty stung. You okay in there good buddy?
>
> > It's scumbag, left-handed insults like yours that recall to me what a
> > shitty world we live in. Thanks for the reminder. Good bye and good
> > riddance.
>
> Maybe I was mistaken in thinking that all this hideous flaming of the
> newbies is a calculated if ill-fated move designed to produce results.
> Perhaps, instead, it's a manifestation of a _serious_ temper problem.
>
> Just so everyone _else_ is totally clear, I was not questioning Tom's
> motives; I was asking him if, since my company apparently produces
> "fleeceware", he disbelieves in the model of selling goods for money and
> would instead prefer that everything be services (a common enough theory
> that in my opinion happens to be laughable). I explicitly deny believing
> that Tom is "answering people's questions gratis for conspiratorious
> [sic] surreptitious reasons of avarice" [sic].
>
> Tom's a great guy who it was at least once fun to have a beer with,
> though now I must recommend that if you do, you steer the conversation
> well away from scripting languages or his involvement in teaching.
> Maybe ask him about Magic?
Blessed is the documentation of Perl and CPAN. - Silent studies -.
Amen.
Birgitt Funk
------------------------------
Date: Sun, 17 May 1998 22:54:57 GMT
From: patrick.mannion@us.socgen.com
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jnps0$tdk$1@nnrp1.dejanews.com>
Tom - I am a newcomer to Perl, and was originally attracted to the language
due to the apparent rapid development style and flexibility. When I began to
look into the language, I was at first put off by the unix-centric appearance
of the documentation, existing books, etc. as I had very little unix exposure
previously, and was not expecting any in the near future. Soon I discovered
the hip/ActiveState/GS ports, and felt at home in an environment I was
familiar with; my trade is NT network architecture and administration, as
such, I was very much at home with the NT ports. (Many newcomers to Perl are
in the same boat, I would expect; NT is growing at an alarming pace.) I found
Perl to be a quick study, although I did get stuck at many times. I often
found the answers I sought on usenet, on listserv archives, etc. Sometimes,
though, I did have to "fight" my own product; I had to experiment, blow up my
scripts, muddle through the modules and documentation, and figure out why it
worked when it finally did. Recently, I realized I had begun to understand
the O'Reilly books; I find myself turning to them more and more when I have a
question. However, they were entirely cryptic to me until I had a handle on
"how things work" or "why they work"; usenet, listservs, and TPJ allowed me
to get a grasp on the basics before the Gecko or Llama did. (That's telling
you something, isn't it? "Learning Perl" and "Learning Perl on Win32 Systems"
are too advanced for a beginner...) Long story short, I understand your
complaints of newcomers looking for handouts; however, don't assume that all
beginners are ignoring the manuals or looking to be spoon-fed. Many of us are
just trying to grasp concepts that we have no reference for.
In article <355C22D8.A6884302@fccjmail.fccj.org>,
bill@astro.fccj.cc.fl.us wrote:
>
> Tom Christiansen wrote:
> > any man can. You don't see Larry here. You don't see Dennis in the
> > C groups. And you don't wonder why, now do you?
<snip>
> apperciate the efforts of Larry, Tom (both), Randal, and the rest
> of whom has spent many hours answering what amounts to the same
> things over and over.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 17 May 1998 23:00:49 GMT
From: "JD Lampard" <jlampard@quakerstate.com>
Subject: form data
Message-Id: <01bd81e7$d35da4c0$12e5ced0@jlampard.quakerstate.com>
i have a web page containing a form; when the form is submitted i want the
data to be placed in a text file. i having a bit of difficulty, but i'm on
the way to achieving goal. when the script is called the data is returned
to visitor for confirmation, yet i can't get the data to go to the text
file. CGI has empty output is what the error reads. what i've achieved
thus far was done via cgi-lib.pl. is it a module i'm looking for???
PS feel free to email me direct.
thanx for your help,
JD Lampard
lampard @ ticnet.com
<><><><><><><><><><><><><>
------------------------------
Date: 17 May 1998 23:08:55 GMT
From: "JD Lampard" <jlampard@quakerstate.com>
Subject: Re: form data
Message-Id: <01bd81e8$f4267a00$12e5ced0@jlampard.quakerstate.com>
Thanks Bill--I'm almost there, I think!
JD
lampard @ ticnet.com
Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org> wrote in article
<355E77A6.46AEA1F8@fccjmail.fccj.org>...
> Try this CGI:
>
>
> #!/usr/bin/perl -w
>
> use Fcntl qw(:flock);
> use strict;
> use diagnostics;
>
> my $ctr = 0;
>
> open (IFILE, "cntr.txt") || die("Can't open Counter Data File: $!\n");
> while (<IFILE>) {
> chomp;
> $ctr = $_;
> }
> close(IFILE) || die("Can't close Counter Data File: $!");
>
> open (OFILE, ">cntr.txt") || die("Can't open Counter Data File: $!\n");
> flock(OFILE, LOCK_SH);
> print OFILE ++$ctr;
> close(OFILE) || die("Can't close Counter Data File: $!");
>
> print "Location: /pixel.jpg\n\n";
>
>
> -Sneex- :-)
>
____________________________________________________________________________
> Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
> Florida Community College at Jacksonville | 501 W. State St. | Jax, FL
32202
> mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
>
------------------------------
Date: 17 May 1998 23:09:52 GMT
From: "JD Lampard" <jlampard@quakerstate.com>
Subject: Re: form data
Message-Id: <01bd81e9$15c5f5a0$12e5ced0@jlampard.quakerstate.com>
I'll keep this "snippet" on hand to try in the near future.
Thanks Dan!
JD
lampard @ ticnet.com
--
Jonathan D. Lampard
lampard@ticnet.com (h)
jlampard@quakerstate.com (w)
817.514.1809 (h)
972.868.0400 x1243 (w)
888.966.7954 (pager)
817.581.0644 (h)
<><><><><><><><><><><><><>
Dan Boorstein <danboo@negia.net> wrote in article
<355E8485.6492EE22@negia.net>...
> Bill 'Sneex' Jones wrote:
>
> [SNIP]
>
> > open (IFILE, "cntr.txt") || die("Can't open Counter Data File: $!\n");
> > while (<IFILE>) {
> > chomp;
> > $ctr = $_;
> > }
> > close(IFILE) || die("Can't close Counter Data File: $!");
> >
> > open (OFILE, ">cntr.txt") || die("Can't open Counter Data File: $!\n");
> > flock(OFILE, LOCK_SH);
> > print OFILE ++$ctr;
> > close(OFILE) || die("Can't close Counter Data File: $!");
> >
> > print "Location: /pixel.jpg\n\n";
>
> if you want to read data from a file, modify it and then write it back
> to that very same file it is best to maintain your flock for the
> duration of these exercises. a typical idiom is something like:
>
> open (FILE, "+<myfile.txt") || die $!;
> flock FILE, 2;
> $line = <FILE>;
> seek FILE, 0, 0;
> truncate FILE, 0;
> print FILE &process($line);
> close(FILE);
>
> using your method you might actually miss some counts, or get mis-reads
> and subsequent mis-writes. oh the horror. :-)
>
> and i beleive your "Location" header is in error. a _full_ URI is
> required by RFC 2068.
>
> cheers,
>
> --
> Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
>
> "THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
> - Cosmic AC
>
------------------------------
Date: 17 May 1998 22:20:14 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: I need to determine WHOLE numbers. HELP?
Message-Id: <slrn6luoe8.j31.arch@abts.net>
Original message by: DAXMUX <daxmux@aol.com>
Date: 17 May 1998 18:24:43 GMT
Subject: I need to determine WHOLE numbers. HELP?
> If I have a number...say....1446. And I divide that number by 3 it gives me
> 482.
> If I have the number 1447 and I divide it by 3 it gives me 482.333....
> If I have the number 1448 and I divice it by 3 it gives me 482.666....
>
> What is the fastest, cleanest way to determine: if ($var / 3 = WHOLENUMBER)?
If I'm correct in my idea of what you want, then perhaps something like
this might help you:
unless ($number % 3) {
# do something to $number
}
The '%' in this case is the modulus operator. It first converts the
numbers it's working on to integers and then performs integer division
on them, returning the remainder. So, in the example I gave, the block
where '# do something to $number' is will only be executed if the
condition is false (meaning that there's no remainder).
--
Shaun L. Sides arch@abts.net
Business web site http://www.abts.net/~arch
Showershoe web site http://www.abts.net/~arch/showershoe
Recreational web site http://sara.mmlc.nwu.edu/~arch
------------------------------
Date: 17 May 1998 19:39:42 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: I need to determine WHOLE numbers. HELP?
Message-Id: <lt67j4xy9t.fsf@asfast.com>
daxmux@aol.com (DAXMUX) writes:
> If I have a number...say....1446. And I divide that number by 3 it gives me
> 482.
> If I have the number 1447 and I divide it by 3 it gives me 482.333....
> If I have the number 1448 and I divice it by 3 it gives me 482.666....
>
> What is the fastest, cleanest way to determine: if ($var / 3 = WHOLENUMBER)?
Here is a clean way. Someone else might be willing to venture an
opinion as to whether it's the fastest:
if (($number % 3) == 0) {
print "$number is evenly divisible by 3\n";
}
else {
print "$number is not evenly divisible by 3\n";
}
The `%' operator is called the "mod" (or "modulo", or sometimes even
"modulus") operator. It returns the remainder when its first argument
is divided by its second argument. When this remainder is zero,
the first argument is evenly divisible by the second.
> [ ... ]
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: 17 May 1998 18:00:17 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <6jnmlh$85b$1@monet.op.net>
Keywords: Conant generous resurgent senile
In article <comdog-ya02408000R1705981529460001@news.panix.com>,
brian d foy <comdog@computerdog.com> wrote:
>in these instances i add a comment right above the line. no need to
>keep your readers guessing :)
There is a certain class of comments which are inherently failures.
Comments that say
# The following line is not erroneous
are a large part of that class.
Any commenting strategy that requires a multitude of identical
comments in every instance of a certain code construct is a broken
strategy; the correct strategy is to avoid the construct.
You're right that there's no need to keep the reader guessing. But in
the war against confusion, a comment should be the weapon of last
resort. Far better to have code that explains itself. This is
analogous to the rule of user interface design that says that the user
interface should explain itself, and that if the user has to read
instructions, you've failed.
------------------------------
Date: Sun, 17 May 1998 19:24:10 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <comdog-ya02408000R1705981924100001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6jnmlh$85b$1@monet.op.net>, mjd@op.net (Mark-Jason Dominus) posted:
>In article <comdog-ya02408000R1705981529460001@news.panix.com>,
>brian d foy <comdog@computerdog.com> wrote:
>>in these instances i add a comment right above the line. no need to
>>keep your readers guessing :)
>
>There is a certain class of comments which are inherently failures.
>Comments that say
>
> # The following line is not erroneous
>
>are a large part of that class.
>
>Any commenting strategy that requires a multitude of identical
>comments in every instance of a certain code construct is a broken
>strategy; the correct strategy is to avoid the construct.
well, one can write stupid comments if one likes, but an effective
comment would be:
# try to connect to the database and assign the reference in $dbh
# if the connect fails, the if() fails since the method returns
# undef
if( $dbh = Msql->connect() ) { ... }
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers T-shirts! <URL:http://www.pm.org/tshirts.html>
------------------------------
Date: 17 May 1998 23:48:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <6jnt0n$22v$1@mathserv.mps.ohio-state.edu>
Keywords: Conant generous resurgent senile
[A complimentary Cc of this posting was sent to Mark-Jason Dominus
<mjd@op.net>],
who wrote in article <6jnmlh$85b$1@monet.op.net>:
> You're right that there's no need to keep the reader guessing. But in
> the war against confusion, a comment should be the weapon of last
> resort. Far better to have code that explains itself. This is
> analogous to the rule of user interface design that says that the user
> interface should explain itself, and that if the user has to read
> instructions, you've failed.
Yes, this is almost a posting on online books vs man. Only with man you
need to read instructions how to read instructions how to read
instructions.
man man
man grep
grep ...
man perlwhatever
(I suppose that `man man' is working, which is often wrong ;-).
Ilya
------------------------------
Date: Sun, 17 May 1998 18:26:23 -0400
From: Jason Mclaughlin <mcjason@idirect.com>
Subject: Is there a Perl IDE for win32
Message-Id: <355F640D.7C591C19@idirect.com>
hello, I use activeware's version of perl for win32 and I was wondering
if there is an IDE interface I can get for it, Any help would be
appretiated
--
What is Windows 95?
Windows 95 is a 32-bit extension for a 16-bit patch for a 8-bit
operating system which was originally coded for a 4-Bit microprocessor
by a 2-bit company that can't stand 1-bit of competition. :)
Jason Mclaughlin <mcjason@idirect.com>
http://webhome.idirect.com/~mcjason
------------------------------
Date: 17 May 1998 22:48:58 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Nuclear bombing of NEW YORK! Small countries can target with nukes!
Message-Id: <6jnpgq$bjq$1@comdyn.comdyn.com.au>
In article <3558CD29.12CB@yahoo.com>,
gdw <gdw@yahoo.com> writes:
> "INDIA had developed GLOBAL Destruction weapon". What it means that -
> "Planet EARTH is NOT ONLY a HUGE bar magnet BUT also is a HUGE ATOM
> BOMB!!"
Wow... And we could have known all this time. The spread of FRIDGE
MAGNETS should have shown us what was going on. After all!!! All
FRIDGES are made of ATOMS!!!!
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd. | cynical. It's perfectly easy to be
NSW, Australia | cynical.
------------------------------
Date: Sun, 17 May 1998 19:59:08 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Bill Ferraro <skc1234@hotmail.com>
Subject: Re: Perl Error Documentation
Message-Id: <Pine.GSO.3.96.980517125812.27629H-100000@user2.teleport.com>
On Fri, 15 May 1998, Bill Ferraro wrote:
> Is there anything on the Web which gives more informative explanations
> of the most common Perl errors (i.e. something better than perldiag),
> and the quick way to fix them?
In what way would you like perldiag to be improved? Patches welcome!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 18 May 1998 09:49:56 -0500
From: Kira Kira <kira98_98@yahoo.com>
Subject: POP up window
Message-Id: <356058A4.66AC@yahoo.com>
I have a HTML form, and when the user click on the OK button, i want
to display a pop up window. But i do not want to disturb the current
HTML form.
------------------------------
Date: Sun, 17 May 1998 18:27:42 -0400
From: Jason Mclaughlin <mcjason@idirect.com>
Subject: Quick Question about Perl TCP/IP
Message-Id: <355F645C.6A1ADC58@idirect.com>
I was wondering if anyone knew how I could write a small Perl script to
listen on a TCP port and when Someone connects send some text to them
then disconnect, Kinna like a small server, Thanks
--
What is Windows 95?
Windows 95 is a 32-bit extension for a 16-bit patch for a 8-bit
operating system which was originally coded for a 4-Bit microprocessor
by a 2-bit company that can't stand 1-bit of competition. :)
Jason Mclaughlin <mcjason@idirect.com>
http://webhome.idirect.com/~mcjason
------------------------------
Date: 17 May 1998 22:34:09 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Quick Question about Perl TCP/IP
Message-Id: <6jnol1$3rv@news-central.tiac.net>
In article <355F645C.6A1ADC58@idirect.com>,
Jason Mclaughlin <mcjason@idirect.com> wrote:
>I was wondering if anyone knew how I could write a small Perl script to
>listen on a TCP port and when Someone connects send some text to them
>then disconnect, Kinna like a small server, Thanks
If you have a recent perl distribution then there should be a man page (at
least a page you can view with perldoc) for perlipc
perldoc perlipc
should produce it, and it has a sample client & server script in it:
And here's a corresponding server to go along with it.
We'll leave the address as INADDR_ANY so that the kernel
can choose the appropriate interface on multihomed hosts.
If you want sit on a particular interface (like the
external side of a gateway or firewall machine), you
should fill this in with your real address instead.
#!/usr/bin/perl -Tw
require 5.002;
use strict;
BEGIN { $ENV{PATH} = '/usr/ucb:/bin' }
use Socket;
use Carp;
[...]
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Sun, 17 May 1998 20:14:03 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Chris Croome <chris@atomism.demon.co.uk>
Subject: Re: simple help with one-liner needed (newbie question)
Message-Id: <Pine.GSO.3.96.980517130952.27629K-100000@user2.teleport.com>
On Sun, 17 May 1998, Chris Croome wrote:
> Subject: simple help with one-liner needed (newbie question)
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
> I want to take a name from a database and translate it into
> initials:-
>
> Chris Croome -> CC
>
> However it also needs to work with names made up of three or
> four names.
There's a little room for interpretation and improvement here, but this is
what I'd probably use:
sub initials { join '', $_[0] =~ /\b(\w)/g }
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sun, 17 May 1998 16:25:31 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: simple help with one-liner needed (newbie question)
Message-Id: <355F47BB.4F536A4@negia.net>
Chris Croome wrote:
>
> Hi
>
> I want to take a name from a database and translate it into
> initials:-
>
> Chris Croome -> CC
>
> However it also needs to work with names made up of three or
> four names.
>
> This is what I have so far, it works but is not too elegant:
>
> $_ ="chris david ernie fred grace";
[SNIP]
well, first off the task of determining someone's proper initials is
a bit more complex than it might seem at first. so what i am offering
is simply a way of pulling out character's out of a string which
are word characters preceded by word boundaries.
the first sets no limit on the number of charcters in the initials.
print join '', /\b(\w)/g;
the second regex, does the same work as the one above, but only the
first 4 matches are returned, by slicing. the grep is in case there
are less than four initials. it keeps the warnings quiet.
print join '', grep defined, (/\b(\w)/g)[0..3];
i'd highly recommend a read of some perl regex documentation. it
will dramatically help your programming efficiency.
cheers,
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: 17 May 1998 22:55:38 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: simple help with one-liner needed (newbie question)
Message-Id: <slrn6luqgl.j31.arch@abts.net>
Original message by: Chris Croome <chris@atomism.demon.co.uk>
Date: Sun, 17 May 1998 19:38:22 GMT
Subject: simple help with one-liner needed (newbie question)
> Hi
>
> I want to take a name from a database and translate it into
> initials:-
>
> Chris Croome -> CC
>
> However it also needs to work with names made up of three or
> four names.
>
> This is what I have so far, it works but is not too elegant:
>
> $_ ="chris david ernie fred grace";
>
> $first = /(\w)/;
> if ($first == "1") {
> $first = $1;
> }
> $second = /\w\w+\W(\w)/;
> if ($second == "1") {
> $second = $1;
> }
> $third = /\w\w+\W\w\w+\W(\w)/;
> if ($third == "1") {
> $third = $1;
> }
> $fourth = /\w\w+\W\w\w+\W\w\w+\W(\w)/;
> if ($fourth == "1") {
> $fourth = $1;
> }
> $initials = join("",$first,$second,$third,$fourth);
> print $initials;
Ummmm... Lessee, here.
#!/usr/bin/perl -w
$_ ="chris david ernie fred grace";
@names = split;
$inits = '';
foreach $name (@names) {
$name =~ /^(.)/;
$letter = $1;
$inits .= $letter;
}
print uc($inits), "\n";
That ought to be the ticket. I won't promise that it's the prettiest
piece of code you ever saw, but it does word here on my system. ;-)
--
Shaun L. Sides arch@abts.net
Business web site http://www.abts.net/~arch
Showershoe web site http://www.abts.net/~arch/showershoe
Recreational web site http://sara.mmlc.nwu.edu/~arch
------------------------------
Date: Sun, 17 May 1998 20:09:41 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Budash <mbudash@sonic.net>
Subject: Re: Startup overhead
Message-Id: <Pine.GSO.3.96.980517130817.27629J-100000@user2.teleport.com>
On Sun, 17 May 1998, Michael Budash wrote:
> are there any reasons you know of to *not* install
> mod_perl?
1. You like to make things difficult.
I can't think of any other reasons. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 17 May 1998 14:03:09 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Tip: Filehandles
Message-Id: <r8zpghjz3u.fsf@asc.sps.mot.com>
Jonathan Feinberg <jdf@pobox.com> writes:
> Tom Christiansen <tchrist@mox.perl.com> writes:
>
> > But there are big problems there in both cases. Passing \*STDOUT is
> > much better, as is passing \&something is much better.
> >
> > &callme(\&SOMETHING);
> > &something(\*STDOUT);
> >
> > I don't understand what the big fear here is.
>
> Here's one possible interpretation: It's perfectly reasonable to send
> a reference to an apple when you want an apple to arrive; but it's
> weird to send a reference to a whole fruitbasket when you want an
> orange to arrive.
Exactly. It's even wierder where it is hard to even understand what a
fruitbasket is and what side effects it has. (Not to mention worries
that you know about, like: "how do you ensure that the identifier FH
that you just opened has not been opened already by some other
module?")
And this is only part of the point. The other part is _WHY_ would you
choose the fruitbasket approach when the other one looks so clean &
good?
Every reference to the FileHandle vs typeglob approach in any
documentation that I can find implies that FileHandle is the way to
go.
Advanced Perl Programming (an excellent book, which I have only just
now read, and has the first good documentation I've found on
typeglobs - ironic, since it's supposed to be "advanced") says:
Developers are now encouraged to use these facilites [FileHandle]
instead of the techniques described next [typeglobs]. But you still
need to wade through [typeglobs] because there is a large amount of
freeware code that uses them.
Tom's recent article is the first place that I have seen that suggests
that there is a 10x performance penalty for using FileHandle. This
amazes me (and my question about details on this remains unanswered).
This is _IO_ we are talking about. How is it that the overheads of
the calling method can be so bad as to outweigh the underlying
slowness of the IO operation?
Thanks for any insights!
Martin.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2623
**************************************