[11678] in Perl-Users-Digest
Perl-Users Digest, Issue: 5278 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 1 14:04:34 1999
Date: Thu, 1 Apr 99 11:00:19 -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 Thu, 1 Apr 1999 Volume: 8 Number: 5278
Today's topics:
(\w)? behaviour 5.005 vs 5.004 (Bruce R Miller)
Re: CGI help. (Bart Lateur)
Re: Controlling the duration of a process <cassell@mail.cor.epa.gov>
Re: Extracting Lines That Match With grep? global3@my-dejanews.com
Re: Help Please with CGI <cassell@mail.cor.epa.gov>
Here docs, single quotes, and backslashes (Sean McAfee)
Re: How do you round numbers in variables? <cassell@mail.cor.epa.gov>
Re: how to dereference a package variable evrim@my-dejanews.com
How to include a module? <singh_mandeep@jpmorgan.com>
Re: liars vs. non-liars (was Re: does perl discourage o (Bart Lateur)
modified grep (JQ)
Re: modified grep (Larry Rosler)
Re: Newbie questions... <cassell@mail.cor.epa.gov>
Perl and shell commands ??? sriram@eng.ua.edu
Re: PFR gone? dgris@moiraine.dimensional.com
Re: Regex with lookahead help (Bart Lateur)
Re: Regex with lookahead help <cassell@mail.cor.epa.gov>
Re: Resource required <cassell@mail.cor.epa.gov>
Retrieving info after POSTing from a perl script <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Re: Running a perl script as a daemon.... <droby@copyright.com>
Re: Send Mail <cassell@mail.cor.epa.gov>
Re: two questions need help (Bart Lateur)
Re: two questions need help <cassell@mail.cor.epa.gov>
Re: Validating Email addresses <cassell@mail.cor.epa.gov>
Why is this if stmt matching every file? <brannon@quake.usc.edu>
Re: Win32 Newbie please help (Mike Kirkby)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Apr 1999 18:04:03 GMT
From: bruce.miller@nist.gov (Bruce R Miller)
Subject: (\w)? behaviour 5.005 vs 5.004
Message-Id: <7e0cej$l31$1@news.nist.gov>
This snippet looks for a char in a class preceding a particular string:
foreach $_ ("afoo1",
"%foo2",
"foo3") {
/(\w?)(foo\d)/ & print "$_ => $1 & $2\n"; }
and it produces
foo1 => a & foo1
%foo2 => & foo2
foo3 => & foo3
as it should. Moving the ? outside the first parentheses
/(\w?)(foo\d)/ => /(\w)?(foo\d)/
_looks_ equivalent, if not necessarily optimal, but on 5.005_02 (on Irix6.5)
gives the following output
afoo1 => a & foo1
%foo2 => f & foo2
foo3 => f & foo3
!! It works the same as before on 5.004_01.
Consider the case "foo3": Presumably, the (\w)? initially matched
the "f", assigning $1, then it backtracks to match the whole "foo".
But it looks as if the ? is confusing it and it forgets to _unassign_
$1 when it backtracks.
Or is there an alternative explanation?
Or is this a very subtle feature?
--
--
bruce.miller@nist.gov
http://math.nist.gov/~BMiller/
------------------------------
Date: Thu, 01 Apr 1999 17:08:51 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: CGI help.
Message-Id: <3705a786.1103333@news.skynet.be>
mircea@earthlink.net wrote:
>I created a script in CGI and a form in html. The server gave me an "absolut
>path" which is home2/yourdomainname/webdocs and also they gave me a "send
>mail dir" which is usr/sbin/sendmail and they told me that these should be
>placed in my html form. I don't know where exactly I should place them and
>what the tags will be. They should send the form to the cgi script in cgi-bin
>folder.
This doesn't sound right. "home2/yourdomainname/webdocs" sounds like the
absolute path as seen by trhe CGI-script, and "usr/sbin/sendmail" sounds
like the path for sendmail, again, as seen by the CGI script. Therefore,
IMO, none should be used in your form, but only in the script. I could
be wrong, but it looks like you must have misunderstood.
Bart.
------------------------------
Date: Thu, 01 Apr 1999 09:58:15 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Controlling the duration of a process
Message-Id: <3703B3B7.A23E38B2@mail.cor.epa.gov>
Kaiser wrote:
> Hello
>
> I'm writing a script that checks all URL's in a Netscape bookmark
> file. Everything works just fine but I want some extra functionality.
> Most important is that I want the LWP:UserAgent, that I use to check
> the URL's with, to stop working after a defined length of time. Then
> signal a time out and move on to the next URL. How do I do? AFAIK I
> can't make some kind of loop because that would start multiple
> instances of the agent.
>
> Any help or direction would be very appreciated.
Perhaps when you were reading the documentation you just
overlooked this part:
$ua->timeout([$secs])
Get/set the timeout value in seconds. The default timeout() value is 180
seconds, i.e. 3 minutes.
<obi-wan>
Uuuuse the docs, Luke.
</obi-wan>
I know there's a lot of documentation to pore over, but trust me,
it's really a lot faster to look through the docs three or four -
even ten - times than to post here and twiddle your thumbs hoping
someone nice will respond in a timely manner.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 18:24:03 GMT
From: global3@my-dejanews.com
Subject: Re: Extracting Lines That Match With grep?
Message-Id: <7e0djn$ijv$1@nnrp1.dejanews.com>
Dear Jeff,
Thanks for your answer. All I have to do is use:
@hits = grep( m/pattern/i,@hits);
I knew that ! means not but it seems like somehow my mind just went blank
and I didn't think of just removing the ! mark.
Thanks again.
Regards,
Alan
In article <Pine.GSO.3.96.990401112317.15023H-100000@crusoe.crusoe.net>,
evil Japh <jeffp@crusoe.net> wrote:
> > Can someone tell me how to use grep or some other code to extract only
> > those lines that match the pattern between the pattern matching / /
> > lines into an array?
> >
> > I used the code below to extract only those lines that don't match
> > into the @hits array.
> >
> > open(FILE,"list.txt);
> > @lines= <FILE>;
> > close(FILE);
> > @hits = grep(! /pattern/i,@lines);
> > print @hits;
> > exit;
>
> It appears you don't know the use of the ! operator in Perl. It is a
> negation. Let me explain briefly: !0 = 1. !34 = 0. !4 = 0.
>
> Think of it as "not", for that is what it is.
>
> Not false = true
> Not true = false
>
> therefore look at changing grep(! /pattern/i,@files).
>
> --
> Jeff Pinyan (jeffp@crusoe.net)
> www.crusoe.net/~jeffp
>
> Crusoe Communications, Inc.
> 732-728-9800
> www.crusoe.net
>
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 01 Apr 1999 09:49:46 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Help Please with CGI
Message-Id: <3703B1BA.8BF4ACA5@mail.cor.epa.gov>
Solder182 wrote:
> I just need someone preferably to make the altercations in the script cause I
> keep on doing it and messing, up I am on virtualave.net. Please contact me if
> you can help. Thanks
> Digital Explorer
> ICQ-5989580
> AIM-DigitalEx1
> http://members.tripod.com/nzhero/
> "Knowledge Is Power"
Can you show us the code that doesn't work, with the error messages you're
getting? If you can trim the error-prone code down to less than 30 or 40
lines, someone ought to be able to see the problem. But please cut-and-paste.
If you type what you think is the problem, you may (1) introduce typos which
we will think are the problems; and (2) miss entering the part of the code
that is really to blame. And use the tips you got in that e-mail from gnat.
BTW, just an alert. Sometimes the problem is not with the Perl program
at all, but with the cgi or the server setup. So don't be surprised if someone
here tells you so.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 17:55:13 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Here docs, single quotes, and backslashes
Message-Id: <5qOM2.823$9Y5.3970317@news.itd.umich.edu>
---------------------------------------------------------------------------
print <<'EOT';
\\\\
EOT
print '\\\\';
---------------------------------------------------------------------------
This prints:
\\\\
\\
It had been my understanding that a here-doc is quoted in the same way that
the end-of-text line is quoted, but this seems not always to be the case.
The description of here-docs in perldata doesn't make any exceptions.
Bug or feature?
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Thu, 01 Apr 1999 10:15:54 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: How do you round numbers in variables?
Message-Id: <3703B7DA.397AB937@mail.cor.epa.gov>
Brandon Smith wrote:
>
> Ok, this is probably a really stupid question, but I'm wondering what
> methods anyone uses to round numbers. Right now if I want to get a
> number to no more than three places beyond the decimal I'm using a
> regular expression to truncate it as so:
>
> $variable =~ s/((\d)*\.\d\d\d)((\d)*)/$1/;
This will truncate to three decimals, but won't *round* to three
decimals.
> I've also used printf like:
>
> printf("%.3f\n", $variable);
>
> since the printf command actually does rounding, but printf only prints;
>
> it doesn't allow me to store that back in a variable, as far as I know.
> How does anyone else get numbers rounded to a certain number of digits?
<maxwell smart voice>
missed it by *that* much!
</maxwell smart voice>
You were on the right track. Instead of sticking with printf, look up
sprintf which will allow you to save the result to a variable.
BTW, this isn't a dumb question, but it is a FAQ. Someone will probably
toast you slightly for not looking it up in the docs. perldoc and the html
pages (if you have those) are an amazingly swell (and swollen) resource.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 17:29:30 GMT
From: evrim@my-dejanews.com
Subject: Re: how to dereference a package variable
Message-Id: <7e0adf$f8n$1@nnrp1.dejanews.com>
Thanks Jay.
To answer my own question
$pkg="A";
$var_name="i";
$x = ${"${pkg}::$var_name"};
> evrim@my-dejanews.com wrote:
> >
> > Hi. I am using somehitng liek:
> >
> > $z="A";
> > $x=$$z::i;
>
> There's probably a better way to accomplish
> what you want. But, this should work:
>
> $x = eval "\$${z}::i";
>
> Jay Glascoe
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 01 Apr 1999 12:39:11 -0500
From: Mandeep Singh <singh_mandeep@jpmorgan.com>
Subject: How to include a module?
Message-Id: <3703AF3F.64BFB81F@jpmorgan.com>
Hello,
I want to include a module (CGI_Lite.pm) in my script.
The problem is I don't want it to be installed i.e with Perl.
I have the module in my local directory.
How would I include it in my script?
-----------------------------------------------------------
#!/usr/local/bin/perl
require "../perl_lib/CGI_Lite.pm";
push (@INC, "/tmp/perl_lib"); #where CGI_Lite.pm resides
push (@INC, ".");
use CGI_Lite;
print "Content-type: text/plain", "\n\n";
print "This is an upload test";
-----------------------------------------------------------
The error I get is:
Can't locate CGI_Lite.pm in @INC at upload.pl line 5.
BEGIN failed--compilation aborted at upload.pl line 5.
tia,
Mandeep
------------------------------
Date: Thu, 01 Apr 1999 17:16:20 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: liars vs. non-liars (was Re: does perl discourage obfuscated code?...)
Message-Id: <3706a956.1567449@news.skynet.be>
Russell Schulz wrote:
>merlyn@stonehenge.com (Randal L. Schwartz) writes:
>
>> I didn't call you a liar. I said that what you said are lies. That's
>> different (at least to me it is).
>
>I don't see any difference; but then, all I speak is English.
There *is* a difference. Randal said that the things you said were lies.
It could be that you are just repeating things that you heard other
people say, and which you accept as truth. In that case, you act in good
faith, and you're not a liar. But the person who started the rumours
*is* a liar.
Bart.
------------------------------
Date: Thu, 01 Apr 1999 17:53:34 GMT
From: pigs_can_fly@mindless.com (JQ)
Subject: modified grep
Message-Id: <3704ae18.11202848@news.cyberway.com.sg>
Hi
I need to do a "modified" grep.
database (@temp)
-------------------------------------------------------------
ONE two three four
five six seven ONE
nine ONE ten eleven
twelve thirteen ONE fifteen
-------------------------------------------------------------
To grep lines containing ONE from @temp, I'd simply do this:
$word = "ONE";
@temp = grep(/$word/,@temp);
However, now I need to grep ONE *only* if it appears in the first 2
fields.
Is there a simpler way besides using an associative array?
Any help would be appreciated. Thanks.
JQ
------------------------------
Date: Thu, 1 Apr 1999 10:25:13 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: modified grep
Message-Id: <MPG.116d59de14377620989807@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <3704ae18.11202848@news.cyberway.com.sg> on Thu, 01 Apr 1999
17:53:34 GMT, JQ <pigs_can_fly@mindless.com >says...
...
> ONE two three four
> five six seven ONE
> nine ONE ten eleven
> twelve thirteen ONE fifteen
> -------------------------------------------------------------
>
> To grep lines containing ONE from @temp, I'd simply do this:
>
> $word = "ONE";
> @temp = grep(/$word/,@temp);
>
> However, now I need to grep ONE *only* if it appears in the first 2
> fields.
/^(\w+\W+)?$word\b/
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 01 Apr 1999 10:59:21 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Newbie questions...
Message-Id: <3703C209.8A30CCB1@mail.cor.epa.gov>
Scratchie wrote:
> David L. Cassell <cassell@mail.cor.epa.gov> wrote:
>
> : Errm, ASP and Perl are not equivalent. ASP is not *better* [or worse]
> : than Perl. It is in a different functional space. If you're using ASP, you
> : can use PerlScript or VBScript or JavaScript or... Base testing reported
> : in the last week or two on the win32-perl-users listserv suggests that
> : PerlScript may be the way to go. But check out their benchmarks and decide
> : for yourself. YMMV.
>
> Do you have a link for those benchmarks, by any chance?
I don't have a link, but I do know that they were posted in the given listserv.
Maybe you can find them via DejaNews. If not, subscribe to the listserv and
ask for a copy. What I saw was obviously a reprint, so someone was happy to
send them off again that time...
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 18:19:13 GMT
From: sriram@eng.ua.edu
Subject: Perl and shell commands ???
Message-Id: <7e0dam$i6v$1@nnrp1.dejanews.com>
Hi, I am trying to output bold charecters form a perl script using $(tput..)
text $(tput..), as my default shell is ksh. but on excecuting the script, I
see that perl uses bourne sh to print system commands, and this makes my
syntax fails.
I was wondering if there is any way I can make perl to use my default shell
for all system commands.
thanks
sriram
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 01 Apr 1999 11:03:11 -0700
From: dgris@moiraine.dimensional.com
Subject: Re: PFR gone?
Message-Id: <m3n20sw74w.fsf@moiraine.dimensional.com>
[posted and mailed]
David Turley <dturley@pobox.com> writes:
> I just tried to go to the Perl Function Repository at
>
> http://moiraine.dimensional.com/~dgris/perl/pfr/
>
> and got a found no found error. :-)
>
> Is this great site gone?
Yup, I lost the site late last week to a catastrophic disk failure :-(.
Feel free to throw virtual tomatoes at me- I didn't have a backup so
it is well and truly gone.
I'm working on a replacement of sorts (it's sort of a better front
end to CPAN), I'll announce it here when it's ready for testing.
Sorry for any inconvenience.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Thu, 01 Apr 1999 17:04:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Regex with lookahead help
Message-Id: <3704a5b8.643281@news.skynet.be>
Arthur Newhall wrote:
> I am having trouble creating a regex to do this
>"match everything up to the first % that isn't preceded by a \"
>
>I seem to be able to do this with a loop, split,... but I would
>rather use a regular expression.
Whaah! Fun!
Many people attempt using negative lookahead, but here's another
approach (I've changed the requirements a little):
/^(?:[^%\\]|\\.)+/
any character but backslash or percent sign, or a backslah plus
anything, including percent sign or backslash.
#! perl -w
$_ = 'aaa\%bbb%ccc';
if(/^((?:[^%\\]|\\.)+)/) {
print "Matched: $1\n";
} else {
print "No match\n";
}
__END__
Matched: aaa\%bbb
Bart.
------------------------------
Date: Thu, 01 Apr 1999 10:53:17 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Regex with lookahead help
Message-Id: <3703C09D.ADF956@mail.cor.epa.gov>
Sam Holden wrote:
>
> David L. Cassell <cassell@mail.cor.epa.gov> wrote:
> >Arthur Newhall wrote:
> <snip matching up to first non backslashed % stuff>
> >
> >It may be that you're trying a little too hard. You don't
> >need to incorporate negative or positive lookahead. You don't
> >even want to look 'ahead' of the '%'. You just want to check
> >the character you just walked over. So something like this:
> >
> > /^(.*?[^\\])%/
> >
> >should do it. Start at the beginning, swallow everything
> >non-greedily up to the '%', making sure that the previous
> >character does *not* match '\'.
>
> What do you think would happen if % was the first character on the line...
Agreed. And what about the other case I didn't address, where
there is no unslashed '%' ? I skipped both cases, and only
answered what was asked. And I didn't address this either:
> Look behind provides a reasonably readable solution (it gets a little
> harder when you include the posibility for \\ being a single \ but that
> wasn't mentioned anyway.
We can only do so much here. Well, now that I saw Larry Rosler's
post, I realize some of us *can* do more. Ahh, for the days when
Jeff Friedl still posted regex answers here... :-)
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 10:08:14 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Resource required
Message-Id: <3703B60E.365C5573@mail.cor.epa.gov>
Adam Reynolds wrote:
> I am looking for a book review system. ie
>
> www.craze.co.uk/cgi-bin/review.pl?prod0001
>
> Would enable an indivdual to comment on product prod0001, preferably
> with some sort of email/password system to prevent minor misuse.
Based on what I've seen of the book reviews on amazon.com, it is
impossible to prevent minor misuse with an e-mail/password system
without making the whole thing too unwieldy for anyone but a tiny
set of reviewers to use. Go check out amazon.com's reviews for
the 'Family Circus' cartoon books, and you'll see a whole series
of pseudo-intellectual commentaries that were posted there by a
long string of jokers.
> If anybody knows of one out there please could they email me?
> adamr@craze.co.uk
>
> I will also monitor this group.
That's the right approach. Hopefully someone will have a more
useful post than this one.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 13:09:14 -0500
From: Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Subject: Retrieving info after POSTing from a perl script
Message-Id: <3703B64A.49093000@BLAHNOSPAMBLAHxwebdesign.com>
I've been trying to figure out how to POST to a cgi script via perl, but
I can't seem to figure it out... I followed the example in the docs but
it doesn't seem to work for POST (I can get it to work for GET)...
I'd like to post the data the form at this URL is asking for directly to
the CGI and retrieve the course listing that is created:
https://www.bu.edu/link/bin/uiscgi_studentlink?applpath=univschs.pl
If you'd like to test it, try FALL 99, CAS, CS, 113, and A2 for your
values. I can see that the form is being POSTed to
"https://www.bu.edu/link/bin/uiscgi_studentlink", but how do I define
the values for the form, etc?
Thanks!
------------------------------
Date: Thu, 01 Apr 1999 17:30:53 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: Running a perl script as a daemon....
Message-Id: <7e0age$fh1$1@nnrp1.dejanews.com>
In article <MPG.116c1ad22b91b6879897fb@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
>
> (Though why my old friends in Unix-land chose to use a Late Latin
> variant spelling of a common English word escapes me. As an ex-
> physicist, I always found "Maxwell's Demon" completely acceptable
> spelling.)
>
I think it was your older friends in CTSS-land actually. This usage predates
Unix.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 01 Apr 1999 10:42:55 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Send Mail
Message-Id: <3703BE2F.A862AD85@mail.cor.epa.gov>
Greg Griffiths wrote:
> Dear All,
> everytime I try and use the sendmail prog that is listed in the PERL
> faq's :
>
> $mailprog = '/usr/lib/sendmail -oi -t -odq';
> open (MAIL, "|$mailprog") || die "Can't open $mailprog!\n";
> print MAIL "To: $To ($ToEmail)\n";
> print MAIL "Reply-to: CILP Staff Member ($FromEmail)\n";
> print MAIL "Subject: $Subject\n\n";
> print MAIL "$From on behalf of The Christian Internet Links Project
> sends you this Message \n";
> print MAIL "$Message \n";
> print MAIL "Christian Internet Links Project \n";
> print MAIL "http://www.aber.ac.uk/~scty12/links/";
> close (MAIL);
>
> I get the message
>
> Bad Command or File Name
>
> Any idea why, I assume that it is because the command is a Unix command
> and I'm using the Win32 PERL, is there an alternative without using any
> fancy Perl modules as my server won't llow any extras ?
You've got it. If you can't use Mail::Internet, then you'll want to find
out which mail program is on the server, the absolute path to that program,
and the switches needed to run it from an external program (like this one).
See if your server has blat. Then you'll have to go to a newsgroup
covering win32/nt and mail-handling if you get stuck. Or else hit the
listserv win32-perl-users (you can subscribe from the www.activestate.com
webpage).
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 16:56:50 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: two questions need help
Message-Id: <3703a440.267210@news.skynet.be>
Sam Holden wrote:
>>I hope you never figure it out. There is no legitimate reason in the world to
>>send over 5000 e-mails.
>
>I can think of a few off the top of my head.
>
>A mail from say Bill Gates to all his employees ranting about some corporate
>policy.
If Bill Gates doesn't know (or know somebody who knows ;-) how to do
it...
>A mail from AOL to all their subscribers informing them about some scheduled
>outage.
If AOL doesn't know how to figure it out...
>The mailing list for a very large discussion list.
Mailing lists have dedicated programs/scripts. Oops!
>A large university faculty sending enrollment information email to all
>it's students.
If none of the students or personel can figure it out... then it's a
university not worthy of that name!
Too many people know how to spam already. I for one will NOT cooperate
in informing other people how to do it; in particular nontechnical
people; those are the worst! (sausage?)
Bart.
------------------------------
Date: Thu, 01 Apr 1999 10:48:48 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: two questions need help
Message-Id: <3703BF90.A18BFD9E@mail.cor.epa.gov>
Sam Holden wrote:
>
> On Thu, 01 Apr 1999 00:18:31 GMT, Bob Trieger <sowmaster@juicepigs.com> wrote:
> >fanxin@my-dejanews.com wrote:
> >/>Hi all experts: there has two questions: 1. i have downloaded almost all
> >/>mailing list cgi script on the net. all of them are almost same. a loop
> >/>invokes sendmail once by once. the mail is send by openning a pipe from the
> >/>script to sendmail. BUT! this doesn't work when the list is very long.
> >/>eg.5000 the loop will only go about 25-30 times when it needs to go 5000
> >/>times. if the list is reduced to 100. the program works fine. is there
> >/>anything wrong with the system? there has no process at all when the loop
> >/>hasn't finished. so how to write a mailing list cgi program for huge list,
> >/>like 10000 emails.
> >
> >I hope you never figure it out. There is no legitimate reason in the world to
> >send over 5000 e-mails.
>
> I can think of a few off the top of my head.
>
> A mail from say Bill Gates to all his employees ranting about some corporate
> policy.
>
> A mail from AOL to all their subscribers informing them about some scheduled
> outage.
>
> The mailing list for a very large discussion list.
>
> A large university faculty sending enrollment information email to all
> it's students.
I thought of a few too, but I thought of a lot more *improper*
reasons why someone might want this. Why doesn't the -T flag
check for the taint of immoral activities, so we wouldn't have
to worry about this? :-)
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 01 Apr 1999 10:35:04 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Validating Email addresses
Message-Id: <3703BC58.3FD32A76@mail.cor.epa.gov>
Greg Griffiths wrote:
> Dear All,
> I have been stuggling to develop a method of checking for valid email
> address coming out of a database and through my script, so as to remove
Point #1: this can't be done. If you want to make sure that the e-mail
address meets RFC 822, then you have a *lot* of work. Jeffrey Friedl has,
in his book 'Mastering Regular Expressions' a regex that does this.. and
it is THOUSANDS of characters long. Without the explanatory comments.
> them before they hit the mailserver. However I am not allowed (due to
> server restrictions) to use any other modules apart form the basic ones.
Not a nice thing. Buy him/her a cup of coffee and try to convince said
admin of the advantages of Perl modules.. like having functional, fast
solutions to things that will otherwise be coded badly (or at least less
well).
> I thus started to build an RE along the lines of
>
> if ($ToEmail=~/\@/)
If you just want to check the presence of '@', you don't need the
backwhack. Perl won't think you're trying to sneak an array in there.
> {
> $To=$Data{'ContactName'};
> $ToEmail=$Data{'Email'};
Whoa. Wait a minute. Haven't you already created $ToEmail ?
You just wrote right over it.
> print "$To, $ToEmail";
> }
> else
> {
> print "failed";
> }
>
> but I keep getting the fail line every time, even for valid emails, even
> though I have escaped the @, any ideas why ?
Don't escape the @ . Perl is smarter about pattern matching than
other languages and utilities. But seriously, consider why you
need to do this check, and then read the Perl FAQ about this subject.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 1 Apr 1999 09:26:33 -0800
From: tbrannon <brannon@quake.usc.edu>
Subject: Why is this if stmt matching every file?
Message-Id: <ysizemm49rsc.fsf@nunki.usc.edu>
#!/usr/bin/perl
use File::Find;
$dir{data}='/disks/newport/freeway/brannon/rs/ns-98/data/Golding_Spruston98';
find(\&wanted,$dir{data});
$datafile_regexp='spiketimes.dat';
sub wanted {
print " ** $_ **", $/;
if (/$datafile_regexp/) {
print $File::Find::name,$/;
}
}
If I replace if (/$datafile_regexp/) { with
if (/spiketimes.dat/) {
it works fine...
--
Terrence Brannon * brannon@lnc.usc.edu * http://lnc.usc.edu/~brannon
(213) 740-3397 [office] (323) 294-3028 [home]
------------------------------
Date: Thu, 01 Apr 1999 18:50:57 GMT
From: m.kirkby@nof***ingspamukonline.co.uk (Mike Kirkby)
Subject: Re: Win32 Newbie please help
Message-Id: <3703a8e8.73078265@news.ukonline.co.uk>
On 21 Mar 1999 18:33:03 -0000, Jonathan Stowe <gellyfish@btinternet.com>
wrote:
>On Sun, 21 Mar 1999 13:40:17 GMT Mike Kirkby wrote:
>> I have installed perl, -v gives the following:
>> This is perl, version 5.004_02
>>
<SNIP>
>*However* the 5.00402 distribution is no longer the most current available
>for Win32. If you download and install the ActiveState distribution from
>
><http://www.activestate.com/ActivePerl/>
>
>The everything is a zip - all of the supported modules can be installed
>via the Perl Package Manager (PPM) without the need for any deviousness
>however this relies on modules having been packaged for this platform.
>
>/J\
>
>--
>Jonathan Stowe <jns@btinternet.com>
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
>Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
Thanks for the help,
the delay in replying was due to some serious DIY in my house.
Also I had a go at collecting everything I need to be able to compile perl
but it took too much time. I collected lots of the egcs and Mingw32 stuff,
then it seems I needed even more unixy stuff before I could compile
anything. I will try to come back to that after I am able to use perl.
Mike.
------------------------------
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 5278
**************************************