[13440] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 850 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 19 18:07:26 1999

Date: Sun, 19 Sep 1999 15:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <937778708-v9-i850@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 19 Sep 1999     Volume: 9 Number: 850

Today's topics:
        [detecting invalid email before crash] <tonyko@pacbell.net>
    Re: [detecting invalid email before crash] (Matthew Bafford)
    Re: [detecting invalid email before crash] <ltl@rgsun40.viasystems.com>
    Re: [detecting invalid email before crash] <dove@synopsys.com>
    Re: An Array of Collumns <tlb@algonet.se>
    Re: CGI script for remote server <gellyfish@gellyfish.com>
    Re: Converting time() to real date <gellyfish@gellyfish.com>
    Re: Converting time() to real date <gellyfish@gellyfish.com>
    Re: CRAP Software <elaine@chaos.wustl.edu>
    Re: CRAP Software <gellyfish@gellyfish.com>
        CRAPware (now SOAPware) <jeffp@crusoe.net>
        Help me to make it work...please <root@spb.to>
    Re: Humour Impairment [Was: CRAP Software] <gellyfish@gellyfish.com>
    Re: perl mail automatically processing? (Kevin Johnson)
    Re: Perl output to browser <gellyfish@gellyfish.com>
    Re: Reading files on a remote server ???????? <gellyfish@gellyfish.com>
    Re: Some e-mails get sent, some don't (Randal L. Schwartz)
    Re: Some e-mails get sent, some don't (Kragen Sitaker)
    Re: Some e-mails get sent, some don't <gellyfish@gellyfish.com>
    Re: Super EASY DB websited with PERL <gellyfish@gellyfish.com>
    Re: Using a period as a delimiter in the split() functi (Larry Rosler)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 19 Sep 1999 13:28:32 -0700
From: tonyko <tonyko@pacbell.net>
Subject: [detecting invalid email before crash]
Message-Id: <37E54770.374D23AA@pacbell.net>

Is there a way to check if the mail address is invalid before I send it
and crash my perl program ?




------------------------------

Date: Sun, 19 Sep 1999 21:11:24 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: [detecting invalid email before crash]
Message-Id: <slrn7uaj8i.ug.*@dragons.duesouth.net>

And so it happened, on Sun, 19 Sep 1999 13:28:32 -0700, tonyko
<tonyko@pacbell.net> typed random characters into perl, and ended up
with the following posted to comp.lang.perl.misc: 
: Is there a way to check if the mail address is invalid before I send it
: and crash my perl program ?

Send it.

If it bounces, it might be invalid.

If it doesn't bounce, it might be valid.

Why would an invalid email address crash your program?

man perlfaq9:
 ...
    How do I check a valid mail address?
    
    You can't, at least, not in real time.  Bummer, eh?
 ...

HTH,

--Matthew


------------------------------

Date: 19 Sep 1999 21:05:48 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: [detecting invalid email before crash]
Message-Id: <7s3j7c$dvi$1@rguxd.viasystems.com>

tonyko <tonyko@pacbell.net> wrote:
:>Is there a way to check if the mail address is invalid before I send it
:>and crash my perl program ?

perldoc -q mail

-- 
// Lee.Lindley   /// Programmer shortage?  What programmer shortage?
// @bigfoot.com  ///  Only *cheap* programmers are in short supply.
////////////////////    50 cent beers are in short supply too.


------------------------------

Date: Sun, 19 Sep 1999 14:33:36 -0700
From: David Amann <dove@synopsys.com>
Subject: Re: [detecting invalid email before crash]
Message-Id: <37E556B0.5B4CD0C3@synopsys.com>

Hi Tony,

[author of attached program cc'd as a courtesy]

tonyko wrote:

> Is there a way to check if the mail address is invalid before I send it
> and crash my perl program ?

Below is a program by the Tom Christiansen that makes an attempt to
validate an email address.  You can also find it at

http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/ckaddr.gz

However, it's not perfect. In their book, "The Perl Cookbook", Tom
Chrisiansen and Nathan Torkington discuss this fairly well in Recipe
6.19.

I haven't used or tested this program myself, but I offer it up anyway to
give you a start as where to look.

Hope this helps,
-=dav

----------- Begin Tom's Script ---------------------------------------
#!/usr/bin/perl
#
# addrcheck - mail address checker
# by tchrist@perl.com
# Copyright 1997 Tom Christiansen
# version 1.001 Fri Feb 14 15:20:02 MST 1997

####################################
# this program takes an email address as its argument
# and decides whether you're being spoofed or not.
# it exists 0 if it likes the address, and 1 if it doesn't.
#
# can be tested interactively.  if not interactive, it will
# use syslog.
#
# should be rewritten instead of just growing via hacks.
####################################

$LOGGER   = '/usr/bin/logger';  # or /usr/ucb?
$NSLOOKUP = '/usr/bin/nslookup';  # or /usr/ucb?

$DEBUG = -t STDIN && -t STDOUT;
$address = shift || die "usage: $0 address\n";

for ($address) {
    s/^-+//;
    tr/A-Z/a-z/;
}

($user, $host) = split /\@/, $address;

# we check in this order because of speed;
# this way it will fail more quickly.

check_passwd($user);    # picky

if ($address =~ /\@./) {
    check_host($host);
    ck822($address);    # inscrutable
    dns_check($host);   # slow
}

exit 0;

####################################

sub bad {
    # GLOBAL $hispass and $what
    if ($DEBUG) {
        print "$what `$hispass' is bad: @_\n";
    } else {
        system $LOGGER,
                    "-p", "daemon.notice",
                    "-t", "ftpucheck",
                "BOGUS \U$what\E $hispass (@_)";
    }
    exit 1;
}

####################################

#############

sub check_passwd {
    local $what = 'user';
    local $hispass = shift;

    for (@rude) {
        bad("rude") if index($hispass, lc $_) != -1;
    }

    for (@anywhere) {
        bad("inside") if index($hispass, lc $_) != -1;
    }

    for (@full) {
        bad("full") if $hispass eq lc $_;
    }

    for (@start) {
        bad("start") if index($hispass, lc $_) == 0;
    }

    # single char
    bad("single") if length($hispass) == 1;

    study $hispass;

    bad("dup letters") if $hispass =~ /(\w)\1{3,}/;

    bad("white") if $hispass =~ /\s/;

    bad("junk") if $hispass =~ /[;,\/#^*]/;

    $V = 'aeiouy';
    if ($hispass =~ /netscape/ || $hispass =~
/^m[$V]*[sz]+[$V]*l+[$V]*\W*$/) {
        bad("mozilla");
    }

    if ($hispass =~ /xyz+y/) {
        bad("xyzzy");
    }

    # all same letter
    bad("dup letters") if $hispass =~ /^(.)\1+$/;

    # want letters
    bad("ugly") unless $hispass =~ /[a-z]/;

    bad("backspace") if $hispass =~ /[\010\177]/;

    $letters = "qwertyuiopasdfghjklzxcvbnmmnbvcxzlkjhgfrdsapoiuytrewq";

    # consecutive
    bad("consecutive") if
            length($hispass) > 2 &&
                ( index($letters, $hispass) != -1
                    ||
                  ($hispass =~ /^(\w+)\1$/ && length($1) > 2
                    && index($letters, $1) != -1)
                );

    print "$what: $hispass is good\n" if $DEBUG;

}


#############

sub check_host {
    local $what = 'host';
    local $hispass = shift;

    bad("dotless") unless index($hispass, '.') >= 0;

    for (@rude) {
        bad("rude") if index($hispass, lc $_) != -1;
    }

    for (@full) {
        bad("full") if $hispass eq lc $_;
    }

    # single char
    bad("single") if length($hispass) == 1;

    study $hispass;

    bad("white") if $hispass =~ /\s/;

    bad("junk") if $hispass =~ /[;,\/#^*]/;

    # want letters, darnit;  this will cause 127.1 to fail though
    bad("ugly") unless $hispass =~ /[a-z]/;

    bad("backspace") if $hispass =~ /[\010\177]/;

    $letters = "qwertyuiopasdfghjklzxcvbnmmnbvcxzlkjhgfrdsapoiuytrewq";

    # consecutive
    bad("consecutive") if
            length($hispass) > 2 &&
                ( index($letters, $hispass) != -1
                    ||
                  ($hispass =~ /^(\w+)\1$/ && length($1) > 2
                    && index($letters, $1) != -1)
                );

    print "$what: $hispass is good\n" if $DEBUG;

}

sub dns_check {
    # first try an MX record, then an A rec (for badly configged hosts)

    my $host = shift;
    local $/ = undef;
    local $what = "DNS record";
    local $hispass = $host;


    # the following is comment out for security reasons:
    #   if ( `nslookup -query=mx $host` =~ /mail exchanger/
    # otherwise there could be naughty bits in $host
    # we'll bypass system() and get right at execvp()

    if (open(NS, "-|")) {
        if (<NS> =~ /mail exchanger/) {
            print "$what MX: $hispass is good\n" if $DEBUG;
            close NS;
            return;
        }
    } else {
        open(SE, ">&STDERR");
        open(STDERR, ">/dev/null");
        exec $NSLOOKUP, '-query=mx', $host;
        open(STDERR, ">&SE");
        die "can't exec nslookup: $!";
    }

    if (open(NS, "-|")) {
        $_ = <NS>;
        if (/answer:.*Address/s) {
            print "$what A: $hispass is good\n" if $DEBUG;
            close NS;
            return;
        }
        if (/Name:.*$host.*Address:/si) {
            print "$what A: $hispass is good\n" if $DEBUG;
            close NS;
            return;
        }
    } else {
        open(SE, ">&STDERR");
        open(STDERR, ">/dev/null");
        exec $NSLOOKUP, '-query=a', $host;
        open(STDERR, ">&SE");
        die "can't exec nslookup: $!";
    }

    bad("No DNS");
}


sub ck822 {

    # ck822 -- check whether address is valid rfc 822 address
    # tchrist@perl.com
    #
    # pattern developed in program by jfriedl;
    # see "Mastering Regular Expressions" from ORA for details

    # this will error on something like "ftp.perl.com." because
    # even though dns wants it, rfc822 hates it.  shucks.

    local $what = 'address';

    local $hispass = shift;
    local $_;

    $is_a_valid_rfc_822_addr = '';

    while (<DATA>) {
        chomp;
        $is_a_valid_rfc_822_addr .= $_;
    }


    bad("rfc822 failure") unless $hispass =~
/^${is_a_valid_rfc_822_addr}$/o;
    print "$what: $hispass is good\n" if $DEBUG;
}

##############################
# initializations
##############################

BEGIN {

    @full = qw{

        admin
        anon
        anonymous
        bar
        big-liar
        bin
        bizarre
        bla
        blah
        bogus
        cache
        collect
        compuserve
        cool
        crud
        DeleGateMaster
        devnull
        dialup
        dork
        dummy
        employee
        first1
        foo
        friendly
        ftpsearch-collect
        fu
        god
        guest
        gunk
        gw
        harvest
        here
        hi
        ident
        ident
        ie30user
        info
        internet
        junk
        liar
        login
        lycos
        maxima
        me
        mirror
        mosaic
        nobody
        none
        none-known
        nouser
        ntcon
        ok
        outbound
        postmaster
        president
        public
        Put_Your_Email_Address
        report_abuse
        root
        satan
        socks
        spanky
        src
        sticky
        system
        there
        Unknown_Netscape_User
        Unregistered
        unverified
        user
        UserName
        vice-president
        vividnet
        whoever
        wow
        xyz
        xyz

    };

    @start = qw{

        aaa
        abc
        account
        anon
        anon
        asquid
        daemon
        delegate
        ftp
        gopher
        gotch
        oracle
        otthttp
        pass
        satan
        squid
        student
        test
        web
        xx

    };

    @anywhere = qw{

        adresse
        asdf
        asfd
        cache
        firewall
        -gw
        http
        mail
        mirror
        mother
        name
        nobody
        proxy
        sadf
        system
        user
        www

    };

    @rude = qw{

        asshole
        crap
        cunt
        damn
        fuck
        piss
        shit
        suck
        tits
        upyour

    };

}

# don't touch this stuff down here or you'll break the rfc822 matcher.
__END__
(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n

\015()]|\\[^\x80-\xff])*\))*\))*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\

xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"

]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf

f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[

^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\

xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;

:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))

*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\

n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\

\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\04

0)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-

\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?

:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80

-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\(

(?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]

\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\

\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*|(?:[^(\040)<>@,;:".\\\[\]\000-\0

37\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xf

f\n\015"]|\\[^\x80-\xff])*")(?:[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\03

7]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\

\[^\x80-\xff])*\))*\)|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")*<(?:[\04

0\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]

|\\[^\x80-\xff])*\))*\))*(?:@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x

80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@

,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]

)|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\

\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff

])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^

\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-

\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-

\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\01

5()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*,(?

:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\0

15()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^

\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<

>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xf

f])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^

\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\x

ff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:

[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\00

0-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x8

0-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*)*:(?:[\040\t]|\((?:[^\\\x80-\xff\n\

015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*)

?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000

-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t]

|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[

^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xf

f]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\

\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:

[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\

015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@

(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n

\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff

]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\

]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\

xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?

:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80

-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@

,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff

])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x8

0-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\

015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*



------------------------------

Date: Sun, 19 Sep 1999 23:45:44 +0200
From: Andreas Hagelberg <tlb@algonet.se>
Subject: Re: An Array of Collumns
Message-Id: <37E55988.A01AF50A@algonet.se>

Michael de Beer wrote:
> 
> tlb wrote:
> >open (dfile, "data.dat");
> >while (<dbfile>) {
> >   @row = split //;
> >   push @testans, \@row;
> >}
> 
> I think there is a problem here.  on each while loop, the values of
> @row is replaced.  The reference to it stays the same, though, so
> @testans will be an array of identical refences to the last line of data.


Ooops... you're absolutely right... Sorry...


-- 
______________________________________________________________________
ANDREAS HAGELBERG  -  Student at "Högskolan i Karlskrona/Ronneby"
                   -  IT-consultant at Ericsson Software Technology AB
                   -  Webmaster at AllGlobal (http://allglobal.com)
+ E-mail:   tlb@algonet.se or di97aha@student.hk-r.se
+ Web:      http://www.algonet.se/~tlb - Visual Systems Check
+ Address:  Stenbocksvägen 6, SE-372 37 Ronneby, SWEDEN
+ ICQ UIN:  128240
+ Tel:      +46-(0)457-19141  ________________________________________


------------------------------

Date: 19 Sep 1999 20:50:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI script for remote server
Message-Id: <7s3iav$1o3$1@gellyfish.btinternet.com>

On 19 Sep 1999 11:37:50 -0400 Uri Guttman wrote:
>>>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:
> 
>   JS> ), I would recommend using the correct size of cross-head
>   JS> screwdriver for this as although it looks like you can undo the
> 
> phillips head screwdriver. give the inventor his due.
> 

Actually they are Posidriv screws ...

>   JS> (Continued page 94.)
> 
> i can't wait to read the next installment. it feels like reading
> dickens when he was serialized in the papers.
> 

So you dont subscribe to Private Eye then ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 19 Sep 1999 21:43:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Converting time() to real date
Message-Id: <7s3leh$1p1$1@gellyfish.btinternet.com>

On Sun, 19 Sep 1999 11:35:02 -0700 Larry Rosler wrote:
> [Posted and a courtesy copy sent.]
> 
> In article <7s2ibk$193$1@gellyfish.btinternet.com> on 19 Sep 1999 
> 11:44:52 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
>> On 18 Sep 1999 14:37:22 -0500 Abigail wrote:
>> > Craig Vincent (2bunnyhop@home.com) wrote on MMCCIX September MCMXCIII in
>> > <URL:news:EXNE3.42790$kL1.516589@news2.rdc1.on.home.com>:
>> > () I'm sure this is an incredibly easy function to do...but how do you convert
>> > () the return of a time() function to be the actual corresponding date/time?
>> > 
>> > Make a large lookup table.  
>> 
>> But the lookup table isnt that hard to make:
>> 
>> for(0 .. 2147483648)
> 
> As pointed out by Philip Newton, the upper limit should be 2147483647.  
> But the lower limit should be -2147483648.  Why limit yourself to half 
> the possible data?  Buy a little bit more RAM -- it's cheap these days.
> 
>> {
>>   my @stuff = localtime($_);
>> 
>>   push @date_lookup, \@stuff;
>> }
>> 
>> print $date_lookup[time()]->[3,4,5];
> 
> I get the feeling that you posted this without testing it.  For shame!
> 
>   print @{$date_lookup[time()]}->[3,4,5];
> 
> (UNTESTED :-)  And that doesn't correct months, has Y2K problems, and 
> doesn't disambiguate January 11 from November 1, for example.  Sheesh!
> 
> Please don't publish untested code in the future!
> 

Oh lawdy the shame of it all - in mitigation I might add that I was just
off down to Ravenside retail park to buy a washing machine after I broke
the last one whilst (inadvisably admittedly) trying to fit a new door seal -
(thats a round rubber thing not a performing sea mammal BTW.)

;-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 19 Sep 1999 21:48:17 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Converting time() to real date
Message-Id: <7s3ln1$1p4$1@gellyfish.btinternet.com>

On Sun, 19 Sep 1999 16:59:34 GMT Philip 'Yes, that's my address' Newton wrote:
> On 19 Sep 1999 11:44:52 -0000, Jonathan Stowe
> <gellyfish@gellyfish.com> wrote:
> 
>>But the lookup table isnt that hard to make:
>>
>>for(0 .. 2147483648)
> 
> 1) ITYM 2147483647 (2**31-1, not 2**31).
> 

I nver so good at maths ..

> 2) Don't do this on early perls unless you have a *lot* of memory, as
> they allocate an array of size 2**31 for this (don't know how big that
> would be, but my guess is at least 2 GB * sizeof(int) * [some Perl
> overhead]... that's a lot of gigs). Later perl5's turn this into a
> counting loop.
> 

Well I would say thats tough shit then really - if your 'putey sucks
that much then you really *must* read the manpages ...

/j\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 19 Sep 1999 17:35:58 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: CRAP Software
Message-Id: <37E556C0.CE27C019@chaos.wustl.edu>

Abigail wrote:
> >Kibitzer?
> 
> No. You might want to try alt.religion.kibology.

You know, I cannot remember where I read it, but somewhere in my great
history search this past summer Larry wrote he was basically doing the
same thing but Kibo was one who was credited. I suppose kibology has a
cooler ring to it than larryology or wallogy... :)

Now, say kibo kibologises kibble 10 times fast...

e.


------------------------------

Date: 19 Sep 1999 21:56:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CRAP Software
Message-Id: <7s3m5h$1pa$1@gellyfish.btinternet.com>

On 19 Sep 1999 11:32:15 -0400 Uri Guttman wrote:
>>>>>> "JS" == Jonathan Stowe <gellyfish@gellyfish.com> writes:
>   JS> Actually compared to most large disparate groups of people the regulars
>   JS> in this group are (IMO) relatively likeable - mind that could say more
>   JS> about me than the others though ..
> 
> i hate you! i hate you! i hate you!
> 

Fuck off uri I wasnt including you in that ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 19 Sep 1999 17:43:28 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: CRAPware (now SOAPware)
Message-Id: <Pine.GSO.4.10.9909191741480.7491-100000@crusoe.crusoe.net>

CRAP has been renamed SOAP (Stamp Out Awful Perl)... it's better sounding
when related to Perl (who'd want to say "crap" and "perl" in the same
sentence, anyway?)

  Ugly programs?  Clean them up with SOAP!
  Wash that wretched program's mouth out with SOAP!
  [funny quip here] SOAP!

You get the idea.

http://soap.perl.org/

I'm taking layout ideas.  Hoo-ah!

-- 
jeff pinyan    japhy@pobox.com
perl stuff     japhy+perl@pobox.com
CPAN ID: PINYAN            http://www.perl.com/CPAN/authors/id/P/PI/PINYAN



------------------------------

Date: Sun, 19 Sep 1999 21:35:27 +0400
From: "Dmitry Sergeyev" <root@spb.to>
Subject: Help me to make it work...please
Message-Id: <937762178.31831@mail.comset.net>

Hi,
         I wrote such module:

========== Cars.pm ====================
package Cars;

sub new {
  my $class = shift;
  my $self = {};
  if (defined $_[0]) { $self->{key}   = shift; }
  if (defined $_[0]) { $self->{model} = shift; }
  if (defined $_[0]) { $self->{date}  = shift; }
  if (defined $_[0]) { $self->{km}    = shift; }
  if (defined $_[0]) { $self->{price} = shift; }
  if (defined $_[0]) { $self->{days}  = shift; }
  if (defined $_[0]) { $self->{param} = shift; }
  if (defined $_[0]) { $self->{name}  = shift; }
  if (defined $_[0]) { $self->{email} = shift; }
  if (defined $_[0]) { $self->{phone} = shift; }
  if (defined $_[0]) { $self->{notes} = shift; }
  bless $self, $class;
  return $self;
}
sub key

  my $self = shift;
  $self->{key};
}
sub model {
  my $self = shift;
  $self->{model};
}
sub date

  my $self = shift;
  $self->{date};
}
sub km

  my $self = shift;
  $self->{km};
}
sub price

  my $self = shift;
  $self->{price};
}
sub days

  my $self = shift;
  $self->{days};
}
sub param

  my $self = shift;
  $self->{param};
}
sub name

  my $self = shift;
  $self->{name};
}
sub email

  my $self = shift;
  $self->{email};
}
sub phone {
  my $self = shift;
  $self->{phone};
}
sub notes {
  my $self = shift;
  $self->{notes};
}
1;

========== end of Cars.pm ===============
I use it this way:


================= test.cgi ===============
#!/usr/local/bin/perl
require 'Cars.pm';

=========== cut ============

     $array[0] = new Cars(@test);
     $array[1] = new Cars(@test);

=========== cut ============

     $array[20] = new Cars(@test);


 @array=sort { $b->key <=> $a->key } @array;
#  PERL SAYS    Can't call method "key" without a package or object
reference at THIS LINE


=========== cut ============

============ end of test.cgi ===============
In one file such sorting works fine, but in anothers it doesn't.
How must I modify  $b->key  to work in all conditions????


                                                                        Best
regards, Dmitry





------------------------------

Date: 19 Sep 1999 21:53:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Humour Impairment [Was: CRAP Software]
Message-Id: <7s3lvt$1p7$1@gellyfish.btinternet.com>

On Sun, 19 Sep 1999 13:36:54 -0400 Elaine -HFB- Ashton wrote:
> Uri Guttman wrote:
>>   >> Double entendres are encouraged. 
>>   JS> 'A young woman walks into a bar and asks the barman for a double
>>   JS> entendre so he gave her one'
>> 
>> one what?
> 
> /me *smacks* head. You guys are hopeless. 

Thank you elaine I always knew you'd be a good straight person - if thats
allowed ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 19 Sep 1999 21:19:30 GMT
From: kjj@cx570310-a.chnd1.az.home.com (Kevin Johnson)
Subject: Re: perl mail automatically processing?
Message-Id: <slrn7ual18.7qc.kjj@cx570310-a.chnd1.az.home.com>

In article <APC&1'0'50775daf'058@igc.apc.org>, Michael de Beer wrote:
>There are perl modules that let you connect to either of these 
>servers and check a list of messages, download messages, delete
>your messages, etc...
>
>http://search.cpan.org/search?module=Mail::POP3Client
>http://search.cpan.org/search?module=Net::IMAP
>
>The POP3Client works well.  I've never used the IMAP module.,

FWIW, a new version of Net::IMAP is due out in a few weeks - right after I
finish reviewing the index for my upcoming book.  The new version is all
staged, but I don't want to field bug reports while scrutinizing index
arcana...

-- 
thx,
Kevin Johnson             http://www.pobox.com/~kjj/


------------------------------

Date: 19 Sep 1999 21:11:04 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl output to browser
Message-Id: <7s3jh8$1on$1@gellyfish.btinternet.com>

On Sun, 19 Sep 1999 18:14:37 GMT euan_woo9431@my-deja.com wrote:
> It sounds like you might know something useful.

he ...

> what is localhost defined as (do i have to define it / what drive does
> it point to)?

127.1

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 19 Sep 1999 21:20:12 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Reading files on a remote server ????????
Message-Id: <7s3k2c$1oq$1@gellyfish.btinternet.com>

On Sun, 19 Sep 1999 00:57:48 -0500 Seth David Johnson wrote:
> On Mon, 13 Sep 1999, Stewart Pitt wrote:
> 
>>  Does any one know if using perl whether or not I can execute a script on
>> one
>>  server and open a file to read or write on another server connected only by
>> the internet?????
> 
> As opposed to a string and two paper cups? I'm confused...
> 

Oh come on man you *must* know that the paper cups are deprecated in favour
of yoghurt cartons in rfc9282 - and of course that is supposing you are using
*wet* string if you want to achieve the full 20 bits per second bandwidth.

Jeez

*plonk*

:-}

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 19 Sep 1999 13:21:59 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Some e-mails get sent, some don't
Message-Id: <m1n1uivehk.fsf@halfdome.holdit.com>

>>>>> "Kragen" == Kragen Sitaker <kragen@dnaco.net> writes:

Kragen> Don't allow everything not explicitly forbidden.  Forbid everything not
Kragen> explicitly allowed.  And it probably doesn't have to work for "fred and
Kragen> barney"@redcat.com; if someone has chosen such an obnoxious email
Kragen> address, they deserve to have things break.  (They are not being
Kragen> conservative in what they send.)

Kragen, I disagree with you again.  Complex addresses are usually not
"chosen", but rather "required" because of some corporate gateway or
firewall, or perhaps a good spamtracking scheme.

And sending valid RFC822 email address *is* being conservative.
Please don't twist that phrase to mean anything you'd like it to
mean...  the people that invented it meant "don't transmit anything
but what is permitted by the RFCs".

The right way to handle an email address is to handle RFC email addresses.
Period.  Anything less, and you risk shutting out that BIG customer.

Heck, I see stupid forms that don't even let me put in enough characters
for stonehenge.com some times.  Idjits.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <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!


------------------------------

Date: Sun, 19 Sep 1999 21:21:09 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Some e-mails get sent, some don't
Message-Id: <9tcF3.20614$N77.1637269@typ11.nn.bcandid.com>

In article <MPG.124ec792fc9bfced989fa5@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <YL8F3.20213$N77.1601740@typ11.nn.bcandid.com> on Sun, 19 Sep 
>1999 17:08:08 GMT, Kragen Sitaker <kragen@dnaco.net> says...
>...
>> Something like tr/-A-Za-z@.1-9//cd is quite sufficient.
>
>Underscores and zeros of the world, unite!  Send this guy a message!  
>(But he won't be able to respond.  :-()

Um, all I can say is, "Duh."  Sorry.

Nevertheless, I think something like this is the right way to go if you
*must* pass user data to shells.  Throw out everything that's not
guaranteed to be safe -- don't look for things you know aren't safe and
remove them.

A much better technique, of course, would be to use exec.  Or Net::SMTP.  :)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Sun Sep 19 1999
50 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


------------------------------

Date: 19 Sep 1999 22:19:41 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Some e-mails get sent, some don't
Message-Id: <7s3nht$1pl$1@gellyfish.btinternet.com>

On Sun, 19 Sep 1999 17:08:08 GMT Kragen Sitaker wrote:
>                      And it probably doesn't have to work for "fred and
> barney"@redcat.com; if someone has chosen such an obnoxious email
> address, they deserve to have things break. 

Funny but I got a bunch of spam to sceptic@gellyfish.com after posting
doris&sceptic@gellyfish.com as an example (real workable) address 
unfortunately sceptic is a funky little lakeland terrier as is Doris who
some of you might remember as the greatest psychic anlayst in this group
very funky dog ... does barney get e-mail ....

You know why I say this.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: 19 Sep 1999 21:33:36 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Super EASY DB websited with PERL
Message-Id: <7s3krg$1ou$1@gellyfish.btinternet.com>

On 19 Sep 1999 14:06:23 -0500 Abigail wrote:
> You're Dead (yurdead@imp.net) wrote on MMCCX September MCMXCIII in
> <URL:news:909F3.1841$OT2.57911@wbnws01.ne.mediaone.net>:
> ** Sorry - this is actually a posting to stop child pornography on the web but
> ** please read it anyway.
> 
> And off-topic postings stop child pornography because of... ?
> 
> **              There are pictures of children on this news group ranging from
> ** 12 yrs all the way down to 4 yrs. of age who have clearly been forced into
> ** perverted and  homosexual situations and photographed. It boggles my mind
> ** that we as a society can let this happen.
> 
> Me too. It's such a waste. They would have been better served on a BBQ,
> with a nice lemon-mint-thyme sauce.
> 

Whilst I really hate to agree with Abigail, as a nearly lifelong vegetarian
I think think this is the only moral position to take - the only way we
can stop the filth of child pornography is by eating all the children - I
have no problem with selling 'merkans child meat - check the the only
link on <http://www.gellyfish.com> that has anything to do with 'A modest
proposal' ...  clunk clunk clunk special branch break down the door did I
tell you that I got turned down for a job as a spook programmer at GCHQ ?

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


------------------------------

Date: Sun, 19 Sep 1999 14:43:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using a period as a delimiter in the split() function
Message-Id: <MPG.124ef8d91b34c211989faa@nntp.hpl.hp.com>

In article <37E53BFC.E2D74DBA@home.com> on Sun, 19 Sep 1999 19:39:45 
GMT, Rick Delaney <rick.delaney@home.com> says...
> Larry Rosler wrote:
 ...
> > I seldom see a variable used as the first argument for split(), but
> > perhaps a run-time warning for that would also be appropriate.
> 
> I think this would be going too far.  There is nothing obscure about
> 
>     split $pattern, $string, $limit;

I didn't say that the compiler should complain about that at compile-
time, as it is obviously acceptable.  I said at run-time.

I assumed that at run-time the function would have enough information 
about the first argument to determine if it is a string or a regex 
(qr//); to accept the latter, to warn about the former.  But I don't 
know enough perl internals to say whether that is reasonable.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 850
*************************************


home help back first fref pref prev next nref lref last post