[11411] in Perl-Users-Digest
Perl-Users Digest, Issue: 5011 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 1 11:07:25 1999
Date: Mon, 1 Mar 99 08:00:50 -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 Mon, 1 Mar 1999 Volume: 8 Number: 5011
Today's topics:
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <andrewf@beausys.demon.co.uk>
Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Pos <uri@home.sysarch.com>
Re: Array Initialization and directory list searching (Bart Lateur)
Re: Array question. (Bart Lateur)
Re: Can I do this w/ Perl? (Ken )
Re: Can I do this w/ Perl? (Bart Lateur)
Re: Can I do this w/ Perl? dragnovich@my-dejanews.com
Re: Coding Question <kenhirsch@myself.com>
Databases & Perl <todd@car.net>
Re: Databases & Perl <ringo6@worldnet.att.net>
date and name parsing with human-variable formatting? (William Herrera)
Re: date and name parsing with human-variable formattin (Bill Moseley)
Re: does perl discourage obfuscated code? (was Re: Perl (Randal L. Schwartz)
Re: does perl discourage obfuscated code? (was Re: Perl <cederstrom@removethis.kolumbus.fi>
Re: does perl discourage obfuscated code? (was Re: Perl (Greg Bacon)
Re: Email from Perl on Windows 95 dragnovich@my-dejanews.com
FAQ 7.16: What's the difference between dynamic and lex <perlfaq-suggestions@perl.com>
FAQ 7.9: How do I create a module? <perlfaq-suggestions@perl.com>
Re: file confirmation (Clay Irving)
Re: GD.pm error (MS VC 6) - Has anyone solved this? (Randy Kobes)
Re: grep syntax question (KLMN2)
HELP on socket <langels@online.no>
Help! Who can teach me :( <au_aaron@hongkong.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 1 Mar 1999 13:20:29 +0000
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <8fOACHAdQp22EwGW@beausys.demon.co.uk>
In article <36da61ec.3282080@news.dircon.co.uk>, Jonathan Stowe
<gellyfish@btinternet.com> writes
>On 28 Feb 1999 13:21:04 -0500, Uri Guttman <uri@home.sysarch.com>
>wrote:
>
>>>>>>> "AF" == Andrew Fry <andrewf@beausys.demon.co.uk> writes:
>>
>> AF> This can be condensed as follows...
>> AF> "This newsgroup is reserved for use by us Perl experts to discuss
>> AF> *INTERESTING* Perl issues. Dont waste our time by posting uninteresting
>> AF> questions. If you really *MUST* post a question to which you need a
>> AF> quick reply, make sure that you that you first read the FAQ, man pages,
>> AF> articles on the WWW and main Perl books in their entirety, and then
>> AF> sign an affidavit to confirm they you have read all these."
>>
>>usenet is was never meant for QUICK replies. if you expect that, you get
>>what you deserve.
>>
>
>Yeah but Uri he obviously thinks it is:
>
><http://www.dejanews.com/[ST_rn=ap]/dnquery.xp?search=thread&recnum=%3c882R7JAzi
>Lq2EwFK@beausys.demon.co.uk%3e%231/1&svcclass=dnserver>
>
>It appears that Andrew would rather discuss meta-issues than Perl
>anyhow by the looks of things.
Not so. It is just that to suggest that newbies should read...
* the FAQs
* the man pages
* on-line articles at the main Perl sites
* the main Perl books
...before posting a question is both patronising and unhelpful
(when done too frequently).
As a relative newcomer to this newgroup, there seems to me to be
an attitude that this newsgroup is primarily reserved for used
by the experience Perl users, to discuss "interesting" issues,
and that newbies have no right to post questions UNLESS AND UNTIL
they have read all the suggested readings.
I encounter the RTFM response in this newsgroup much more
often than any other newsgroup I have used.
Many newbies find these comments unhelpful and offputting,
especially when accompanied by sarcastic remarks.
Now, most newbies are reasonably intelligent ... we know
that documentation exists and we understand the importance
of using documentation ... but we dont always know our way
around it, and it may not answer what we want.
For myself, I get completely p----d off by people continually
telling me what I should read. If I want to post a dumb question,
that's my perogative. You dont have to answer it.
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 01 Mar 1999 10:20:10 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: *** FAQ: ANSWERS TO YOUR QUESTIONS! READ FIRST! Posted Twice Weekly ***
Message-Id: <x7iuclfd91.fsf@home.sysarch.com>
>>>>> "AF" == Andrew Fry <andrewf@beausys.demon.co.uk> writes:
AF> In article <x71zjagzjj.fsf@home.sysarch.com>, Uri Guttman
AF> <uri@home.sysarch.com> writes
AF> Where, precisely, does it say that it was never meant for quick
AF> replies ? Or is that just your personal view ? And who are you to
AF> dictate what it is for, and the terms and conditions under which
AF> people might use it ?
how long have you been using usenet? 2 weeks? do you understand than
usenet is NOT a realtime medium? that some people may not get or read your
post for DAYS! if you call that a quick response medium than you have
some major time/space dysfunction.
>> ATTENTION all perl newbies, instead of posting to this group, send you
>> questions by email to andrew fry, he will answer them all, accurately
>> quickly and over and over and over and over and over and over and over
>> and over and ...
AF> Well, there just isnt any point in replying to stupid comments like
AF> this.
no, it isn't stupid, it is sarcastic. it is designed to blow holes in
your pseudo-logic. you just state above that
AF> And who are you to dictate what it is for, and the terms and
AF> conditions under which people might use it ?
so we don't want to answer newbies questions all the time. that fits
your choice of anarchy as anyone can do whatever they want, including
answering rtfm. if they want to play they can and we don't set the
rules. but do you ever notice that NO one answers all those newbie
questions? not yourself nor some kind samaritan with all the time in the
world. so your pleadings are faling on deaf and missing ears. hence my
comments about you taking up the mantle to answer them all. again to
educate you on usenet, it is a cooperative medium and you have not
contributed much (if anything) yet other than your wimpy diatribes about
the group attitude. boo hoo!! we are all sorry and will change our ways!
thank you for showing us the light. we wil be kind and waste our time
with each and every newbie out there. we will not maintain the FAQ, nor
post it regularly nor discuss anything but how to strip spaces from
strings.
thank you for your help in removing the scrooge from our backs.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Sun, 28 Feb 1999 12:29:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Array Initialization and directory list searching
Message-Id: <36dd363c.2296359@news.skynet.be>
Abigail wrote:
> grep /xyz$/, readdir CUR_DIR;
>
>would read in content of the directory in a (possible long) list,
>while
>
> while (defined($name = readdir(CUR_DIR)) {
> push @xyz_array, $name if $name =~ /xyz$/;
> }
>
>uses much less overhead.
>
I doubt it. One is a Perl primitive, the other one is several Perl
statements executed many times. Ilya once wrote (something like):
"There's around a 10 times overhead for doing things in plain Perl.".
But, this isn't benchmarked. (Nodge nodge...)
Bart.
------------------------------
Date: Sun, 28 Feb 1999 12:21:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Array question.
Message-Id: <36db3244.1283707@news.skynet.be>
Ala Qumsieh wrote:
>I know that you know the difference, but it's not evident from your
>reply. I thought it should be pointed out to the unwary.
Note that the difference for arrays is not by far, that great as it is
for scalars.
#! perl -w
@ary = qw(1 2 3);
undef @ary;
print defined(@ary)?"defined\n":"not defined\n";
print scalar(@ary)," -> @ary\n";
push @ary,4;
print scalar(@ary)," -> @ary\n";
@ary = qw(1 2 3);
@ary = ();
print defined(@ary)?"defined\n":"not defined\n";
print scalar(@ary)," -> @ary\n";
push @ary,4;
print scalar(@ary)," -> @ary\n";
undef @ary;
@ary = ();
print defined(@ary)?"defined\n":"not defined\n";
print scalar(@ary)," -> @ary\n";
push @ary,4;
print scalar(@ary)," -> @ary\n";
Result:
not defined
0 ->
1 -> 4
defined
0 ->
1 -> 4
not defined
0 ->
1 -> 4
Note: no warnings. The *only* difference is in the value of
defined(@ary). And if assign () to an undefined array, that does NOT
define it!
Conclusion: the difference doesn't matter. Shouldn't matter. Just don't
test for defined(@ary).
Bart.
------------------------------
Date: Sun, 28 Feb 1999 12:12:11 GMT
From: cant_take@thespam.com (Ken )
Subject: Re: Can I do this w/ Perl?
Message-Id: <36d9313a.806159@news.tiac.net>
abigail@fnx.com (Abigail) wrote:
Brad wrote:
>.. >
>.. >Yes, Perl is a good choice. I would advise you to get the structure of
>.. >your programs right on your local system, not online; debugging would be
>.. >soooo much easier. So download Perl, from CPAN (www.cpan.org or
>.. >www.perl.com/CPAN).
>.. >
I asked:
>.. but my local system in WinTel and my ISP is UNIX. Won't that be a
>.. problem?
>
Abigail cryptically replies:
>What's the difference in systems to do with anything?
>
Brad suggests that I test my routines on my system before uploading
them to my ISP. I thought that Perl was written for UNIX systems and
wouldn't run on WinTel. If I do as Brad suggests and download the
WINTel version then those routines won't run on the UNIX box.
Abigail, if you would like to be helpful I'd sure appreciate it. You
remind me a little bit of the guy at my local hardware store. The guy
will only answer questions. He will answer any question, but only the
exact question and nothing more. So you have to keep on asking a
series of questions.
Ken
>
>Abigail
>--
>perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
> "\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
> "\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: Sun, 28 Feb 1999 12:25:58 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Can I do this w/ Perl?
Message-Id: <36dc3505.1985648@news.skynet.be>
Ken wrote:
>but my local system in WinTel and my ISP is UNIX. Won't that be a
>problem?
No. There are some tiny differences between Perl ports (e.g. flock()),
but I do my primary debugging (shaking out the really big oomphs) on
DOS, and one ISP is on BSD, and the other one on Linux.
I have noticed some largish differences between CGI related environment
variables, though.
Bart.
------------------------------
Date: Sat, 27 Feb 1999 17:32:32 GMT
From: dragnovich@my-dejanews.com
To: kloomis@it-resourcesSPAMX.com
Subject: Re: Can I do this w/ Perl?
Message-Id: <7b9a7g$mae$1@nnrp1.dejanews.com>
Yes you can make that in perl.
I Fact I made some perl programs that does things like that, I have made a
"Mexican Soccer Championship" for my clients. I get all the results on a web
form, and the users can check the results on the web.
I separate the progrma in two programs 1) Reads results and 2) Admin Results
Stats then just the people with the right username/password can
add/modift/delete the games results/stats.
In article <7b8ki5$jp5$2@client2.news.psi.net>,
abigail@fnx.com wrote:
> Ken Loomis (kloomis@it-resourcesSPAMX.com) wrote on MMVI September
> MCMXCIII in <URL:news:36d78f01.14244715@news.tiac.net>:
> @@ There are two applications I'd like and I'm wondering if I can do them
> @@ with Perl, and what the degree of difficulty of each would be (low,
> @@ medium, or high).
> @@
> @@ First, I'm the administrator of a soccer league. I need to collect
> @@ scores. Can I set up a web page where the managers can logon and
> @@ enter their own scores.
>
> This is trivial when it comes to Perl. In fact, there's no need to take
> Perl out of its wrapper if you're going to create web pages.
>
> @@ Second, I'd like to have users enter events on a web based calendar.
>
> Also trivial in Perl. Users aren't Perl driven, they run on hamburgers.
> Again, Perl can quietly rest while you educate your users to enter events.
>
> Abigail
> --
> sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
> f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
> f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
>
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 27 Feb 1999 10:30:22 -0500
From: "Ken Hirsch" <kenhirsch@myself.com>
Subject: Re: Coding Question
Message-Id: <7b93t0$mfc$1@oak.prod.itd.earthlink.net>
Mike D. wrote:
>I have a mySQL table with 43,000 rows. The columsn are zip, latitude,
>and longitude. Basically the table relates the zip to its latitude and
>longitude (in radians).
>
>I am using the following equation to find the distance between to zips
>based on the lat and long.
>
>$x = sin($lat1) * sin($lat2) + cos($lat1) * cos($lat2) * cos($lon1 -
>$lon2);
>
>$rad_dist = atan2(-$x, sqrt(-$x * $x + 1)) + 2 * atan2(1,1);
>$disance_in_miles = $rad_dist * 3958.754;
>
>Which works fine. But now I would like to query my table. Basically,
>I would like to ask the database "Give me all the zip codes within 10
>miles of this zip code."
>
>The solution I currently have is to construct a mySQL statment like
>
>SELECT zipcode FROM mytable WHERE( ($radius_in_miles <= $RADIUS) )
>
>Where $radius_in_miles is basically the SQL form of the equation
>above.
>
>This code makes the database engine search all 43,000 records.
>
>I am wondering if anyone knows how (or if it is possible) to change
>the above equation so I can provide a $disance_in_miles and
>$starting_lat and $starting_long - and have the equation return a
>maximum lat and long. Then I can simply query the database for lats
>and longs within a range.
None of this is Perl-specific, of course, but I did program this in Perl
last year--unfortunately I don't have the code now.
One way to speed this up a little is to simplify the math in the loop. It's
faster if you store the X, Y, and Z coordinates instead of the latitude and
longitude and then calculate the chord distance using SQRT((X1-X2)^2 +
(Y1-Y2)^2 + (Y1-Y2)^2). The chord distance is shorter than the arc distance
but the difference is small for the distances you're using. Better yet,
leave off the square root, and search for zips where the squared distance is
less than RADIUS^2.
Still, that is only going to speed up things a little. What you need to do
is reduce the number of comparisons. What I did was compute a bounding box
for each two-digit zip prefix and then compute the minimum distance between
all pairs of these boxes. Then I stored all 4950 of these pairs in a table.
Thus, when you get a zip code to look up, you check its first two digits
against the 99 other two-digit prefixes and find which zip codes to check.
There will be a relatively small number to check.
I hope that helps,
Ken Hirsch
Carrboro, NC
------------------------------
Date: Sat, 27 Feb 1999 10:59:20 -0500
From: "Todd L. Poole" <todd@car.net>
Subject: Databases & Perl
Message-Id: <cKUB2.666$bk.1224027@storm.twcol.com>
Hello,
I am pretty new to perl script. I have an application that requires updates
to an access database. We are running NT server and IIS4.0
Does anyone know if this is possible? Any help is appreciated!
-Todd
------------------------------
Date: 27 Feb 1999 17:29:02 GMT
From: "Michael Taylor" <ringo6@worldnet.att.net>
Subject: Re: Databases & Perl
Message-Id: <7b9a0u$f4a@bgtnsc02.worldnet.att.net>
Try looking here to start with.
http://reference.perl.com/query.cgi?section=database
Good luck.
Todd L. Poole wrote in message ...
>Hello,
>
>I am pretty new to perl script. I have an application that requires updates
>to an access database. We are running NT server and IIS4.0
>
>Does anyone know if this is possible? Any help is appreciated!
>
>-Todd
>
>
------------------------------
Date: 27 Feb 1999 15:54:17 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: date and name parsing with human-variable formatting?
Message-Id: <dM33c2i67iQd-pn2-WhBUOmPLHDcN@cheetah>
hello all,
I have a perl script that must check a very large number of text files
which have been written by various people in various ways. In general,
these always contain an name and date field (many are letters, etc).
At the moment, the perl program scans for the first valid date and the
first likely name and saves these for archiving/reporting.
The problem I have is that these files are easily parsed by a human,
but vary greatly in how the date and name are formatted in the text.
ie for date:
02/27/99
2-27-99
February 27, 1999
Saturday, Feb 27, 1999
27 Feb 99
For name:
Smith, John
Smith, J. Bradley
John Q. Public, MD
John "Bubba" Smith III
Ervin-Smith, John Adams Jr.
etc, etc.
The script I have currently works almost all the time, but I have the
nagging suspicion (hope) that this has already been done somewhere
else in the way that might catch any future variants I currently would
miss.
Does anyone know of anything like that?
---
Note: The above address is spamblocked.
The real reply-to is: wherrera (at) lynxview.com
------------------------------
Date: Sat, 27 Feb 1999 10:54:44 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: date and name parsing with human-variable formatting?
Message-Id: <MPG.1141df4a5ea5e8029896c3@206.184.139.132>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
For dates, tke a look at Date::Manip, which is a huge module, but will
parse dates (you can even say things like '2nd Friday in June').
In article <dM33c2i67iQd-pn2-WhBUOmPLHDcN@cheetah>,
posting.account@lynxview.com says...
> hello all,
>
> ie for date:
>
> 02/27/99
> 2-27-99
> February 27, 1999
> Saturday, Feb 27, 1999
> 27 Feb 99
>
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: 01 Mar 1999 07:04:01 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <m1pv6tqmji.fsf@halfdome.holdit.com>
>>>>> "Russell" == Russell Schulz <Russell_Schulz@locutus.ofB.ORG> writes:
Russell> I believe it. Perl encourages hard-to-read code. that's
Russell> just the way it is, and if you don't apply a strong
Russell> discipline when writing Perl, you're going to be the proud
Russell> owner of a ton of read-only code.
I completely disagree here. Perl does nothing to encourage this. The
only thing that *does* is TPJ's Obfuscated Perl contest.
I may have become partially famous for my obscure one-liners here on
Usenet, but when I write production code for hire, it's compact but
readable and well-documented. (Most of it looks similar to my book
and columns.)
Russell> I would guess only APL has ever had a higher reliance on
Russell> symbols and gave a stronger nod towards compactness.
Are you automatically associating "compact" and "symbols" with
"unreadable"? Maybe you need a new definition. :) If you knew only
Hawaiian, and then had to learn English, you'd probably scream at
having to learn *26* letters now. I think you'll need a more
agreeable definition of "obfuscated" before we can argue this further.
My definition of "obfuscated" is "code that even when someone *knows*
the language appears to do one thing and actually does another".
Russell> have you ever seen someone propose an `obfuscated
Russell> Smalltalk' contest?
Smalltalk is completely opaque to someone that doesn't grok true
OO-rientation. And it'd be trivial to write code in Smalltalk that
looks like it does one thing and actually does somethign else. And
Smalltalk is fun enough to program in itself that we don't need
programming contests to encourage fun. :)
Defending Smalltalk in a Perl newsgroup. That's odd. Of course, I've
talked about Perl on Smalltalk (squeak) mailing lists, so it's only
fair.
But in summary, let us please stop passing around the myth that Perl
*is* write-only code, or *encourages* write-only code. I've found
neither of those to be true in my commercial experience, and you are
merely damaging the Perl community by passing along such lies. In
most of the code I've been asked to maintain from others (even
beginners), the question was never "what are they doing here" but "why
are they doing this", which would have been true no matter what the
language.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sun, 28 Feb 1999 19:19:28 +0200
From: "Juho Cederstrvm" <cederstrom@removethis.kolumbus.fi>
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <7bedde$6q2$3@news.kolumbus.fi>
>way it is, and if you don't apply a strong discipline when writing
>Perl, you're going to be the proud owner of a ton of read-only code.
Wow ! If you're right, I can get readable code without applying discipline
when writing ! But if I apply discipline, I'll get unreadable code.
Or is there a typo ? I think it should be a ton of write-only code.
--
# this is a perl script which will display my email address
$_="acbecddeerfsgthriojmkaltmknoolpuqmrbsutsudvowtxfyi";
s/(.)(.)/$2/eg;s/at/@/;s/dot/./;print $_;
------------------------------
Date: 1 Mar 1999 15:37:48 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: does perl discourage obfuscated code? (was Re: Perl evangelism)
Message-Id: <7bec8c$pl$1@info.uah.edu>
In article <slrn7djd7p.o33.fl_aggie@enso.coaps.fsu.edu>,
fl_aggie@thepentagon.com (I R A Aggie) writes:
: In my perl coding, I have backlashed away from
: such limitations, typically using longish, meaningful names. At least
: until I do something like:
:
: $length_of_first_name=length($first_name);
:
: Ok, that's a bit much... :)
See <URL:http://www.lysator.liu.se/c/pikestyle.html>
Greg
--
The earth has become small, and on it hops the last man, who makes
everything small. His species is ineradicable as the flea; the last
man lives longest.
-- Nietzsche
------------------------------
Date: Sat, 27 Feb 1999 17:21:23 GMT
From: dragnovich@my-dejanews.com
To: mariita@my-dejanews.com
Subject: Re: Email from Perl on Windows 95
Message-Id: <7b99ic$lra$1@nnrp1.dejanews.com>
use this routine! (is a copy from per FAQ 4):
use Net::SMTP;
$smtp = Net::SMTP->new('here.com'); # connect to an SMTP server
$smtp->mail( 'user@here.com' ); # use the sender's address here
$smtp->to('user@there.com'); # recipient's address
$smtp->data(); # Start the mail
# Send the header.
#
$smtp->datasend("To: user@there.com\n");
$smtp->datasend("From: user@here.com\n");
$smtp->datasend("\n");
# Send the body.
#
$smtp->datasend("Hello, World!\n");
$smtp->dataend(); # Finish sending the mail
$smtp->quit; # Close the SMTP connection
In article <7b6msl$i5g$1@nnrp1.dejanews.com>,
mariita@my-dejanews.com wrote:
> I am trying to configure junkmail.pl, which I found in the CPAN Archive, to
> work on a Windows 95 platform. Does anybody know the best way to go about
> this? Would it be better to use the Net::SMTP module?
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
------------------------
Juan Carlos Lopez
QDesigns President & CEO
http://www.qdesigns.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 28 Feb 1999 04:02:50 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 7.16: What's the difference between dynamic and lexical (static) scoping? Between local() and my()?
Message-Id: <36d9225a@csnews>
(This excerpt from perlfaq7 - Perl Language Issues
($Revision: 1.24 $, $Date: 1999/01/08 05:32:11 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq7.html
if your negligent system adminstrator has been remiss in his duties.)
What's the difference between dynamic and lexical (static) scoping? Between local() and my()?
`local($x)' saves away the old value of the global variable `$x', and
assigns a new value for the duration of the subroutine, *which is
visible in other functions called from that subroutine*. This is done at
run-time, so is called dynamic scoping. local() always affects global
variables, also called package variables or dynamic variables.
`my($x)' creates a new variable that is only visible in the current
subroutine. This is done at compile-time, so is called lexical or static
scoping. my() always affects private variables, also called lexical
variables or (improperly) static(ly scoped) variables.
For instance:
sub visible {
print "var has value $var\n";
}
sub dynamic {
local $var = 'local'; # new temporary value for the still-global
visible(); # variable called $var
}
sub lexical {
my $var = 'private'; # new private variable, $var
visible(); # (invisible outside of sub scope)
}
$var = 'global';
visible(); # prints global
dynamic(); # prints local
lexical(); # prints global
Notice how at no point does the value "private" get printed. That's
because $var only has that value within the block of the lexical()
function, and it is hidden from called subroutine.
In summary, local() doesn't make what you think of as private, local
variables. It gives a global variable a temporary value. my() is what
you're looking for if you want private variables.
See the section on "Private Variables via my()" in the perlsub manpage
and the section on "Temporary Values via local()" in the perlsub manpage
for excruciating details.
--
Perl itself is usually pretty good about telling you what you shouldn't do. :-)
--Larry Wall in <11091@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 27 Feb 1999 10:32:24 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 7.9: How do I create a module?
Message-Id: <36d82c28@csnews>
(This excerpt from perlfaq7 - Perl Language Issues
($Revision: 1.24 $, $Date: 1999/01/08 05:32:11 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq7.html
if your negligent system adminstrator has been remiss in his duties.)
How do I create a module?
A module is a package that lives in a file of the same name. For
example, the Hello::There module would live in Hello/There.pm. For
details, read the perlmod manpage. You'll also find the Exporter manpage
helpful. If you're writing a C or mixed-language module with both C and
Perl, then you should study the perlxstut manpage.
Here's a convenient template you might wish you use when starting your
own module. Make sure to change the names appropriately.
package Some::Module; # assumes Some/Module.pm
use strict;
BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
## set the version for version checking; uncomment to use
## $VERSION = 1.00;
# if using RCS/CVS, this next line may be preferred,
# but beware two-digit versions.
$VERSION = do{my@r=q$Revision: 1.24 $=~/\d+/g;sprintf '%d.'.'%02d'x$#r,@r};
@ISA = qw(Exporter);
@EXPORT = qw(&func1 &func2 &func3);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw($Var1 %Hashit);
}
use vars @EXPORT_OK;
# non-exported package globals go here
use vars qw( @more $stuff );
# initialize package globals, first exported ones
$Var1 = '';
%Hashit = ();
# then the others (which are still accessible as $Some::Module::stuff)
$stuff = '';
@more = ();
# all file-scoped lexicals must be created before
# the functions below that use them.
# file-private lexicals go here
my $priv_var = '';
my %secret_hash = ();
# here's a file-private function as a closure,
# callable as &$priv_func; it cannot be prototyped.
my $priv_func = sub {
# stuff goes here.
};
# make all your functions, whether exported or not;
# remember to put something interesting in the {} stubs
sub func1 {} # no prototype
sub func2() {} # proto'd void
sub func3($$) {} # proto'd to 2 scalars
# this one isn't exported, but could be called!
sub func4(\%) {} # proto'd to 1 hash ref
END { } # module clean-up code here (global destructor)
1; # modules must return true
The h2xs program will create stubs for all the important stuff for you:
% h2xs -XA -n My::Module
--
/* dbmrefcnt--; */ /* doesn't work, rats */
--Larry Wall in hash.c from the v4.0 perl source code
------------------------------
Date: 28 Feb 1999 08:04:54 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: file confirmation
Message-Id: <slrn7difnm.iav.clay@panix.com>
On Sun, 28 Feb 1999 13:50:51 +0800, Cplee <cplee@bigfoot.com> wrote:
>Dear Friends
>I try to read a file which located at another http server
>I wish to know how to access it
>also wish to confirm the file exist or not
>Any command can do that please replay asap
Use the LWP Module:
libwww-perl
http://www.linpro.no/lwp
--
Clay Irving <clay@panix.com>
Irony is the hygiene of the mind.
- Elizabeth Bibesco
------------------------------
Date: 1 Mar 1999 00:47:36 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: GD.pm error (MS VC 6) - Has anyone solved this?
Message-Id: <slrn7djpg9.s3b.randy@theory.uwinnipeg.ca>
On Sun, 28 Feb 1999 22:12:50 GMT,
allan@interport.net <allan@interport.net> wrote:
>Recently I downloaded the source to GD.pm, and I attempted to compile
>it under MS VC version 6. Now I have compiled perl no sweat, but this
>fails for nmake.
>
>The error is:
>DEFINE=''; export DEFINE INC; cd libgd && NMAKE all DEFINE=
[snip]
Hi,
I ran across this same problem with VC 6 - I commented out
the
DEFINE='$(DEFINE)'; export DEFINE INC; \
line in Makefile.PL, and all tests passed.
--
Best regards,
Randy Kobes
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theory.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: 28 Feb 1999 11:35:44 GMT
From: klmn2@aol.com (KLMN2)
Subject: Re: grep syntax question
Message-Id: <19990228063544.11949.00002324@ng-cg1.aol.com>
Several people responded, and I have tried several things, but it is still not
working. If I search for the word "book" and in the file being searched it says
"Book" - it will say no results found. But it I search for "Book" it will say
it was found. I have tried things like:
@results = grep(/$searchstr/i,@mydata);
@results = grep(/(?i)$searchstr/,@mydata);
If anyone can help, I would really appreciate it.
Thanks,
Kalman
>KLMN2 <klmn2@aol.com> wrote:
>>Hi -
>>
>>I am using a search script in Perl which uses grep as:
>>
>>@results = grep(/$searchstr/,@mydata);
>>
>>However, whenever I search with this code it is case sensitive.
>>How do I write it so the search is case insensitive?
>>
------------------------------
Date: Mon, 01 Mar 1999 16:58:41 +0100
From: Stian Langeland <langels@online.no>
Subject: HELP on socket
Message-Id: <36DAB931.412DBD68@online.no>
Hello
I have a problem
I would like to communicate between a Visual Basic program on a winX
machine and perl on a linux machine. Is it possible to make a server
script in perl that communicates through Winsock on a linux machine
Thank you, Stian
--
*********************
* Stian Langeland *
* Lxkentoppen 5 *
* 1352 KOLSES *
* hjm 67139447 *
* arb 23097917/18 *
* mob 91106306 *
* langels@online.no *
*********************
------------------------------
Date: Sun, 28 Feb 1999 01:06:03 +0800
From: Aaron Au <au_aaron@hongkong.com>
Subject: Help! Who can teach me :(
Message-Id: <36D825FB.F92B8E20@hongkong.com>
Hi everyone,
Please teach me how to do!
$var1 = "\$a";
$var2 = "b";
$var3 = $var1.$var2;
$var3 = "xyz"; #Actually, I want to assign $ab to "xyz"
print $ab; #Nothing else!
Cheers,
Aaron Au
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5011
**************************************