[8926] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2543 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 8 19:07:51 1998

Date: Fri, 8 May 98 16:00:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 8 May 1998     Volume: 8 Number: 2543

Today's topics:
    Re: "tail -f" emulation under Linux (Rob Greenbank)
    Re: a header for `Mail me copies' or `Do not mail me co (John Stanley)
        A regex teaser that ALMOST works! <tech@BMEi.on.ca.NOSPAM>
    Re: A regex teaser that ALMOST works! (Greg Bacon)
    Re: Anagram algorithm anyone. (Chris Benson)
    Re: ANSI Colour in Perl <Rosie@dozyrosy.demon.co.uk>
        Comparing references (Peter Scott)
    Re: COUNTING DAYS UNTIL 2000 <sowmaster@juicepigs.com>
    Re: cross platform perl? (Greg Bacon)
        DBM file questions <tgough@goughtech.com>
    Re: Debugger problem (Ilya Zakharevich)
    Re: Ever Wonder Why Not Everyone Uses Modules? <zenin@archive.rhps.org>
    Re: Ever Wonder Why Not Everyone Uses Modules? <zenin@archive.rhps.org>
    Re: Ever Wonder Why Not Everyone Uses Modules? (John Stanley)
    Re: Ever Wonder Why Not Everyone Uses Modules? <zenin@archive.rhps.org>
    Re: Ever Wonder Why Not Everyone Uses Modules? <zenin@archive.rhps.org>
    Re: Expanding arrays in strings (Greg Bacon)
    Re: flock is not <rootbeer@teleport.com>
    Re: Graphing databases, need info <mike@soft-tek.com>
        Help ME <chris@starkimages.com>
    Re: How old is Perl? <beadles@nortel.com>
    Re: how to create name for temporary file <rootbeer@teleport.com>
    Re: How to delete an element in an array? (Ken Fox)
    Re: if ($string eg "y") or if ($string == "y") <aqumsieh@matrox.com>
        Logic of split() ? <jgoldberg@dial-but-dont-spam.pipex.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 08 May 1998 22:29:33 GMT
From: rob@frii.com (Rob Greenbank)
Subject: Re: "tail -f" emulation under Linux
Message-Id: <35548593.502701468@news.frii.com>

On Fri, 08 May 1998 10:33:50 -0400, John Ackermann <jra@febo.com>
wrote:

>Hi --
>
>I've read the FAQ and tried the three methods shown there to "tail -f" a
>file in perl (5.003_07 ) under Linux, but none of them seem to work --
>all dump the existing contents of the file, but don't remain open.
>
>Could some kind soul provide a code fragment showing how to do this
>under Linux?   My goal is to have a pair of processes, one of which
>writes to a spool file on disk, the other of which is a server run from
>inetd that dumps the contents of the file to a remote host and keeps
>sending data as it is appended by the other process.  I've got the
>network stuff working (more or less... I'm posting another question on
>that), and the real barrier is just getting the following tail to work.
>

John,

I don't know about Linux.  I do have a perl script, running on
Solaris, that constantly reads a web access log and does DNS
resolution.  My strategy (the first one I thought of) seems to work.  

What I did is read the file until I hit the end.  The app then sleeps
a bit and tries the read again.  I've never had a problem.  

Whether this works the same on Linux, or for your particular
application, is something you'ld have to try to find out.

Hope this helps.

	Rob Greenbank



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

Date: 8 May 1998 22:14:25 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: a header for `Mail me copies' or `Do not mail me copies' (was Re: Ever Wonder Why Not Everyone Uses Modules?)
Message-Id: <6j0041$qki$1@news.NERO.NET>

In article <19980508.165151.1F2.rnr.w164w_-_@locutus.ofB.ORG>,
Russell Schulz  <Russell_Schulz@locutus.ofB.ORG> wrote:
>  why was this in comp.lang.perl?

It wasn't.

>  why does Gary still post with that PC-specific barcode sig
>    even after I've pointed this out in mail (and he's been
>    annoyed at me for doing so, so I know he's seen it)?

Because he wants to?

>ah, to live in a world where news never gets lost.

Ah, to live in a world where you can drop whatever you are doing to deal
with a piece of mail that is just a copy of a news article.

>the `Mail-Copies-To: never' header explicitly advises
>actively-maintained newsreaders to NOT mail the copies; the

Please provide an RFC reference that defines this header for news.



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

Date: Fri, 08 May 1998 16:47:09 -0400
From: Matt Murdock <tech@BMEi.on.ca.NOSPAM>
Subject: A regex teaser that ALMOST works!
Message-Id: <35536E18.21FEBC82@BMEi.on.ca.NOSPAM>

I have an application in which i'm using ASCII comma separated database
file.  I'm allowing users to manipulate the file (thus the use of ASCII
versus a UNIX DBM file), thus I would like to be lenient with file
format requirements.  Here is a sample of a database file:

"104a","Ayerst","
"104a",\Ayerst\,""
"104a",,,,"Ayerst",,"",,""
"104a","Aye"bhal"rst"
"104a","Ay""erst",""

I am using the following regex to parse the data:

push( @acsdb_record, $+ ) while $string =~ m{
  "([^\"\\]*(?:\\.[^\"\\]*)*)"
  |([^,]+)
}gx;

The result of parsing each entry *should* be as follows:

(I will use the pipe '|' to indicate record elements)

1. 104a|Ayerst|"
2. 104a|\Ayerst\|
3. 104a|Ayerst|
4. 104a|Aye"bhal"rst	<- note that this record has only TWO elements
5. 104a|Ay""erst|

After parsing with the above regex, I yeild the following instead:

1. 104a|Ayerst|"	<- Correct
2. 104a|\Ayerst\|	<- Correct
3. 104a|Ayerst||	<- Incorrect, a null element inserted
4. 104a|Aye|bhal"rst"|	<- Incorrect, one element added to end
5. 104a|Ay|erst| 	<- Incorrect, 'Ay' and 'erst' split

Ok, so what's wrong with the regex?  It seems to be splitting on double
quotes when it shouldn't be!

Any ideas?

Matt Murdock
-------------------------------------------
Preserve wildlife, pickle a squirrel today!


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

Date: 8 May 1998 21:33:53 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: A regex teaser that ALMOST works!
Message-Id: <6ivto1$ifd$4@info.uah.edu>

In article <35536E18.21FEBC82@bmei.on.ca.nospam>,
	Matt Murdock <tech@BMEi.on.ca.NOSPAM> writes:
: I have an application in which i'm using ASCII comma separated database
: file.  I'm allowing users to manipulate the file (thus the use of ASCII
: versus a UNIX DBM file), thus I would like to be lenient with file
: format requirements.  Here is a sample of a database file:
: 
: "104a","Ayerst","
: "104a",\Ayerst\,""
: "104a",,,,"Ayerst",,"",,""
: "104a","Aye"bhal"rst"
: "104a","Ay""erst",""

These sorts of problems make me miss C's pointers to char.  I wish Perl
had an efficient way of stepping a pointer down a string.

Anyway, I played with Text::ParseWords and came up with this:

    #! /usr/local/bin/perl -w

    use strict;

    use Text::ParseWords;

    my @records = split ' ', q(
        "104a","Ayerst",\"
        "104a",\Ayerst\,""
        "104a",,,,"Ayerst",,"",,""
        "104a","Aye"bhal"rst"
        "104a","Ay""erst",""
    );

    $" = "][";  ## as in Apple.. :-)

    my $i = 1;
    for (@records) {
        print "Record $i:\n$_\n";
        my @new = grep { $_ }
                  quotewords(",", 1, $_);
        print "[@new]\n";

        print "\n";
        $i++;
    }

Its output isn't quite what you want, but your rules seem a little
inconsistent.  Perhaps you could massage the contents of @new from a
higher level sub.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: 8 May 1998 22:25:37 +0100
From: chrisb@jesmond.demon.co.uk (Chris Benson)
Subject: Re: Anagram algorithm anyone.
Message-Id: <6ivt8h$7im@jesmond.demon.co.uk>

In article <Wbs+iDACUtU1Ewe+@connected.demon.co.uk>,
Jerry Pank  <jerryp.usenet@connected.demon.co.uk> wrote:
>
>Does anyone have a ``standard'' algorithm for calculating anagrams?
>
My "brute force" attempt .... for which I eventually used a modified
dictionary with "useless" words removed -- see another posting.

Best wishes.
-- 
Chris

#!/usr/bin/perl -s
# find anagrams of 'creative thinking'

$| = 1;
my @ct = sort split '', 'creativethinking';
my $pat = '[^' . join('', @ct) . ']';
my $key;
my %word;
my $word;
my $word_count = 0;

# build a dictionary from /usr/dict/words ..,
@ARGV = qw(/usr/dict/words /usr/dict/extra.words);

while (<>) {
     chomp;
     # skip if characters not in target 
     next	if /$pat/io; 

     $key = join '', sort split '', lc($_);
     push @{ $word{ $key } }, $_;
}
print scalar keys %word, " words\t", time - $^T, " seconds\n"
     if $v;

my @dict = keys %word;		# to avoid rebuilding of the list

foreach $word (@dict) {
     print "toplevel $word at ", time - $^T, " secs\n";
     anagram(\@ct, $word, [] );
     # delete $word from @dict so it's not tried again
     splice @dict, $word_count++, 1;
}

exit;


##################
# 
sub anagram {
     my(@target) = @{shift()};
     my(@word) = split '', shift();
     my(@history) = @{shift()};
     my $word;

     print "anagram(target=[@target], word=[@word], history=[@history])\n" 
       if $v;

     if ( contains(\@target, \@word) ) { # alters @target if successful
	  push @history, join '', @word;	  # save the match
     
	  if (scalar @target <= 1) {	# near enough! 
	       foreach $word (@history) { # print it all out
		    print STDERR "[ @{$word{$word}} ]";
	       }
	       print STDERR ": @target\n";	# and any remainders
	  }
	  else {			# carry on
	       foreach $word (@dict) {
		    anagram(\@target, $word, \@history)
			 if ( @target >= length($word) );
	       }
	  }
     }
     else {
	  print "no match\n"	if $v;
	  return;		# no match, end of branch, try next word
     }
}

################
sub contains {
    my $target_ref = shift;
    my @tmp = @$target_ref;
    my @chars = @{ shift() };
    my $i = 0;
    my $l;

    print "contains([@tmp],[@chars])\n"	if $v;

 CHAR: foreach $l ( @chars ) {
	while ( defined $tmp[$i] ) {
	    if ($l eq $tmp[$i]) {
		splice @tmp, $i, 1; # remove matched char
		next CHAR;
	    }
	    elsif ($l lt $tmp[$i]) {
		return 0;	# no match -- failed
	    }
	    $i++;
	}
	return 0;		# no match -- failed
    }
    # got all chars, return the changed array
    @$target_ref = @tmp;
    return 1;
}




-- 
Chris Benson


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

Date: Fri, 8 May 1998 19:52:42 +0100
From: Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk>
Subject: Re: ANSI Colour in Perl
Message-Id: <NfLfNbA6R1U1Ew8q@dozyrosy.demon.co.uk>

In article <MPG.fb799bea332451e98969e@news.min.net>, John Porter
<jdporter@min.net> writes
>On Fri, 1 May 1998 22:31:25 +0100,
>in article <oA1d4UAt8jS1EwIa@dozyrosy.demon.co.uk>,
>Rosie@dozyrosy.demon.co.uk (Rosemary I H Powell) wrote:
>>
>> ICK!! You mean the AMERICAN spelling - the correct way in this country
>> is coloUr.
>
>wadr, the correct spelling is the one which finds the package, if
>you're doing a text-based search.  'color' finds it, 'colour' does
>not.
The term "correct spelling" can be ambiguous; "American spelling" leaves
no doubt. At least in my mind.

>> Just Another Micro$oft Idiot
>
>Well said. (;-)
I have little hope of ever becoming Just Another Perl Hacker, so I will
stick with what I can do well :-))

-------------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosemary@dozyrosy.demon.co.uk |     
|                             Work: r.i.h.powell@rl.ac.uk         |
|                       http://www.netlink.co.uk/users/dozyrosy/  |
|                       http://www.dozyrosy.demon.co.uk/          | 
-------------------------------------------------------------------


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

Date: 8 May 1998 22:22:16 GMT
From: psf@euclid.jpl.nasa.gov (Peter Scott)
Subject: Comparing references
Message-Id: <6j00io$8o5@netline.jpl.nasa.gov>

I want to check whether two references refer to the same thingy,
and a quick test appeared to show that I could use either == or eq:

@foo = qw(one two three);
@bar = qw(four five six);
$x = $y = \@foo;
$z = \@bar;
printf "\$x %s \$y\n", $x == $y ? "==" : "!=";
printf "\$x %s \$y\n", $x eq $y ? "eq" : "ne";
printf "\$x %s \$z\n", $x == $z ? "==" : "!=";
printf "\$x %s \$z\n", $x eq $z ? "eq" : "ne";

prints:

$x == $y
$x eq $y
$x != $z
$x ne $z

However I couldn't find anything on the subject of comparing references
in perlref (or the Camel or Panther), so I thought I'd ask whether there
were any possible gotchas.  Would I be right in saying that testing with
eq compares the stringified references ("ARRAY (0xabcdef)")?  

Hmm... then I started wondering how the == test worked... and
discovered that a reference in a numeric context evaluates to the
hex address from the parens.  Assuming that took someone some effort, thank
you, whoever you are :-)

-- 
This is news.  This is your      |  Peter Scott, NASA/JPL/Caltech
brain on news.  Any questions?   |  (Peter.J.Scott@jpl.nasa.gov)

Disclaimer:  These comments are the personal opinions of the author, and 
have not been adopted, authorized, ratified, or approved by JPL.


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

Date: Fri, 08 May 1998 18:36:19 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Art Cohen <upsetter@shore.net>
Subject: Re: COUNTING DAYS UNTIL 2000
Message-Id: <355388E2.513A@juicepigs.com>

Art Cohen wrote:
> 
> I R A Aggie <fl_aggie@thepentagon.com> wrote:
> 
> : I still await evidence that this load time is greater than the lag time
> : of the network.
> 
> Well, I can take a simple script like this:
> 
>         #!/usr/bin/perl
>         use Date::Manip;
>         print "Hello World\n";
> 
> and time the load time with my WRISTWATCH (approx 2.5 seconds). That's not
> anything I would ever want to put in a cgi script.

Benchmark: timing 100000 iterations of importsub, module, no_module...
 importsub: 11 secs (11.75 usr  0.00 sys = 11.75 cpu)
    module: 12 secs (11.59 usr  0.00 sys = 11.59 cpu)
 no_module: 12 secs (11.68 usr  0.00 sys = 11.68 cpu)

I'm not sure if Benchmark went out and imported the Date::DateManip
module for every iteration but it must have atleast once and I don't see
any great difference.

Below is my source, please let me know if this is a bogus test:

use Benchmark;
timethese 100000, {
    module     => sub {
	use Date::DateCalc;
	my @foo = qw(just a bunch of crap);
    }
    importsub     => sub {
	use Date::DateCalc "calc_new_date";
	my @foo = qw(just a bunch of crap);
    },
    no_module => sub {
	my @foo = qw(just a bunch of crap);
    }
};


-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 8 May 1998 21:07:36 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: cross platform perl?
Message-Id: <6ivs6o$ifd$3@info.uah.edu>

The Internet Oracle has pondered your question deeply.
Your question was:

>

And in response, thus spake the Oracle:

} Bill, do you really think you can get away with your buzzwords-but-no-
} content games in a newsgroup full of thinkers and knowers and experts?
}
} You owe the Oracle the rest of your life trying to poison Perl and
} call it yours the way you have everything else cuz it just.. won't..
} happen,...  BOY!

Sorry, Steve, couldn't resist. :-)

ObPerl: did you know that the Internet Oracle is written in Perl and
that a certain regular poster and book author is listed in the Oracle's
credits?

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 8 May 1998 18:06:19 -0700
From: "Tracy J. Gough" <tgough@goughtech.com>
Subject: DBM file questions
Message-Id: <C75D017E74A11C69.E4E77C46E02DA750.94F2B5BB623F035F@library-proxy.airnews.net>

I am working on a project using DBM files. All of my past expirence has been
with SQL databases. What can I expect as far as performance, relibility, and
volume when comparing DBM files to something like MS SQL Sever?  Also, how
can I easily sort my data by a particular field?  Thanks for any help.

Tracy J. Gough
Gough Technologies
http://www.goughtech.com




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

Date: 8 May 1998 20:51:55 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Debugger problem
Message-Id: <6ivr9b$426$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Stephane Di Cesare
<sdc@unix.ling.lu.se>],
who wrote in article <6iv15r$3vg$1@merkurius.lu.se>:
> Has someone an idea of what is happening, is it a bug or a silly mistake?

Starting from 5.004 (?), debugger may be confused about the current
line number immediately after the start or end of a block.  May it be
this?

(I think somebody issued a patch for this, so it may be fixed in
5.004_05-tobe.)

Ilya


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

Date: 8 May 1998 21:43:18 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <894664251.794460@thrush.omix.com>

Chris Nandor <pudge@pobox.com> wrote:
: Then your sysadmin sucks.  Perl and CPAN and modules are not responsible
: for such human deficiencies.  As I said, don't shoot your parents and ask
: for mercy because you are an orphan; the management assumes no
: responsibility.

	You're asking either the sysadmin, or the "perl" admin to know the
	detailed workings of every module installed on the system.  This
	meens that every time joe's programming group asks to have a module
	installed, the sys/perl admin needs to not only become completely
	and totally versed in both it's use and internals, but also has to
	remember that whenever anything else in the entire system changes
	they must consult some kind of list they must make themself to
	see if anyone of the random modules they have installed might be
	affected.

	Hint: It's not going to happen, and anyone with half a brain would
	point directly at the lame brained programmer for choosing to code
	to the *wrong* layer of the protocal stack.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 8 May 1998 21:57:13 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <894665086.523858@thrush.omix.com>

Chris Nandor <pudge@pobox.com> wrote:
: In article <894597310.838511@thrush.omix.com>, Zenin
: <zenin@archive.rhps.org> wrote:
:
: #         Think about this; If where were printing files instead of sending
: #         mail, would you me manually connecting to a remote lpd instead of
: #         calling lpr?  Think hard about this, because this is the *exact*
: #         same case as with sending mail.  The *exact* same case...  Your
: #         application is working at the *wrong* level of the protocal stack,
: #         it's that simple.
:
: If it works, and it doesn't break anything, and it follows all the
: protocol standards, how can it be wrong?

	Vary simple.  You're working at the *wrong* level of the protocal
	stack, and your code *will break* when it has *no* reason to
	whenever even a minor change is made to the print system.

	Your code will *instantly* break if any of the following happen:
	  -Your data is in the wrong format for the printer (can't access
	   local filters)
	  -The print server is moved.
	  -The print server is removed (local printer).
	  -The printer is down.
	  -The printer que is full.
	  -The printer is out of paper for god's sake!  -No one said
	   the lpd had *any* que abilities large enough to handle the
	   data size you're sending it.
	  -The protocal layer is changed to a non-lpd form (vary common)

	Not to mention, your code will *NO WORK AT ALL* if there is no lpd
	available on the network (local printer, and/or non-lpd protocal
	such as pgp-encrypted email print services, but you didn't think
	about that, did you?), thus making your code *completely*
	non-portable without *any* reason.

:  Just because you don't like it?

	No, because it's just plain brain dead programming.  If you want
	to write brain dead, go right ahead (as long as you don't work for
	me).  But don't try to claim for a second that it's anything other
	then brain dead programming.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 8 May 1998 22:09:32 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <6ivvqs$qih$1@news.NERO.NET>

In article <6ivcn7$fp9$1@shell3.ba.best.com>,
Matthew Cravit <mcravit+usenet@mcravit.vip.best.com> wrote:
>In article <894531613.87925@thrush.omix.com>,
>Zenin  <zenin@archive.rhps.org> wrote:
>>
>>	That's the point.  At the *exact* time you're trying to send this
>>	mail the SMTP server must be up and available.  You also have to
>>	*hard code* it's address into your application.  And guess what?  You
>
>No, you don't. There are any number of ways you could safely solve this
>problem. For example, you could use the Net::DNS module to find the defined
>MX hosts for the domain you're connecting to, and try them one at a time
>until you get a connection.

Yes, you could, but then you would be recreating the wheel. I'll leave
it as an exercise to the reader to determine what program already "finds
defined MX hosts for the destination domain and tries them one at a time
untit it gets a connection", with the added benefit that if it can't
connect to any of them it keeps the mail around and tries again later.

>>	much less portable and reliable SMTP or whatever methods to deliver
>>	it.
>
>SMTP is less reliable then sendmail? Huh? Sendmail _talks_ SMTP. 

Talking SMTP directly yourself is less reliable than allowing sendmail
to talk SMTP for you. 

>>	Name a single flavor of Unix that doesn't have sendmail in either
>>	/usr/sbin or /usr/lib.
>
>Again, I've worked at sites where sendmail was located in an automounted
>directory (such as /tools/sendmail) so that it could be updated without
>having to reinstall it on all of the machines each time.

A good policy at that site would be to have a link from
/usr/lib/sendmail to the real location for all the OTHER software that
wants to find it there.

>Right...but a working and properly configured UNIX system which is running
>a properly configured, non-buggy version of Sendmail, is NOT always a given.
>That's my point.

When I write a script that tries to talk to sendmail, it is a given. If
it weren't available, I wouldn't write the script that way.



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

Date: 8 May 1998 22:15:24 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <894666177.930073@thrush.omix.com>

Matthew Cravit <mcravit+usenet@mcravit.vip.best.com> wrote:
: In article <894531613.87925@thrush.omix.com>,
: Zenin  <zenin@archive.rhps.org> wrote:
: >
: >	That's the point.  At the *exact* time you're trying to send this
: >	mail the SMTP server must be up and available.  You also have to
: >	*hard code* it's address into your application.  And guess what?  You
:
: No, you don't. There are any number of ways you could safely solve this
: problem. For example, you could use the Net::DNS module to find the defined
: MX hosts for the domain you're connecting to, and try them one at a time
: until you get a connection.

	Will not work behind firewalls, and that's just one of *dozens* of
	problems you'll have with trying to deliver directly.

	Once again for the hard of hearing;  You are programming at the
	*WRONG* level of the protocol stack, and will get BURNED because
	of it!

: >	much less portable and reliable SMTP or whatever methods to deliver
: >	it.
: SMTP is less reliable then sendmail? Huh? Sendmail _talks_ SMTP.

	-Non-SMTP accessible addresses.
	-Mail queing for server, network et al failures.
	-Systems that don't have an SMTP server you're allowed to connect
	 to for security reasons.
	-Everything else mentioned in the last 100 post of this stupid
	 thread.

: And if you
: accept your assertion that all systems should have a sendmail daemon, what's
: to stop me from pointing the Net::SMTP module at a sendmail daemon running
: on my local machine, if it's available?

	You're assuming (danger!) that the local machine has anything
	listing on port 25 for you to talk to.  It's likely it doesn't,
	again for security.

: I have worked at sites where Sendmail has been disabled on all but the mail
: relays for policy reasons. If your script is not running on the mail relay,
: and the machine it is running on isn't running and can't be running Sendmail,

	The sendmail daemon need not be running for the sendmail application
	to function.

: Again, I've worked at sites where sendmail was located in an automounted
: directory (such as /tools/sendmail) so that it could be updated without
: having to reinstall it on all of the machines each time.

	And it's not symlinked?  Bad sysadmin, bad.

	Even if this lame setup is found, changing your path to sendmail
	is no harder then your hostname to an SMTP server.  But (and a big
	but), you do not get *any* of the builtin reliability of using
	your local MTA.

	And if sendmail for some reason isn't found, it's still the same
	as Mac/NT/etc:

	if ($sendmail) {
		send_reliable_email ($mail);
	} else {
		hope_for_the_best ($mail);
	}

	Again I ask the simple question, why are you sacrificing such a
	huge amout of reliability and portability for *all* systems when
	it takes and entire 5 minutes to keep it where you can?

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 8 May 1998 22:22:04 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Ever Wonder Why Not Everyone Uses Modules?
Message-Id: <894666578.99793@thrush.omix.com>

Leslie Mikesell <les@MCS.COM> wrote:
: As it happens it is equivalent and it's not that simple when you
: want the script to work on machines that don't have the tools
: you take for granted in a unix environment.

	sub print_best_method {
	    my $page = shift;
	    if ($lpd) {
	        print_reliably ($page);
	    } else {
	        hope_for_the_best ($page);
	    }
	}

	Come on people, this isn't that hard...

: You may want to print
: to a machine running lpd somewhere and you may very well not
: have a correctly configured lpd at your disposal.

	So instead of taking 5 minutes to fix /etc/printcap (for
	BSD at least) so that *everything* will work, you hack
	your one small application in a way that will break instantly
	when any part of the print system is changed.  Great.

: If you can
: talk to a socket you can get the job done, but it is hard to say
: whether it is the right thing to do or not.

	Simple; It's not.

: Maybe what we need
: are exact perl equivalents of sendmail, lpr, etc. to drop into
: such machines so the other scripts don't need to care.  

	They already have sendmail for NT (probably Mac too), as well
	as lpd/lpr, etc.

	That's not the point. if (have) { do_well } else { try_weak_method }
	is.

	Again, come on people, this isn't that hard.

-- 
-Zenin
 zenin@archive.rhps.org


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

Date: 8 May 1998 20:57:42 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Expanding arrays in strings
Message-Id: <6ivrk6$ifd$2@info.uah.edu>

In article <6ivkfe$ljp$1@nnrp1.dejanews.com>,
	nikitins@infoservriga.lv writes:
: PERL FAQ describes the situation when expanding single variables.
:
: I need to have
: 
:     $text = 'this has a $foo[$bar] in it';
: 
: or even simplier
: 
:     $text = 'this has a $foo[2] in it';

It would be difficult if not impossible to do this with regular
expressions.  Did you know that perl has a built-in Perl parser?

    my @foo = (1, 2, 3);
    my $text = 'this has a $foo[2] in it';

    my $bar = eval qq{ "$text" };

Keep in mind that eval EXPR tends to be a pretty expensive operation, so
I'd recommend using it only when absolutely necessary.

Hope this helps,
Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Fri, 08 May 1998 20:02:27 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: flock is not
Message-Id: <Pine.GSO.3.96.980508125835.20271L-100000@user2.teleport.com>

On Fri, 8 May 1998, Andrew F. Lee wrote:

> $LOCK_UN = 8;

You should (almost) absolutely never explicitly unlock a file from Perl. 
The exception is when you completely understand the reason for this rule.
:-)  (In any case, closing the file releases the lock, and exiting the
program closes the file, so generally you just get done quickly and exit,
and all will be well.) 

>     open(DATA, $file) or die $!;

Did you know that DATA is one of Perl's six built-in filehandle names? If
you use one of these names for another purpose, odd things may happen. I
_think_ that's what you're seeing.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 8 May 1998 15:10:16 -0500
From: "Mike Christensen" <mike@soft-tek.com>
Subject: Re: Graphing databases, need info
Message-Id: <6ivohi$44b$1@client3.news.psi.net>

For a commercially available solution, please take a look at GRAFSMAN/WWW
from Soft-tek International, Inc.

http://www.soft-tek.com

You will find a live demonstration of our dynamic generation of charts and
graphs as GIFs.  In addition, GRAFSMAN/WWW will also automatically generate
an image map to go along with your GIF.

Please let me know if I can be of further assistance,

Mike Christensen
Soft-tek International, Inc.
1999 N. Amidon, Wichita, KS  67203
316 838 7200(v)  --  316 838 3789(f)
mailto:mike@soft-tek.com
http://www.soft-tek.com

Ryan McGuigan wrote in message <6ishc7$pa3$1@news.fred.net>...
>Hi, I have to someway link graphs and charts to a database using any
>method possible.  I can use any type of database(I'm think about using
>Brent Michalski's "Simple Perl Databases" or designing something similar
>myself).  The charts are no problem at all, the problem is the
>Graphs.  I'd like to be able to automatically generate GIFs or JPGs of 3D
>graphs for out website using Perl, but I don't have the time to try and
>write something like that.  Does anyone know where I can get something to
>generate the graphs??  Thanks, your help is much appreciated.
>
>If it comes down to it, I can probably write a Java applet to display
>simple graphs(but I don't like Java!).
>
>thanks again,
>Ryan McGuigan




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

Date: Fri, 08 May 1998 17:03:38 -0500
From: Chris Schmidt <chris@starkimages.com>
Subject: Help ME
Message-Id: <3553813A.F6E3B7D4@starkimages.com>

I need a Unicode for perl does it exist
-- 
Chris Schmidt / Systems Manager
Stark Images
Phone         / Fax
4142262700    / 4142262705


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

Date: Fri, 08 May 1998 17:06:30 -0500
From: John Beadles <beadles@nortel.com>
Subject: Re: How old is Perl?
Message-Id: <355381E6.1BAD95E4@nortel.com>

Tom Christiansen wrote:

> 
> PUMPKIN?
> 
>   [from Porting/pumpkin.pod in the Perl source code distribution]
> 
>   Chip Salzenberg gets credit for that, with a nod to his cow orker,
>   David Croy.  We had passed around various names (baton, token,
>   hot potato) but none caught on. Then, Chip asked:
> 

OK, so know we know what a pumpkin is.  What I want to know is what is
a  cow orker?

Come to think of it, maybe I don't want to know after all... ;-)

-- 
------------------------------------------------
John T. Beadles            Nortel CDMA RF Design                       
Office: 972-685-7813           Fax: 972-684-3767 
Email (office):    beadles@nortel.removethis.com  
Any opinions are mine and to do not represent
             those of my employer
------------------------------------------------


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

Date: Fri, 08 May 1998 19:57:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: how to create name for temporary file
Message-Id: <Pine.GSO.3.96.980508125537.20271K-100000@user2.teleport.com>

On Fri, 8 May 1998, Ala Qumsieh wrote:

> > >Jeff Trawick <trawick@ibm.net> writes:
> > >
> > >> Are there any functions in the standard Perl 5.004
> > >> distribution to create names for temporary files
> > >> (like tmpnam() in C Standard Library)?
> > >
> > >A quick search through the docs reveals:  POSIX::tmpnam()
> > >
> 
> Why bother? A file is as temporary as you want it to be!
> 
> Just create a file (I would call it MYFILE.TEMP or whatever),
> 
> do whatever you wanna do with it, then unlink() it!

Why bother? Concurrency issues, among other reasons. I don't think that
POSIX::tmpnam() was created merely because somebody had too much time on
their hands! :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 8 May 1998 20:16:43 GMT
From: kfox@pt0204.pto.ford.com (Ken Fox)
Subject: Re: How to delete an element in an array?
Message-Id: <6ivp7b$5tk5@eccws1.dearborn.ford.com>

kpreid@ibm.net (Kevin Reid) writes:
> Tom Christiansen <tchrist@mox.perl.com> wrote:
> > :question is `what's the best way to do sets in Perl?', and the right
> > :answer to this question is usually (not always, but usually) ``do sets
> > :with hashes, not lists.''
> > 
> > And that small remainder of the time, it's probably bit vectors. 
> 
> Only applicable if your sets are made of small numbers.

Numbers like 0.0001 and 0.000002?  Or aren't those small enough? ;)
I think you meant that the set elements should map easily to unique
integers and the magnitude of the difference between the smallest
and largest integers shouldn't be too large. ;)

- Ken

-- 
Ken Fox (kfox@ford.com)                  | My opinions or statements do
                                         | not represent those of, nor are
Ford Motor Company, Powertrain           | endorsed by, Ford Motor Company.
Analytical Powertrain Methods Department |
Software Development Section             | "Is this some sort of trick
                                         |  question or what?" -- Calvin


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

Date: Fri, 08 May 1998 15:38:10 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: if ($string eg "y") or if ($string == "y")
Message-Id: <35535F22.149D03E4@matrox.com>

Yeu-Perng Nieh wrote:

> Dear all,
>
>  Does anyone know the difference b/w
>
> if ($string eg "y") and if ($string == "y")?
>
> It seems to me that the latter does not work for string matching.
> Even $string is something totally different from "y",
> the if statement is always true. Any comments?
>
> --
> Yeu-Perng Nieh

 Another FAQ! Check out the documentation!

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Fri, 8 May 1998 23:06:37 +0100
From: "Jeremy Goldberg" <jgoldberg@dial-but-dont-spam.pipex.com>
Subject: Logic of split() ?
Message-Id: <6ivvma$ara$1@plug.news.pipex.net>

This is far from vital information, but I'm curious about it now, and I
couldn't see much of info in the perl docs:

Why does:

 ( $time, $dummy, $day ) = split( /\s+(GMT on)?\s?/, $str );

give the same as:

 ( $time, $dummy, $day ) = $str =~ /(\S*)\s+(GMT on)?\s?(.*)/;

Is it a bug? or simply that the split function operates as a =~ regexp
internally? What I was initially looking for was a split that would handle
"time date" and "time GMT on date" equally - I had initially assumed that
any bracketed expressions in a split would simply split, without entering
the resulting array.

- Jeremy Goldberg




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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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

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

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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


------------------------------
End of Perl-Users Digest V8 Issue 2543
**************************************

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