[7150] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 775 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 24 22:07:18 1997

Date: Thu, 24 Jul 97 19:00:25 -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           Thu, 24 Jul 1997     Volume: 8 Number: 775

Today's topics:
     Re: "Use of uninitialized value" without using a value  (Ilya Zakharevich)
     Re: ?: stupid script call q (Joe McCaughan)
     [Q] select(R,W,E,T) and read vs. sysread on a socket <kissel@kissel.spicerack.ibm.com>
     about text::template <michaely@hills.alphanet.net.au>
     Re: attack of little squares!  Help! <rootbeer@teleport.com>
     Re: CGI and SSI using PERL5 <rootbeer@teleport.com>
     Re: Deleting all spaces at the beginning of a line. (Bob Wilkinson)
     Formating text: changing the \n to a <P> <mark@nhgir.nih.gov>
     Re: How to call a package/method from a variable? <tchrist@mox.perl.com>
     Mail Command ?? <serginho@alpha.hydra.com.br>
     Re: MakeMaker Module (Nathan V. Patwardhan)
     Re: MakeMaker Module <rootbeer@teleport.com>
     Re: newbie problem with $1 <rootbeer@teleport.com>
     newsgroup archives? <murray@cdrom.com>
     OLE <jpm@iti-oh.comNOSPAM>
     Re: Please Help: Pattern Matching <rootbeer@teleport.com>
     printing labels (Jonathan Hughes)
     Re: problem with perl homepage generator <rootbeer@teleport.com>
     Programs related to this newgroup theinz@interport.net
     prototyping subroutines...not working (Terry Michael Fletcher - PCD ~)
     Re: questions re: a sendmail script (Trey Valenta)
     Re: Re-Flowing ASCII Text (Bob Wilkinson)
     Re: Regex: Email address format (Trey Valenta)
     Re: Req help: Any easy way to CRC a file? (Eric Bohlman)
     Shared memory variables (Jason E Holt)
     Shortcut to Expertise [Intel v. Randal Schwartz] (Jeffrey Kegler)
     SSI and Cookies <mw@cavmicro.com>
     string length <dhir@cs.purdue.edu>
     Re: String matching.. HELP!! :) <rootbeer@teleport.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 25 Jul 1997 00:49:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: "Use of uninitialized value" without using a value - why?
Message-Id: <5r8t66$92i@agate.berkeley.edu>

In article <33D73DD0.66BC6CEF@hotmail.com>,
Larry D'Anna  <ldanna@hotmail.com> wrote:
> perl doesn't let you put a bunch of options together after one dash like
> ls.

Wrong.

Hope this helps,
Ilya


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

Date: 23 Jul 1997 05:40:09 GMT
From: shiloh@best.com (Joe McCaughan)
Subject: Re: ?: stupid script call q
Message-Id: <5r45fp$kjb$1@nntp2.ba.best.com>

Brad Johnson (bgjohnso@unix.amherst.edu) wrote:
: i'm probably taking a mind-numbingly wrong tack at
: this problem in the first place, but here goes:
: I've got a script that takes one argument, the
: name of a database field, e.g. "People to Know"
: or "Things to Do" as such:
: perl archiver_go.pl "People to Know"

It may make your life a little easier if you were to
restrict your first arg to a single word: People_to_know or
Things_to_do etc...

This may save you some problems later on in the code.
It will also make it unecessary to use "'s from the 
command-line.

: I want to call it from another script and send 
: its output to some other file. I try
: (with full path names)

: $cmd = "perl archiver_go.pl";
: system $cmd \"$cats[$i]\" > $output;

: where @cats is a list of the fieldnames 
: (w/o double quotes) and $output
: is the pathname of the output file.

: For some reason, archiver_go.pl only takes the 
: first word of the category name when I direct
: the output to a file.

: In other words,
: system perl archiver_go.pl \"$cats[$i]\"
: produces the correct output, but
: when I direct the output, it doesn't...

: Should I be setting STDOUT around the system call?
: Should I not be using system here at all?

: Thanks.

: --bradj.
: ------------------------Nullus Oppidenda Est--------------------------
: brad johnson (bgjohnso@unix.amherst.edu)    'Disc, God, Country, Pork'
: http://www.amherst.edu/~bgjohnso/             'Chickens! No Cynics!'
: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 


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

Date: Thu, 24 Jul 1997 16:41:51 -0400
From: "Robert S. Kissel" <kissel@kissel.spicerack.ibm.com>
Subject: [Q] select(R,W,E,T) and read vs. sysread on a socket
Message-Id: <33D7BE0F.41C6@kissel.spicerack.ibm.com>

Some colleagues and I are having a heated argument about using read,
rather than sysread, after using the select command to inspect socket
for the presence of incoming data.

Essentially, we need to receive chunks of data (about 1-4K each), batch
them up into groups of about 10 to 20, but since the chunks will come in
over a socket with density varying wildly between 3-4 per hour and 300
to 500 per hour, we need to give up waiting for the next chunk, and
instead, send an incomplete batch no less than once every five minutes.

The solution was to use select(R,W,E,T) to wait no more than T seconds
for the arrival of the next chunk; but a fight broke out over whether or
not we could get away with buffered I/O, once we knew that data HAD,
indeed, arrived.

We did, of course, read the remark in the blue Camel book that

    Mixing buffered I/O...with four-argument select is asking
    for trouble (p. 212)

but none of us REALLY understands why THIS PARTICULAR usage should cause
us difficulty, viz., using select to see if the next chunk has arrived,
and using BUFFERED I/O to read it in.  The socket in question is an
ordinary TCP connection, and is the ONLY input filehandle in the script.

Can someone who DOES understand the subtleties behind this enlighten us,
so that we can fight with a LITTLE BIT of knowledge, rather than NONE?

Thanks in advance.


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

Date: Fri, 25 Jul 1997 09:18:07 +1000
From: Michael Yeung <michaely@hills.alphanet.net.au>
Subject: about text::template
Message-Id: <33D7E2AF.4BB57E54@hills.alphanet.net.au>

This is a multi-part message in MIME format.

--------------5B0B8C25835407E5A9E27B1
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

I have difficulties on using Text::Template !

I have created a template with HTML tags in a file attached below in
temp1.tmpl 

However, when I create a CGI file in order to use Text::Template to
print the template using print $template->fill_in(). The Perl code
emdeded in the  temp1.tmpl does not calculate anything. The CGI file is
also attached here ?

i will be appreciated if you can tell me what happens ! thanks

regards,
michaely

--------------5B0B8C25835407E5A9E27B1
Content-Type: text/plain; charset=us-ascii; name="tmplate.cgi"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="tmplate.cgi"

#!/usr/bin/perl

use strict;
use diagnostics;
use CGI;
use Text::Template;

my $m = new CGI;
print $m->header('text/html');

#my $file = "/usr/local/etc/httpd/htdocs/templates/temp1.tmp";
#$file =~ s|/\.\./|/|g;

# $m->param('keywords');
my $template = new Text::Template('type'=>'FILE', 'source'=>'/usr/local/etc/httpd/htdocs/templates/temp1.tmpl');

my $mike = $template->fill_in();
print $mike;




# print $m->start_html(-title=>'Template Test',
#                        -bgcolor=>'white');

# print "<center>";
# print "<img src='/icons/apache_pb.gif' width=200>";
# print "<h1> Welcome to Template Test </h1>";
# print "<font size=3><i>Everything is under construction ! On-Live Soon!# </i></f# ont>";

# print "</center>";
# print $m->end_html;


--------------5B0B8C25835407E5A9E27B1
Content-Type: text/html; charset=us-ascii; name="temp1.tmpl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="temp1.tmpl"

<BASE HREF="/usr/local/etc/httpd/htdocs/templates/temp1.tmpl">

<HTML>
<Head><title>WELCOME !</title></head>
{
my $time=`date`;
my $browser=$ENV{"HTTP_USER_AGENT"};
my $four = 2+2;
}
<body>
<p> Welcome to the site ! The time is now
{$time;}
</p>
<p> You are using {$four;} to view our site.</p>
</body>
</html>

--------------5B0B8C25835407E5A9E27B1--



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

Date: Thu, 24 Jul 1997 18:01:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Nik Trivedi <nik@ty.com>
Subject: Re: attack of little squares!  Help!
Message-Id: <Pine.GSO.3.96.970724144408.10589E-100000@kelly.teleport.com>

On Thu, 24 Jul 1997, Nik Trivedi wrote:

>    while(-f guestlock.lock){
>       select(undef,undef,undef,0.1);
>    }

That's a lousy way to lock files, for about umpteen reasons. I think you
could use the methods in Randal's fourth Web Techniques column, which
explains how to use flock() to avoid problems when multiple processes need
to modify one file. 

   http://www.stonehenge.com/merlyn/WebTechniques/

>    open(LOCK, ">guestlock.lock");

You must check the return value from every open. If you don't do it when
you write your script, at least do so before you post it! :-)

>    open (STORAGE2, "$filename") || die "Can't open $filename: $!\n";
>    flock (STORAGE2, 2);
>    @GUESTBOOKLINES=<STORAGE2>;
>    close (STORAGE2);
>    flock (STORAGE2, 8);

Never release the lock on a file. (But closing the file takes care of that
anyway, so it doesn't matter in this case.) 

>    open (STORAGE, ">$filename") || die "Can't open $filename: $!\n";

That's the same file. You should have opened it with write privileges in
the first place and just kept it open.

>    flock (STORAGE, 2);

You should know that during the time that the file was unlocked, another
process could have written different data to it than what you have in
memory. If you're updating a file, therefore, you should read _after_
locking.

>    print STORAGE "<b>$FORM{'comments'}</b><br>";   if ($FORM{'url'}) {
>       print STORAGE "\<a href=\"$FORM{'url'}\"\>$FORM{'userid'}\</a\>";
>    }
>    else {
>       print STORAGE "$FORM{'userid'}";
>    }

You don't have to backwhack angle brackets inside double quotes (or in
most other circumstances, for that matter), and you could use qq{} to keep
from having to backwhack all of those double quotes as well. 

>    $date = `$date_command +"%A, %B %d, %Y"`; chop($date);
>    $time = `$date_command +"%I:%M:%S %p (%Z)"`; chop($time);
>    print STORAGE " - $date at $time<hr>\n\n";

You could probably do with fewer sub-processes if you are willing to use a
different time format. (Or you could use a module.)

    $date = localtime;
    print STORAGE " - $date<hr>\n\n";

Oh, and instead of having to say 'print STORAGE' each time, you could use
select.

Well, I didn't see anything that should be making little squares. If you
can use the 'od' command on your system, maybe this command will help you
to identify what hex value corresponds to the little squares, so that we
can try to figure where they're coming from. 

    od -xc your_data_file | more

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 22 Jul 1997 23:19:29 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "M.Wright" <mw@cavmicro.com>
Subject: Re: CGI and SSI using PERL5
Message-Id: <Pine.GSO.3.96.970722231638.23134K-100000@kelly.teleport.com>

On Tue, 22 Jul 1997, M.Wright wrote:

> Does anyone know of any problems with using cookies with SSI? 

Lots of people do, and they hang out in the server newsgroups. (This is a
problem that Perl can't fix, because if Perl isn't getting the data from
the server, that's because the server isn't sending it.) Check the server
newsgroups, or their FAQs, and you'll find you'll get better answers to
your server questions than you're likely to find here. Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 22 Jul 1997 10:25:39 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Deleting all spaces at the beginning of a line.
Message-Id: <b.wilkinson-2207971025390001@ip57-york.pindar.co.uk>

In article <33C69B9A.E2D98BEF@homeaccount.com>, "Dana W. Edwards"
<dedwards@homeaccount.com> wrote:

> Hello!
> 
> I am having trouble deleting all the white space at the beginning of  a
> line of text.  How would I do this without chomping the rest of line?
> 
> Dana W. Edwards

If the line is in $line, then 

$line =~ s/^\s+//;

If the line is in the default variable, $_, then

s/^\s+//;

Bob

-- 
 .sig file on holiday


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

Date: Tue, 22 Jul 1997 18:13:19 -0400
From: Mark McDonald <mark@nhgir.nih.gov>
Subject: Formating text: changing the \n to a <P>
Message-Id: <33D5307F.41C6@nhgir.nih.gov>

Formating text: changing the \n to a <P> 

Here is a hard one that has me puzzled! I need to kake the text out of a
textarea re-format it to put a <P> where there is a line break. 


This means finding the lines that have no text and begin with a new
line.


I have tried sommany different things.


i.e  $text =~ s/^\n/<p>/go; # TO MATCH AT THE BEGINING OF 

     $text =~ s/\s{4}\n/<P>\n/g;


Anybody know anything thta might work?


Please mail me at mark@nhgri.nih.gov


Thanks

Mark McDonald


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

Date: 23 Jul 1997 01:11:33 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to call a package/method from a variable?
Message-Id: <5r3lo5$40n$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Philip Guenther <guenther@lunen.gac.edu> writes:
:To use a variable in a class name requires the run-time compilation of eval:
:
:	$object = eval "DIR::${package}->new()";

No, it doesn't.

    $object = "DIR::${package}"->new();

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
    double value;                /* or your money back! */
    short changed;               /* so triple your money back! */
            --Larry Wall in cons.c from the 4.0 perl source code


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

Date: 22 Jul 1997 13:14:20 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Mail Command ??
Message-Id: <01bc96a1$91a14e60$ca75e7c8@Term104>

Hi ! I did a Pelr script that contact a SMTP mail Server and send an e-mail
message...But, The administrator of the server where I've my Home Page tell
my this :

The mail command may be found at: 


/bin/mail


The sendmail command is located at: 


/usr/lib/sendmail

What Is he meaning with this ? I think that he want that I use this
command...But How Can I do this ?

Thanks,


-- 
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@usa.net
--------------------------------------------


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

Date: 24 Jul 1997 23:17:31 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: MakeMaker Module
Message-Id: <5r8nqb$bv0@fridge-nf0.shore.net>

Sergio Stateri Jr (serginho@alpha.hydra.com.br) wrote:
: Hi! When I try to install most of Perl modules that I get in CPAN, I
: receive the follow message :

You're probably using Perl 5.003 from Activeware which (as of build
306 to my recollection) did not have a complete implementation of 
MakeMaker.  You might try the 5.004_01 version from CPAN that includes
(working) pTk and MakeMaker modules.

Get it from: ftp://ftp.cdrom.com/pub/perl/CPAN/ports/nt/Gurusamy_Sarathy/perl5.00401-bindist02-bc.tar.gz

Hope this helps!

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Thu, 24 Jul 1997 18:21:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Sergio Stateri Jr <serginho@alpha.hydra.com.br>
Subject: Re: MakeMaker Module
Message-Id: <Pine.GSO.3.96.970724182059.25109G-100000@kelly.teleport.com>

On 24 Jul 1997, Sergio Stateri Jr wrote:

> I don't have the module MakeMaker.pm in my machine.
> Where can I find it ?

It comes with Perl, and has for quite some time. Install 5.004, though,
and you'll have it. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 21 Jul 1997 08:34:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mueller Beat <mueller@iwf.bepr.ethz.ch>
Subject: Re: newbie problem with $1
Message-Id: <Pine.GSO.3.96.970721082442.19811K-100000@kelly.teleport.com>

On 21 Jul 1997, Mueller Beat wrote:

> if (/((__.)+)/)
> {
>  s//<b>$1<\/b>/g;

This is not usually the recommended way to do this, since it forces Perl
to do the pattern match twice. Instead, you can use this kind of
construct.

    if (s#((__.)+)#<b>$1</b>#g) { ... }

> why does it exit with a segmentation fault ? 

The same reason any Perl script gets a segfault: It's a bug in Perl. :-)

> (btw, i am using perl 5.0)

Install 5.004, and you should be able to get it to work. If it still
segfaults, run perlbug to file a bug report. Thanks!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/




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

Date: Tue, 22 Jul 1997 10:39:52 -0700
From: Murray Stokely <murray@cdrom.com>
Subject: newsgroup archives?
Message-Id: <33D4F068.41C67EA6@127.0.0.1>

Are any of the perl newsgroups archived on any public ftp sites?  I
would like to get the last 400 megs of posts or so but I cannot find any
public sites that are archiving this group.  Please respond by email if
possible, or I might miss your reply.
-- 
Murray Stokely (murray-at-cdrom.com)


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

Date: 22 Jul 1997 17:52:07 GMT
From: "Noone Special" <jpm@iti-oh.comNOSPAM>
Subject: OLE
Message-Id: <01bc96c7$f24d45e0$36601ec6@bach>

Is there a good book for OLE in perl?

-- 
Josh,
Gavin Dragon...
Remove NOSPAM from address...




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

Date: Tue, 22 Jul 1997 22:54:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: daniel abrams <dabrams@mathcs.emory.edu>
Subject: Re: Please Help: Pattern Matching
Message-Id: <Pine.GSO.3.96.970722225128.23134E-100000@kelly.teleport.com>

On 22 Jul 1997, daniel abrams wrote about trouble getting a substitution
to work:

> Tried it, but no luck.  Also tried assigning the  "
> to a variable and every other way I could think of to
> trick the machine.  

Here's one you didn't try: Print the string before and after the
substitution. I think you'll find your problem that way. If not, save the
'before' string and use it to make a three-line test case to post here,
since without any code we can't do much to help you to debug this problem.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 22 Jul 1997 17:04:48 GMT
From: hughesj@westminster.ac.uk (Jonathan Hughes)
Subject: printing labels
Message-Id: <5r2p7g$4o6@badger.wmin.ac.uk>

I'm new to perl and cant get tab delimited address labels to print
Format:
hughes  hughes  address city    zip     United Kingdom  Type of infopac 



Here is script so far, :


#!/usr/bin/perl

$count=0;

while(<>) {
        chop;
        @data = split(/\t/,$_);
        $labels[$count] = \@data;
        @data = undef;
        $count++;
}

for $var (0..$count) {

print "$var - $count - $labels[0]->[1]\n";
#print <<EOF;
#$labels[$var][0]
#$$labels[$var][1]
#EOF

}



--
Jonathan Hughes - University of Westminster - http://www.bmss.wmin.ac.uk
+44(0)171 911 5000   Fx.+44(01)171 911 5175  London W1P 4DJ
--



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

Date: Thu, 24 Jul 1997 18:19:34 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Arielle Sumits <arielle@mit.edu>
Subject: Re: problem with perl homepage generator
Message-Id: <Pine.GSO.3.96.970724181350.25109E-100000@kelly.teleport.com>

On 24 Jul 1997, Arielle Sumits wrote:

> Thus there are seven inputs markes "link" and seven inputs marked "url".
> However, the perl script never seems to recognize these inputs as empty,
> and always prints "<h3>Links:</h3>" even if there are no links. Anyone
> have any idea why? 

>          print FILE "<h3>Links:</h3><ul type=square>\n";

I think it's that line, which (from a look at the code you posted) seems
to be executed unless something dies first. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 22 Jul 1997 18:21:28 -0400
From: theinz@interport.net
Subject: Programs related to this newgroup
Message-Id: <33D53268.5DB6@interport.net>

Programs related to this newgroup
can be found at:

http://www.sharewaredirectory.com


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

Date: 22 Jul 1997 18:42:36 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: prototyping subroutines...not working
Message-Id: <5r2uus$s28$1@news.fm.intel.com>

I have been trying to get a subroutine call to work without giving it an
empty argument, namely, to do this:

sub this {
	print "finally!";
}

this;
__END__

but it complains about not enough arguments.  of course, i know you can
prototype subs, so i try:

sub this () {...}

but it still doesnt work.  unless i do a:

this();
__END__

and yes, i am using v5.003.  it is on aix platform, if it matters.  i have
even tried a few other workarounds:

do this;
eval this;
__END__

but they dont want to work with the empty parens.  the point is to not
have to use the "&" or the parens.  i can live with "do this;" or "this;"
but not the extra fluff.
q(q-q: by the way, its important, and not just laziness :-)

thanks.

--
               "Give me ambiguity or give me something else."
 ______                       ______ _               _               
(_) |                        (_) |  | |             | |              
    | _   ,_    ,_              _|_ | |  _ _|_  __  | |     _   ,_   
  _ ||/  /  |  /  |  |   |     / | ||/  |/  |  /    |/ \   |/  /  |  
 (_/ |__/   |_/   |_/ \_/|/   (_/   |__/|__/|_/\___/|   |_/|__/   |_/
*+*+*+*+*+*+*+*+*+*+*+* /| *+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+* 
                        \|    tfletche@pcocd2.intel.com
*+*+*+*+*+*+*+*+*+*+*+*+*+*   www-fes.fm.intel.com/~tfletche   *+*+*+*+*+*+*




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

Date: 25 Jul 1997 01:21:26 GMT
From: trey@zipcon.net (Trey Valenta)
Subject: Re: questions re: a sendmail script
Message-Id: <869793713.837445@ran.zipcon.net>

In <33D75640.8C284711@games-online.com> mbosley <mbosley@games-online.com> writes:

>I am writing a script to parse a database and email people various information

>Would sending messages out in 'bulk' overload sendmail and possibly crash the
>system?  There will be between a 100 and 2000 messages sent at a time, about 4
>to 5 times per month.

Sendmail should take care of queueing on its own so you shouldn't have
to worry but if I am wrong I am sure someone will let me know.

>  open(BLARG,"/usr/...../sendmail -? -??? |");  print BLARG $message; (if that
>even works)

Almost... you have to pipe into sendmail so 
 open(BLARG, "| /usr/...../sendmail -? -??? ") || die......;

If your sysadmin (but I am my sysadmin) will help out, I would suggest
using an include file to your sendmail aliases file (/etc/aliases,
/etc/mail/aliases, somewhere) and include a file of e-mail addresses
(e.f. announce-l). Then run your script which will parse the database
information and refill this included file. That means you only have to
then do something like

	mush/mailx/mail/yourmailer -s "subject" announce-l < message.txt

I like the latter but your tastes will vary.

-Trey
--
Trey Valenta	trey@zipcon.net	 Seattle, WA



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

Date: Tue, 22 Jul 1997 10:28:48 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: Re-Flowing ASCII Text
Message-Id: <b.wilkinson-2207971028480001@ip57-york.pindar.co.uk>

In article <5qvhtc$3nt$1@nz12.rz.uni-karlsruhe.de>, s_haber@ira.uka.de
(Marc Haber) wrote:

> Hi!
> 
> I would like to have a perl program that takes a text file and
> re-flows it to some other line width while preserving paragraphs.
> Before writing it myself, I'd like to ask if this special kind of
> wheel already has been invented.
> 
> Any hints will be appreciated.
> 
> Greetings
> Marc
> 
> -- 
> -------------------------------------- !! No courtesy copies, please !! -----
> Marc Haber          |   " Questions are the         | s_haber@ira.uka.de
> Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
> Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29

Look at the module Text::Wrap

Bob

-- 
 .sig file on holiday


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

Date: 25 Jul 1997 01:10:22 GMT
From: trey@zipcon.net (Trey Valenta)
Subject: Re: Regex: Email address format
Message-Id: <869793049.432564@ran.zipcon.net>

In <33D568C4.A303E6@in.net> Mark Schwartz <mcs@in.net> writes:

>I have written a regex to verify data input to the 'Email Address' field
>of a form I have
>written.

>The regex is:

>if (($regdata{"Email Address"}) !~
>/^(?:[\w]+)\.?(?:[\w]*)\@(?:[\w]+)\.(?:[\w]+)(?:[\.][\w]+)*/) {
>	<--PRINT ERROR CODE, RE-SUBMIT FORM-->
>}

>Just for testing purposes, I have been using an '=' sign as my non-word
>character.

>Test address		Did regex work?
>mcs@in.net			Y		Valid
>m.cs@in.net			Y		Valid

>I also have educational clients who have email addresses that can have
>four to five sets of [period followed by word characters] following the
>'@' symbol.

First off, you are going to kick yourself for forgetting to anchor the
EOL.
     /^(?:[\w]+)\.?(?:[\w]*)\@(?:[\w]+)\.(?:[\w]+)(?:[\.][\w]+)*$/
                                                               ^^^

However, this will still miss some valid addresses (I think -- haven't
verified). '-' is a valid character for many addresses (like blah-l
mailing lists). If you really want to get messy,
	trey@goo.com@blah.com@foo.com
is technically valid as is
	dreadnought!trey@slsngsnl.com and I can't remember how %'s fit
into addresses when mailing to other networks. Fortunately, these are
rarely used except by people who enjoy making things harder for
themselves than need be.  (Raise you hand if that includes you --- hey! that's only about 74% of us!)

if t.y.u@add.com is valid, then /^\w+[\w\-\.@]+[\w\-]+\.\w+$/ might get
close, but that would still allow user@-----.com and I digress. And you
already know that probably.

Digressing even more, is ----.com a valid address? I know that the first
char is supposed to be a letter, but since Internic is registering
things like 2600.com, I like ----.com

I'm blabbering. I should go home.
-Trey
--
Trey Valenta	trey@zipcon.net	 Seattle, WA



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

Date: Wed, 23 Jul 1997 01:52:42 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Req help: Any easy way to CRC a file?
Message-Id: <ebohlmanEDr17v.C8I@netcom.com>

Steve_Kilbane@cegelecproj.co.uk wrote:
: [ Copy mailed ]

: In article <33d4b1ee.4384805@pub.news.uk.psi.net>, Brian@dkonline.com (Brian - DKOnline) writes:
: >There's probably a module
: > out there that will generate a Cyclic Redundancy Check number or
: > signature for a file if only I can find it.

: Perl's unpack has this built in. See the "%number" conversion.

That generates a 16-bit checksum, which may or may not be strong enough 
for the intended purpose.



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

Date: 22 Jul 1997 01:13:02 GMT
From: holt@puree.cs.byu.edu (Jason E Holt)
Subject: Shared memory variables
Message-Id: <5r11eu$gss@hamblin.math.byu.edu>

	How hard would it be to provide some sort of variable space in
Perl in which variables are kept in a shared memory segment and thus
kept accessable to children after a fork()?  I'd love to be able to
do something like:

local($foo, $bar);  # Please forgive, I'm still back in Perl4 land
shared($baz);       # Handle all that nasty SysV IPC stuff that we
		    # high-level coders don't like to deal with

if(fork()) {
	$baz = 'qux';
	print("Parent setting \$baz to: $baz\n");

} else {

	sleep 1;
	print("Child sees: $baz as the value of \$baz\n");
}

	Am I dreaming?  Seems like this would almost have to be done 
at the language level, since it has to do with the actual memory where
the data is stored.  But at that level it might not be too bad - just
an shmget() call instead of a malloc() (and a few dozen other things I
don't quite grok the difficulty of).  

					-J

					-J


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

Date: 25 Jul 1997 00:30:07 GMT
From: cybersalem@algorists.com (Jeffrey Kegler)
Subject: Shortcut to Expertise [Intel v. Randal Schwartz]
Message-Id: <5r8s2f$3qo@samba.rahul.net>


                    Letter from Cybersalem 9
                      Shortcut to Expertise
                        by Jeffrey Kegler


Lansford Hastings on the best route to California:

  "The most direct route, for the California emigrants, would
  be to leave the Oregon route, about two hundred miles east
  from Fort Hall; thence bearing west southwest, to the Salt
  lake; and thence continuing down to the bay of St. Francisco,
  by the route just described." [1]

It was based on this account that the Donner Party choose its
"shortcut" to California.

  "[The Donner Party and the other emigrants of 1846] read
  [Hasting's] light suggestion that a fine way to shorten the
  trip would be to try a route which Mr. Hastings had so far
  not bothered to try (and no one had yet broken), a possible
  cutoff from Fort Bridger (which Hastings had barely seen) to
  the southern end of Great Salt Lake and thence due west to
  Ogden's River (country about which Hastings knew nothing
  whatever).  The saving of several hundred miles seemed
  promising on a winter evening in the kitchen." [2]

Rich Cower qualifying himself as State's Expert before the court
in Oregon v. Schwartz:

  Judge Bonebrake: "Is it not possible that someone else would
  both have the knowledge of the facts of the case and the
  computer skills and knowledge to assist you without
  necessarily being a witness?  Isn't there someone else?  For
  instance, I know that Mr. Woodard is here.  He isn't listed
  as -- Mr. Woodard knows about the facts.  He's been involved
  all the way with counsel, hasn't he?"

  Tom Tintera (the prosecutor):  "I just spoke to Mr. Cower and
  he indicated to me that there is no one with his computer
  knowledge that's as familiar with the facts as he is and is
  able to assist.  That's my opinion also.  I did want to check
  with him." [3]

In any court case, the qualifications of an expert witness are
relevant.  They are especially so in Oregon v. Schwartz, where
the crime is technical and lacks many of the intuitive elements
in the notion of crime.  Add to this that the prosecution expert
was a material witness, worked for the alleged victim,
accompanied the police on the search, and sat beside the
prosecutor as his assistant throughout the trial.  The phrase
"relevant" hardly describes the situation.  Only those who want
to avoid examining the result of Oregon v. Schwartz will
unquestioningly accept Rich Cower's claim to expertise.

Rich Cower claimed two decades experience as a sysadmin and
systems programmer, prior to joining Intel.  He did not say on
what systems he gained his experience [4].  Whatever they were,
his programming and sysadmin skills seem not to have transfered
well to UNIX, the primary operating system in this case.  Cower
confused UID (user ID, the unique number assigned to every user)
and PID (process ID, the unique number assigned to every instance
of a program running) [5].  And in what is clearly prepared
testimony, he could not quite nail down what function the execute
bit performs in permissions for directories [6].  It is unlikely
Cower accomplished much in the way of UNIX systems programming.

When he started his 5 years with Intel, Cower had no training or
prior expertise in network security [7], but Internet security is
such a rapidly changing field this means very little.  More
significant would be what he learned on the job.  However, since
the publication of the first, still classic, book on Internet
security [8] went completely unnoticed by Cower, he can hardly
have been following the field very closely.  It is no surprise,
then, that Cower did not know what Intel's safeguards for
Internet access were at the time of the Randal "incident".
However, he did state he was sure there were some [9].

Randal was convicted of a felony for running the crack program.
Cower did not know the actual command name for crack [10] or
whether it sent email to users with bad passwords as an option or
automatically [11].  This did not prevent Cower from testifying
as an expert that the way in which Randal ran crack was
suspicious [12].

Cower's expertise on the fishiness of Randal's use of the various
tools, when hung up alongside his almost total lack of hands-on
knowledge of these same tools, often exudes a certain mackerel
smell itself.  It results at least once in a logical
impossibility, when Cower at one point claims to have read
Randal's Perl code, only a few days later to admit he knew no
Perl at all [13].

Cower's involvement in the investigation of and follow-up on the
Randal incident seems to have excluded everything that would
require technical skills.  He did not participate in the
examination of the files and materials seized in the search of
Randal's house [14].  Randal was indicted for running a gateway
which was last on Brillig, and cracking passwords on the machines
Wyeth and Snoopy.  Cower did not know how the router filters were
set up on Brillig's subnet [15].  (Unsurprisingly, if you recall
he had no idea of any of the safeguards for Internet access.)  On
Snoopy Cower had no account [16].  He was unaware of whether
Snoopy's backup tapes had been preserved [17].  He did not know
where Wyeth was physically [18].  Cower did not check the logs to
see if Randal had used any of the passwords he had cracked, or
who had done so, or whether anyone had done so [19].  Just about
all of the technical tasks there were to perform in the Randal
incident, we know Cower did not perform.  Under cross-
examination, Cower confirmed he was not one of the principal
people investigating Randal [20].

To determine how Cower beguiles the time when he is not sending
the real experts to jail, I studied those parts of the transcript
where he gives his job description.  According to these, Cower
wrote security policy, but neither had responsibility for, or
tracked, its implementation [21].

Even Cower's knowledge of security policy was narrowly focused.
He did not know if Intel had non-disclosure agreements with
employees and contractors [22].  And he believed that it required
a card to take a laptop out of Intel, but only because he himself
needed one for his own laptop [23].

On the other side, Cower displayed basic computer literacy and
had a user's knowledge of UNIX.  He claims authorship of Rich
Drawing, "a well known program in Intel for drawing foils in a
short period of time" [24].  And when others at the search of
Randal's house were alarmed to discover Randal's Apple Power Book
busy on the phone line, Cower was able to confirm that it was
executing a harmless and irrelevant download [25].  In the land
of the blind, the one-eyed man is king [26].

===========================================================

The Letters from Cybersalem are among the material at the "Intel
v. Randal Schwartz" Web site:
<URL:http://www.rahul.net/jeffrey/ovs/>.  The "Friends of Randal
Schwartz Web" site archives the material on all sides of this
issue, including the trial transcripts:
<URL:http://www.lightlink.com/fors>.

Of the many opportunities to do something, two head the list:

1.) To sign a letter objecting to Intel's role in this sorry
matter, see <URL:http://www.rahul.net/jeffrey/ovs/#todo>.

2.) To get an auto-reply giving Randal's own statement, and
discussing how you can contribute to his Legal Defense Fund, send
an empty message to <URL:mailto:fund@stonehenge.com>

Permission is granted to freely copy the Cybersalem Letters in
electronic form, or to print them for personal use.

===========================================================

Note 1:  Pages 137-138, _The Emigrant's Guide to Oregon and
California_, Applewood Book reprint of the 1845 edition.

Note 2:  Pp. 46-47, Bernard De Voto, _The Year of Decision:
1846_, Book of the Month Club, 1984.

Note 3:  Tr. 7-12-95
<URL:http://www.lightlink.com/fors/court/7-12-95.txt>, page 18,
line 22 to page 19, line 10.

Note 4:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 128,
line 13 to page 129, line 5.

Note 5:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 154,
line 25 to page 155, line 16; and the first paragraph in  Cower's
Report <URL:http://www.lightlink.com/fors/police/cower.txt>.

Note 6:  Tr. 7-24-95
<URL:http://www.lightlink.com/fors/court/7-24-95.txt>, page 30,
line 17 to page 31, line 20.  In this context it's more commonly
called the search bit.  Cower does not find this term but speaks
of it allowing one to "statistic" the directory, which may refer
to using the stat(2) call on it (in which case it is wrong), but
more likely is doublespeak.  The search bit controls the ability
to "cd" to a directory, which Cower does know, and to use it as
part of a path, which he does not mention.

Spafford and Garfinkel, _Unix Security_, the April 1992 printing,
pp. 72-73, is very good on this topic.  Still usually the best
way to a precise idea of how things work in UNIX is study of the
version 6 code, (_Lions' Commentary on UNIX 6th Ed._, 1996) and
this is not an exception.  From the cross reference listing,
follow "IEXEC".

Note 7:  Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 76,
lines 14 to 18; Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 128,
line 13 to page 129, line 5 and Tr. 7-24-95
<URL:http://www.lightlink.com/fors/court/7-24-95.txt>, page 48,
lines 14 to 23.

Note 8:  _Firewalls and Internet Security, Repelling the Wily
Hacker_, William Cheswick and Steven Bellovin.  See Cybersalem 8:
"What Does Familiar Mean?"
<URL:http://www.rahul.net/jeffrey/ovs/cs8.html>.

Note 9:  Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 110,
line 22 to page 112, line 8.

Note 10:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 155,
lines 17 to 24 and page 156, lines 4 to 9.

Note 11:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 144,
line 12 to 18.

Note 12:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 143,
line 21 to page 144, line 11.  Cower finds it suspicious that
Randal did not use the option to have "Nastygrams" emailed.
Knowing so little of crack, Cower was probably unaware that Alec
Muffet, its author, deprecates Nastygrams as offering a false
sense of security.  Nastygrams, incidentally, are probably so
called because the recipients are often irritated when told that
they have weak passwords.

Note 13:  Cybersalem 6: "Unlearn Perl in 41 Days!"
<URL:http://www.rahul.net/jeffrey/ovs/cs6.html>.

Note 14:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 152,
lines 13 to 20; and page 180, line 25 to page 181, line 14.

Note 15:  Tr. 7-24-95
<URL:http://www.lightlink.com/fors/court/7-24-95.txt>, page 41,
line 3 to page 43, line 1.

Note 16:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 152,
line 13 to page 153, line 5.

Note 17:  Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 108,
line 20 to page 109, line 9.

Note 18:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 186,
lines 6 to 10.

Note 19:  Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 93,
line 21 to page 94, line 7.

Note 20:  Tr. 7-24-95
<URL:http://www.lightlink.com/fors/court/7-24-95.txt>, page 48,
line 24 to page 49, line 7.

Note 21:  Tr. 9-20-94 PM
<URL:http://www.lightlink.com/fors/court/9-20-94p.txt>, page 98,
line 14 to page 99, line 5 and Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 75,
line 18 to page 76, line 9; page 76, line 19 to page 77, line 17;
and page 100, line 15 to page 102, line 4.

Note 22:  Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 84,
line 19 to 23.

Note 23:  Tr. 6-13-95
<URL:http://www.lightlink.com/fors/court/6-13-95.txt>, page 91,
line 12 to page 92, line 10.

Note 24:  Tr. 7-24-95
<URL:http://www.lightlink.com/fors/court/7-24-95.txt>, page 35,
line 7 to 10.

Note 25:  Tr. 7-18-95
<URL:http://www.lightlink.com/fors/court/7-18-95.txt>, page 135,
line 24 to page 136, line 7.

Note 26:  On the Web, you'll find this attributed to H.G. Wells
and Tom Waits, and presented in Gaelic as a folk saying.
According, however, to the _The Concise Oxford Dictionary of
Proverbs_, it is from Erasmus's _Adages_ of around 1500: "in
regione caecorum rex est luscus".


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

Date: Tue, 22 Jul 1997 23:32:37 -0400
From: "M.Wright" <mw@cavmicro.com>
Subject: SSI and Cookies
Message-Id: <33D57B55.65BC@cavmicro.com>

Does anyone know of any problems using Server Side Includes with
cookies?  I am NOT trying to set cookies with SSI, only read cookies
that were set using CGI's called by forms or URL's.

At present, I have never been able to successfully retrieve a cookie
within a SSI cgi.

Help!

Mike Wright
mpwright@esinet.net


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

Date: Thu, 24 Jul 1997 20:33:40 -0500
From: Anshul Dhir <dhir@cs.purdue.edu>
Subject: string length
Message-Id: <Pine.SOL.3.95.970724202619.14189B-100000@ector.cs.purdue.edu>



I am using dbmopen to store a hash in a file. But if the length of my key
text is very long, the program gives a fatal error " ndbm store returned
-1, errno 28" .

I guess it is because of the length of the key. How much actually is the
maximum key length?
Also,
I have a scaler containing a string and would like to find the length of
that string. If the length is more than 256 i would like to cut it to 256.

thanks,
anshul



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

Date: Thu, 24 Jul 1997 18:11:12 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: David Millier <DavidX_J_Millier@ccm.co.intel.com>
Subject: Re: String matching.. HELP!! :)
Message-Id: <Pine.GSO.3.96.970724180557.25109D-100000@kelly.teleport.com>

On Thu, 24 Jul 1997, David Millier wrote:

> Problem is i cant get it to match anything not on the first line...
> even using multi line string matching.. 

> Heres the string im trying to match with:

> $line =~ /\|$dir\|.*\|/im

I think you want the dot in .* to match a newline character. If that's
right, you don't want /m, which does nothing in that expression anyway. 
(/m only changes the effects of the special ^ and $ tokens in a regexp.) 
Check the docs to be sure, but I think you want /s instead of /m. Hope
this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

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 775
*************************************

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