Re: Relationship between Perl and various animals and sitcoms

2001-11-27 Thread Randal L. Schwartz

 Craig == Craig S Cottingham [EMAIL PROTECTED] writes:

Craig On Monday, November 26, 2001, at 04:20 , [EMAIL PROTECTED] wrote:
 Why Buffy? (as opposed to some other TV sitcom)

Craig Sitcom? That's the first time I've ever seen Buffy lumped in with
Craig the likes of Three's Company

Ah yes, the sitcom of Three's Company.  Big Sit, little Com.

:-)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Daily Perl FAQ - How do I select a random line from a file? (fwd)

2001-11-27 Thread Andy Bach

Hi.

Okay, would the maths folk like to offer a helpful explanation? 

a

-- Forwarded message --

Question:
How do I select a random line from a file?

Here's an algorithm from the Camel Book:

srand;
rand($.)  1  ($line = $_) while ;

This has a significant advantage in space over reading the whole
file in. A simple proof by induction is available upon request if
you doubt its correctness.



-- 
The contents of this message are part of the Perl FAQ:
Please note that I below refers to FAQ authors, and *not* Jeff Yoak or Perl FAQ a 
Day.

Where to get this document [the Perl FAQ]
   This document is posted regularly to comp.lang.perl.announce and
   several other related newsgroups. It is available in a variety of
   formats from CPAN in the /CPAN/doc/FAQs/FAQ/ directory, or on the web
   at http://www.perl.com/perl/faq/ .

CREDITS
   When I first began the Perl FAQ in the late 80s, I never realized it
   would have grown to over a hundred pages, nor that Perl would ever
   become so popular and widespread. This document could not have been
   written without the tremendous help provided by Larry Wall and the
   rest of the Perl Porters.

AUTHOR AND COPYRIGHT INFORMATION
   Copyright (c) 1997 Tom Christiansen and Nathan Torkington. All rights
   reserved.



-- 
162
..




Re: Gift Giving... in Perl?

2001-11-27 Thread Michael G Schwern

On Tue, Nov 27, 2001 at 06:40:47PM -0500, Michael G Schwern wrote:
 shuffle \@emails;
 for (1..@emails) {
 $santa{$emails[0]} = $emails[1];
 push @emails, unshift @emails;
^^^
Make that shift

 }


-- 

Michael G. Schwern   [EMAIL PROTECTED]http://www.pobox.com/~schwern/
Perl Quality Assurance  [EMAIL PROTECTED] Kwalitee Is Job One
what am I supposed
to be doing at this page?
bend over, sonny.
-- stimps



Re: 'vacation'

2001-11-27 Thread Peter Scott

At 05:34 PM 11/27/2001 -0500, Scott R. Godin wrote (to a *lot* of lists):
I'm very anxious to get back at these spamming bastards somehow, as this
intrusion into my personal e-mail is MOST unwelcome, and I've got a
growing passion to stamp out this *expletive deleted* practice as often
as I can.

Hitting them where it hurts with *minimal* manual intervention, seems
the best way. ;D

I've just started using Mail::SpamAssassin and I like it.  I was going to 
write something that took a scoring approach and used Mail::Audit after I 
read the TPJ article on it, but then I discovered someone else had already 
done it.  The main intended usage appears to be via a supplied script, but 
I'm using a script in .forward that has some simple code to call 
Mail::SpamAssassin.  I can just delete anything with a high enough score 
from the spool so it never goes up to my MUA.

Peter Scott
[EMAIL PROTECTED]
http://www.perldebugged.com




Re: 'vacation'

2001-11-27 Thread William R. Ward


Although Perl is a great tool for this sort of thing, there are others
as well, most notably Procmail.  And there's an excellent filter
system called the Spam Bouncer which consists of a bunch of procmail
scripts which does just what you want.  See http://www.spambouncer.org/
for more info.

--Bill.

Scott R. Godin writes:
has anyone implemented a 'better version' of the vacation program for 
themselves? 

I'm particularly interested in 'screening' the bulk-mail type messages 
that list me in their bcc: header so that my address does not show up 
in the from: or cc: address listings, thus preventing 
/usr/bin/vacation from triggering and sending the response. =:P (fat lot 
of good that does me)

I've noticed that near 99% of the spam I receive uses this method to 
mask it from reciept, so typically I filter this with my mailer into a 
dumping ground, but the sheer amount of spam lately (235 items since Nov 
5th) has caused me to form a desire to tackle this more forthrightly and 
aggressively. 

Ideally, it should return the offending mail to postmaster@* (where * is 
the supposed 'from' address) to report the abuse, and include a full 
copy of the original message including headers (along with a nice terse 
little message regarding the laws involved). Additionally it would be 
nice if it could forward the spam to my OWN postmaster for additional 
reportage and filtering at their end.  

I'm quite unsure how to go about this. I'm loathe to start messing with 
it without some direction, against the possibility of perhaps breaking 
things or doing it VERY wrongly and seriously pissing off my own 
postmaster hehe ;) without some starting point references to work from, 
and I don't have a testbed here to play with, until my friend finishes 
the work on the redhat box he's been tossing together for me in his free 
time. :-) 

Can you kind folks offer some pointers to me as to how I can go about 
such a task, and what would be some of the traps and pitfalls to avoid 
(of which I'm quite sure there are many) in the process? 

I'm very anxious to get back at these spamming bastards somehow, as this 
intrusion into my personal e-mail is MOST unwelcome, and I've got a 
growing passion to stamp out this *expletive deleted* practice as often 
as I can. 

Hitting them where it hurts with *minimal* manual intervention, seems 
the best way. ;D

I've considered also, the possibility of stuffing them in a database, 
and then periodically checking it interactively with the program, and 
triggering 'bounce' type messages to said postmasters on a specific 
basis -- as this way I don't auto-trigger I'm-annoyed-by-your-spam 
responses for *legitimate* 'bcc' messages.

 something sort of like an 
$ ~/bin/vacation.pl -X (where X will be whatever flag I decide on to 
enter the database processing stage)

You have (n) messages in your holding cell. Proceed? (y/n) _
list of from/subject lines, numbered
Enter a Selected line number, or 'a' for all. [#/a] _
message headers
Preview, Accept, Bounce, Delete [p/a/b/d]? _
(if Preview is selected)
message body
Accept, Bounce, Delete, 
Mark-this-Entire-Domain-as-SPAM-source-for-all-time-and-bounce-and-report
-all-instances :D [a/b/d/m]? _m

Domain 'btamail.net.cn' Captured. OK?
Return to accept, or enter corrections: _

(where (A)ccept could possibly add the From address to a list of 
acceptable e-mails that get passed through automatically from then on. 
:-) as well as passing the mail on to my proper inbox, just like a 
\$user in my .forward file would.

this is just a stray shell account, that I retain around on my prior ISP 
for testing purposes, perl-wise, and in case some people still haven't 
upgraded their addressbooks, so delaying the mail a bit won't kill me. 
(particularly considering the volume of spam it's recieving lately) I 
don't even get 1/20th the amount of spam to other accounts I have. :/

With enough pointers, I think I can complete the beastie -- I mean I DO 
have a pretty complete 'vision' of what I want. :-) I just need some 
pointers on how to get there. I'll happily contribute this pup to the 
CPAN scripts archive if I can get it working exactly the way I want it 
to. I'm SURE some of you could find a use for it. ;) 

Your thoughts and contemplations are anticipated with great desire and 
gleeful hand-rubbings and evil-grinning eyebrow-wagglings to Make it 
so.

If stuff like this isn't one of the things that makes Perl so fun I 
dunno what is. :D 

(note that while I'm sort of broad-casting my initial hopes on this to 
four groups on perl.org (perl.scripts, perl.beginners, 
perl.macperl.anyperl, perl.fwp), I'm confining responses (via reply-to 
and followup-to) to 

[EMAIL PROTECTED] 
aka nntp://nntp.perl.org/perl.scripts/ 

to consolidate things and reduce the required effort of following this 
thread to a single track. I hope this is the proper way to go about it 
-- despite years of experience with cross-posting 

Re: 'vacation'

2001-11-27 Thread Keith C. Ivey

Scott R. Godin [EMAIL PROTECTED] wrote:

 I'm particularly interested in 'screening' the bulk-mail type
 messages that list me in their bcc: header so that my address
 does not show up in the from: or cc: address listings,

You're lucky that so much of your spam would be blocked by such 
a filter.  A lot of the spam I get nowadays actually has my 
address in the To: line.  Sometimes it's even disguised as a 
bounce message.

 Ideally, it should return the offending mail to postmaster@*
 (where * is the supposed 'from' address) to report the abuse,
 and include a full copy of the original message including
 headers (along with a nice terse little message regarding the
 laws involved).

Be very careful with any solution you implement.  For the vast 
majority of spam, the From: address has nothing to do with the 
real sender or any open relay used.  Complaining to the 
postmaster there just annoys a completely innocent person who's 
no doubt getting quite enough complaints from ignorant victims 
of the spammer.

-- 
Keith C. Ivey [EMAIL PROTECTED]
Washington, DC