[6770] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 395 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 30 00:07:15 1997

Date: Tue, 29 Apr 97 21: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           Tue, 29 Apr 1997     Volume: 8 Number: 395

Today's topics:
     Anybody have some perl usage of mmap() fragments? (Jaye Mathisen)
     Best way to read from STDIN twice? <dfan@thecia.net>
     Decoding CyberSitter in 1 line - but how long a line? (Jamie McCarthy)
     Re: Die problem (Tad McClellan)
     Re: Elementary file opening question (Tad McClellan)
     Re: Executing htpasswd from within Perl (brian d foy)
     Re: Extracting all links from HTML? (Tad McClellan)
     Re: Extracting pseudo HTML from string (Tad McClellan)
     Re: file copy (Adam M. Donahue)
     Re: getopts (Nathan V. Patwardhan)
     Help with compiling 5.003 on SCO-3.2v4.2 (Chetan Muni)
     Help! Lady in distress! Need help with CGI script, befo (Tech-Style)
     How to join 2 different files togheter <marco@tecnogi.mdnet.it>
     Re: Multi line matching problem. Should be simple?!? <dbenhur@egames.com>
     Re: Need URL Encode and Decode Functions (brian d foy)
     Re: Notice to antispammers <rra@stanford.edu>
     Re: Notice to antispammers (Billy Chambless)
     Re: Object IDs are good ( was: Object IDs are bad ) (Andrew Bromage)
     Re: OOP & perl (Richard S. Smith)
     Re: Ousterhout and Tcl lost the plot with latest paper (Arturo Prez)
     perl script producing html with problems under netscape <josephn@mail.mcoe.k12.ca.us>
     Re: perl script producing html with problems under nets (Geoffrey Hebert)
     perl5.003 & SGI <tziem@netaxis.com>
     Re: pre-RFD: comp.lang.perl.{data-structure,inter-proce (Tad McClellan)
     Re: Problem with CGI form processing (brian d foy)
     Re: problem: array assignment to hashref slice <rootbeer@teleport.com>
     question: how to trim a string passed via hard referenc (Terrence M. Brannon)
     Re: shtml extension from perl? (Geoffrey Hebert)
     split returns erroneous value on a line beginning with  (Terrence M. Brannon)
     Re: Turn array into hash then import into another names <dbenhur@egames.com>
     WWW page mirroring with PERL? (Luke Brennan)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 Apr 1997 18:39:11 GMT
From: mrcpu@schizo.cdsnet.net (Jaye Mathisen)
Subject: Anybody have some perl usage of mmap() fragments?
Message-Id: <5k5f8f$97$1@news-1.meganews.com>


Never used it in C before, but have what I think is a need for it for some data
sharing/IPC work.

However, there's no perldoc mmap, nothing in perlfunc, and nothing labeled MMAP
in CPAN that I could see in the module dir list.


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

Date: 29 Apr 1997 23:45:00 -0400
From: Dan Schmidt <dfan@thecia.net>
Subject: Best way to read from STDIN twice?
Message-Id: <877mhli37n.fsf@razumovsky.thecia.net>

I am writing a filter in Perl that makes two passes over its input.
For external reasons it must read from STDIN and write to STDOUT.  In
order to reset for the second pass through the input, I first tried
just doing a 'seek (STDIN, 0, 0)', which I thought wouldn't work, but
it did.

That was on Windows 95.  Under Linux, it doesn't work (after the call
to seek(), I get no further input).  Actually, it does work if input
is coming from a file, but not if it's coming from a pipe.

My guess is that Windows 95 doesn't support "real" pipes, and fakes
them by temporary files; thus I always get the "file case", which
works.

Here's a little program that exhibits the behavior I'm talking about.
If I call it 'out', then 'out < out' prints itself twice, but 'ls |
out' only prints the directory once.

  #!/usr/bin/perl
  print while (<>);
  seek (STDIN, 0, 0);
  print while (<>);

What I'm wondering is, what is the approved way to read STDIN twice?
The two straightforward things I could do are to 1) slurp the whole
file into an array, but I'd like to not waste any more space than
necessary, and 2) copy STDIN to a file, then operate on that, which
seems wasteful, as much of the time STDIN may actually already be a
file.

I've looked through the online docs, the blue Camel, and the FAQ.  If
the answer is there and I've missed it, I sincerely apologize.

Thanks in advance for any replies.

-- 
                   Dan Schmidt --> dfan@alum.mit.edu, dfan@thecia.net
Honest Bob & the                   http://www.users.thecia.net/users/dfan/
  Factory-to-Dealer Incentives --> http://www.users.thecia.net/users/dfan/hbob/
            Gamelan Galak Tika --> http://web.mit.edu/galak-tika/www/


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

Date: Tue, 29 Apr 1997 23:50:04 -0400
From: jamie@voyager.net (Jamie McCarthy)
Subject: Decoding CyberSitter in 1 line - but how long a line?
Message-Id: <jamie-2904972350040001@clmx24.dial.voyager.net>

Can you beat this?

   perl -lne '$,=$/;print grep/.{5}/,split/[^ ,-9A-}]+/,$_^="\224"x length'




Some of you may be familiar with CyberSitter.  If not, you might want
to visit http://www.solidoak.com/ and maybe http://www.peacefire.org/
to see what it's all about.

Basically, it's a program that allows parents, teachers, et al. to block
what their children see.  However, the software's database of blocked
words and phrases is "encrypted," ostensibly to protect the company's
proprietary information.  Nobody is supposed to know what exactly the
company is stopping you from seeing.  This has upset a number of people
who have learned that CyberSitter blocks e.g. the National Organization
of Women's web site on the grounds that it is sexually-related.

It also happens to block an excellent collection of webpages called The
Auschwitz Alphabet, simply because the site at which they were
originally housed put up a webpage that described CyberSitter in less
than glowing terms.  To make this useful resource available to
schoolchildren who may be forced to use CyberSitter, the Alphabet is now
mirrored at a site I maintain, <http://www.nizkor.org/features/alphabet/>.

I put the word "encrypted" in quotes, above, because here's the decryption
algorithm for the secret database, as described by Bennett Haselton:

   The filter file codebreaker just XOR's every character with 0x94 and
   extracts all strings that are more than 4 printable characters long.

Not much of an encryption scheme!

Mr. Haselton wrote a program in C to execute this algorithm and made it
publicly available;  shortly thereafter, he was sent a letter by
certified mail, from Solid Oak, stating that:

   This program illegally modifies and decodes data and source code
   protected by U.S. and International intellectual property laws.

   This program performs this action without permission of the
   copyright owner. We demand that this program be removed
   immediately.

Full text of that letter is at
<http://www.peacefire.org/archives/SOS.letters/bm.2.bh.4.24.97.txt>.

I am trying to determine exactly how short of a program can be written,
such that Solid Oak will assert an illegal violation of their
intellectual property.  Their encryption scheme is approximately as
difficult as ROT13.  Decryption can be squeezed into one line.  Will they
sue me over a one-line program?  We'll see.

The current shortest candidate to implement Mr. Haselton's algorithm, as
described in English above, is:

   perl -lne '$,=$/;print grep/.{5}/,split/[^ ,-9A-}]+/,$_^="\224"x length' cywin0.opt >cywin0.txt

("cywin0.opt" is the name of the CyberSitter database.)

By the way, that is Seth Finkelstein's improvement on an effort I made a
week ago that was almost 20 chars longer!

The question is, can anyone do better than this?

Improvements will be added to the source code repository at
<http://www.nizkor.org/ftp.cgi/miscellany/censorship/cybersitter/csdecode.pl>.

Please email me submissions and indicate whether you would like to
remain anonymous or not.  Thanks.  No prizes for the winner, sorry.

It may be tough to test your guesses, because Solid Oak is apparently
trying to make it difficult to obtain the cywin0.opt database file.  I
was able to download this copyrighted-but-free database without
downloading the entire CyberSitter package and having to click to accept
a software license.  You may not be so lucky.  Feel free to look around
ftp.solidoak.com and acorn.solidoak.com, though.  If you do download the
whole CyberSitter package, please read carefully any license which you
may accept.

Posted to comp.lang.perl.misc;  emailed to Bennett Haselton
<bennett@peacefire.org>, Seth Finkelstein <sethf@mit.edu>, and the
president of Solid Oak, Brian Milburn <bmilburn@solidoak.com>.  Bcc'd to
a number of friends and colleagues.  In this posting, and in general
unless otherwise specified, I am speaking for myself only, and not for
the Nizkor Project or any other organization with which I'm affiliated.
-- 
 Jamie McCarthy          http://www.absence.prismatix.com/jamie/
 jamie@nizkor.org     Director of Operations, The Nizkor Project
                                          http://www.nizkor.org/


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

Date: Tue, 29 Apr 1997 19:57:15 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Die problem
Message-Id: <bd56k5.su9.ln@localhost>

Bill Blohm (bblohm@boi.hp.com) wrote:
: I'm running Perl 5.001m. I wrote a small (very!) Perl program
: to simply replace LF with LF/CR on each line of the input file,
: and to save the original as <filename>.old.  The original program,
: listed below, works fine: 

:      #!/usr/local/bin/perl -pi.old
:      s/\n/\n\r/g;

: Once I had this working, I handed it off to the user that requested
: the program. A few days later he came back, admitted he'd forgotten
: how to use it, and asked how to use it. I explained how, and decided
: to put a usage clue in there for anyone else that wanted to use it,
: (or this user if he forgot again). That's when my problems started.

: I added the die line as shown below, and then found out several
: things:

:      #!/usr/local/bin/perl -pi.old
:      die "Usage: cradd <filename>\n" if @ARGV < 1;
:      s/\n/\n\r/g;

: If it matters, there's a blank line between each line in the real
: file.


It doesn't matter.


: My problem was that with the die line, the above would essentially
: hang. That is, it wouldn't come back to the prompt, wouldn't run.
: I found out that if I remove the -pi.old, then it would properly
                        ^^^^^^^^^^^^^^^^^^

So, either -i or -p is giving you problems...


: prompt the user with how to use it, and quit if he didn't provide
: a file name. BUT it wouldn't execute the last line if he did 
: provide a file name as a parameter. If I remove just the i.old,
: leaving the -p, then it just hangs as when I'd first added the
  ^^^^^^^^^^^^^^

So, looks like -p is the culprit...


: die line. If I just remove the p, leaving -i.old, then again it
: does nothing but does return. No changes to the file, no file with
: the .old extension.

: I've been to http://www.perl.com/perl 

Good. Thank you.

This is the third place to look.


: and gone thru the FAQs, I've

Also good. Thanks again.

This is the second place to look.

: got the O'Reilly "Programming perl" book (Purple Camel?) and have
: gone thru that. 

Good again ;-)

This is the fourth place to look.

: I've been digging around in the man pages. I admit
                                  ^^^^^^^^^

Bingo!

This is the first place to look!

But where to look in the over 400 pages worth of man pages?


: it. I'm missing something somewhere in all this documentation.

perlrun describes perl's command line switches (such as our suspect -p)


: What's going wrong here? What am I missing?
                           ^^^^^^^^^^^^^^^^^

This:

----------------------
=item B<-p>

causes Perl to assume the following loop around your script, which
makes it iterate over filename arguments somewhat like B<sed>:


    while (<>) {
        ...             # your script goes here
    } continue {
        print;
    }

Note that the lines are printed automatically.  To suppress printing
use the B<-n> switch.  A B<-p> overrides a B<-n> switch.

C<BEGIN> and C<END> blocks may be used to capture control before or after
the implicit loop, just as in awk.
----------------------

Note, particularly, that last paragraph.


#!/usr/local/bin/perl -pi.old
BEGIN {die "Usage: cradd <filename>\n" if @ARGV < 1;}
s/\n/\n\r/g;


Ta da!


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 29 Apr 1997 20:10:13 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Elementary file opening question
Message-Id: <l566k5.p0a.ln@localhost>


al chase (alchase@iadfw.net) wrote:
: If I run the following as http://localhost/cgi-bin/test.pl it produces
: only the header and by viewing document source it is evident that
: verything between the open and close statements has been skipped.

: However, if I run it in dos as
:     perl test.pl > test.htm
: and then run test.htm from netscape gold 3.0, it displays the contents
: f the file as expected.  I am using WebSite and the script is a
: simplification of one on p 84 of "cgi primer plus for windows"

: What am I doing wrong?
  ^^^^^^^^^^^^^^^^^^^^^

You are not following the advice of the Perl autoFAQ.

Did you get one? It is expected that you actually read it you know.

This is why the autoFAQ was set up. To forstall getting the same
question for the two hundredth time.

We grow weary after answering the same question only a hundred times...

Low tolerance, I guess.


---------------
4. Are you checking the return values from the functions built in to
perl?  Most of the file and system functions set $! and have return
values that you can test thus:
        open(PASSWD, "</etc/passwd") or
                die "error opening /etc/passwd: $!\n";
$! will contain an error message that will give you more information
on where your program is going wrong.  The perlfunc man page will give
you more information on the return values from functions.
---------------


: Thanks in advance,

Uh huh.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 29 Apr 1997 20:42:25 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Executing htpasswd from within Perl
Message-Id: <comdog-2904972042250001@nntp.netcruiser>

In article <3366660F.50126741@foodtrak.com>, Gary Nichols
<garyn@foodtrak.com> wrote:

> Currently, to update my webserver's Apache password file (.passwordfile)
> I am manually executing:
> 
> htpasswd .passwordfile username
> (password)
> (password again for verification)
> 
> I'd like to be able to do this thru a perl script that I could feed
> variables from a web-based form.
> 
> My problem is: how in Perl would I execute htpasswd on a username and
> feed it the password twice?

why go through all of that trouble?  it's not as if htpasswd really
does all that much.  just rewrite it in perl :)  the c source to
htpasswd comes with the apache distribution.

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: Tue, 29 Apr 1997 20:18:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Extracting all links from HTML?
Message-Id: <vk66k5.b2a.ln@localhost>

David_D._Jones@hud.gov wrote:
: I'm trying to to extract extract all links to *.html, *.gif, and *.jpg
: file on my website.  I'm using libwww v5.08 to parse the files and
: extract the links.  The folowing code works examing all the files and
: extracting all the links.  The only problem is I also want all the path
: names to be resolved into absolute paths.  I'm stuck...I'm not sure
: exactly how to go about doing this, any suggestion?
                                          ^^^^^^^^^^

searching c.l.p.m for 'absolute path' at http://www.dejanews.com

( I expect you have heard of Dejanews? It is a great service.
  become familiar with it  ;-)


finds 345 hits.

I'll betcha there's an answer in there somewhere

( I found two in three minutes of looking...)



: use HTML::TreeBuilder;
: $h = new HTML::TreeBuilder;
: foreach $file (@files) {
:     $h->parse_file($file);
:     for (@{ $h->extract_links(qw(A IMG)) }) {
:         ($link, $linkelem) = @$_;
:         print "<$link>\n";
:     }
: }


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 29 Apr 1997 19:25:36 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Extracting pseudo HTML from string
Message-Id: <0i36k5.fq9.ln@localhost>

Matthew Cravit (mcravit@shell3.ba.best.com) wrote:
: In article <5k4v78$52h@intra.icma.org>,
: Todd Wallace <twallace@nicom.com> wrote:
: >
: >I have a string that looks like 
: >"asdfafasdf<FNAME>Tom</FNAME>sdfsdfsfsd"
: >and I want to extract the text between the <FNAME> and </FNAME> tags.

: Regular expressions are your friend here. :) The following code will
: do what you are asking. (And, yes, I know, there's probably several more
: compact ways of writing it, but this way it's (at least, I think) clear 
: what is going on:

: 	#!/usr/bin/perl
: 	$string = "asdfafasdf<FNAME>Tom</FNAME>sdfsdfsfsd";
: 	if ($string =~ /<FNAME>(.*)<\/FNAME>/)


if ($string =~ m#<FNAME>(.*?)</FNAME>#)
               ^^          ^  ^      ^

I offer two refinements:

1) use an alternate pattern delimiter, then you won't need to
   backslash the slashes.

2) use non-greedy matching here in case $string has more than one </FNAME>
   in it.


: 	{
: 	        $result = $1;
: 	}
: 	print "Result: $result\n" if $result;


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 29 Apr 1997 18:04:52 GMT
From: donahue@acf2.nyu.edu (Adam M. Donahue)
Subject: Re: file copy
Message-Id: <5k5d84$d7r$1@news.nyu.edu>

Becky Schonfeld (rebecc60@pobox.upenn.edu) wrote:
: $records=0;
: open(IN, "$A") || die "cannot open $A for reading";
: open(OUT, ">$B") || die "cannot create $B";
: while (<IN>){
: if ($records != $break){
: print OUT $_;}
: $records++;
: }

$records should probably be $_, since you're comparing the input file to
line $break.  

-- 
<> Adam Donahue
<> Distributed Computing & Information Services
<> New York University
<> 212-998-3100
<> mailto:adam.donahue@nyu.edu



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

Date: 30 Apr 1997 02:02:06 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: getopts
Message-Id: <5k696u$j8u@fridge-nf0.shore.net>

Tomoo Taguchi (tomoo@sdd.hp.com) wrote:

:     require 'getopts.pl'

: My script runs, but everything that I saved using ()'s in pattern
: matiching substitution seems to get turned to nulls.

Please post some code.  Why aren't you using Getopt::Std or Getopt::Long,
which will make your life easier?

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 30 Apr 1997 01:54:27 GMT
From: chetan@chetan.tiac.net (Chetan Muni)
Subject: Help with compiling 5.003 on SCO-3.2v4.2
Message-Id: <5k68oj$ia9@news-central.tiac.net>
Keywords: perl5.003 SCO 3.2v4.2

Hi,
Has someone out there compiled perl5.003 for SCO3.2v4.2?
I tried it with gcc2.7.2 and Configure complained something
like "WHOA there, gcc doesn't seem to work..."

So tried with the native cc.  Miniperl fails to build with a
link error:
    Unresolved symbols:
	Perl_chsize in libperl.a
(Don't have the verbatim error message.)

Any help with compiling perl503 or pointers to pre-built
binaries is greatly appreciated.

Thanks in advance,
-Chetan.
============================================================
=                                                          =
=       "There are no facts, only interpretations."        =
=                                                          =
============================================================


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

Date: Tue, 29 Apr 1997 20:18:04 GMT
From: tech@pyramid.net (Tech-Style)
Subject: Help! Lady in distress! Need help with CGI script, before brain explodes!!!
Message-Id: <5k5ksd$pph3@cirrus.pyramid.net>

I've been trying to figure out how to write a PERL script to handle
password access to my site. I want to give each user their own name
and password (they could choose each themself), which would
automatically expire after either 30 or 90 days. What REALLY concerns
me is if I have three levels to my site, I don't want someone to have
to use a password at level one and then just be able to "Bookmark" a
level three page and "drop in" without having to enter a password.

I've looked at Matt's script Archive, Selena Sol's Archive and various
books with no luck! Could someone please help me? I feel so blonde!


Please reply here or directly to my e-mail: lisa@pyramid.net


Thanks!

Lisa




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

Date: Tue, 29 Apr 1997 22:01:22 +0200
From: Marco Giardini <marco@tecnogi.mdnet.it>
Subject: How to join 2 different files togheter
Message-Id: <33665392.17332CBD@tecnogi.mdnet.it>

I have 2 differnet files with the same number of rows and I want to
join them togheter in order to get only one file that will have for each
row the "sum" of the rows of the single file.

I.E.
file1
a
b
c
d
e

file2
1
2
3
4
5

the result i need is something like:
file RESULT
a 1
b 2
c 3
d 4
e 5

How can i get the combined file using Perl?
What is the right sintax to produce a third file (RESULT) so combined as
mentioned above?
Please note that i;m quite new to Perl .....
Thanks to everybody will give ma an help mailing me to
marco@tecnogi.com or giardini@telnetwork.it

Thanks again

Marco
-- 
//////////////////////////////////////////////////////////////////////
 It's better to lose a few beans from your bag that have no bag for your
beans    
    OOoooo......DREAMING ........
 
      `:::'                  .......  ......
       :::  *                  `::.    ::'
       ::: .::  .:.::.  .:: .::  `::. :'
       :::  ::   ::  ::  ::  ::    :::.
       ::: .::. .::  ::.  `::::. .:'  ::.
      .:::.....................::'   .::::..
 
 Marco Giardini
 marco@tecnogi.com
 http://www.tecnogi.com/marco/
/////////////////////////////////////////////////////////////////////


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

Date: Tue, 29 Apr 1997 19:14:22 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: Pascal Houde <houde@fox.cisti.nrc.ca>
Subject: Re: Multi line matching problem. Should be simple?!?
Message-Id: <3366AAFE.676C@egames.com>

[mail&post]
David Alan Black wrote:
> Pascal Houde <houde@fox.cisti.nrc.ca> writes:
> >Here's a small example of what I want to do:
> 
> >$var="some\nthing"
> >$var =~ s/something/blablabla/;
> >print $var; # which would print blablabla
> 
> >But this doesn't work even if I specify $*=1 and/or $/ =""
> 
> >I don't want to do something like:
> >$var =~ s/some\nthing/blablabla/; or $var =~ s/so.*ing/blablabla/s;
> >because I never know where the word is cut by a new line and
> >I want an accurate search. (so forget about the "." trick and /s)
> 
> Perhaps:
> 
> $var = "some\nthing something else";
> $var =~ s/some\n?thing/blablabla/gs;
> 
> even though it uses the dreaded s///s.... :-)

But he says he doesn't know where the line break might be,
so here's a more complete solution:

sub replace_ignoring_nl {
  my ($str,$find,$replace) = @_;
  $find = join("\n?", map( quotemeta $_, split(//,$find) ) );
  $str =~ s/$find/$replace/g;
  return $str;
}

$var = replace_ignoring_nl($var,"something","blablabla");

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"No, I'm not going to explain it. If you can't figure it out, 
 you didn't want to know anyway..." --Larry Wall



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

Date: Tue, 29 Apr 1997 20:39:22 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Need URL Encode and Decode Functions
Message-Id: <comdog-2904972039220001@nntp.netcruiser>

In article <336627BC.ABD692B0@db.com>, micah@db.com wrote:

> Does anyone know where I can get the functions that encode and
> decode URL's ? (im new to perl btw)

you'll want to get the URI module from CPAN [1].  it comes with
documentation and examples.  since you are new, you'll want to
poke around CPAN to discover what's available there :)

[1]
CPAN - Comprehensie Perl Archive Network.  find one through
<URL:http://www.yahoo.com>

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: 29 Apr 1997 16:57:16 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Notice to antispammers
Message-Id: <qum7mhl9ycj.fsf@cyclone.stanford.edu>


Rajappa Iyer <rsi@lucent.com> writes:

> Sure... and if all Tom said was "This really pisses me off" I would have
> no argument. But when he threatens to hand addresses on a platter for
> spambots to harvest, he oversteps a line.

E-mail addresses are not private property, secret information, or secure.
I'm sorry if you were under this mistaken impression, but you're going to
be butting heads with a lot of people until you realize this.

There are a variety of solutions to e-mail spam.  Munging your address in
posts isn't one of the better of them.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: 30 Apr 1997 00:32:07 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: Notice to antispammers
Message-Id: <5k63u7$rtg$1@NNTP.MsState.Edu>

In article <33663CE8.4F60@writeme.com>, Paul Ramsey <togtog@writeme.com> writes:

|> > outweighs the inconvenience to legitimate users, and they have
|> > decided on this without regard to the legitimate users.
 
|> I for one, think Tom is an asshole. I have an unlisted phone number, why

I'm starting a Web page of people who think Tom is an asshole.
And a page of people who think Tom is cool.
And a page pf people who think that people who think Tom is an asshole
    are assholes.
And a page of people who think that people who think Tom is an asshole
are cool...
And....

Personally, I LOOOOVE unsolicited commercial email -- it gives me
somebody to be rude to first thing in the morning at work while I'm
drinking my coffee.

--
*    "We all agree on the necessity of compromise.  We just can't agree on
*     when it's necessary to compromise."
*                --Larry Wall in  <1991Nov13.194420.28091@netlabs.com>



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

Date: 30 Apr 1997 11:29:40 +1000
From: bromage@cs.mu.OZ.AU (Andrew Bromage)
Subject: Re: Object IDs are good ( was: Object IDs are bad )
Message-Id: <5k67a4$nit@mulga.cs.mu.OZ.AU>


G'day all.

doylep@ecf.toronto.edu (Patrick Doyle) writes:

>  Can you give an example of two immutable objects, alike in every way,
>which need to be distinguished?

They may need to be distinguished for the purpose of compile-time
garbage collection.  If you create two immutable identical objects,
it may be easier to discover when they become garbage because the
references to them are unique, than if they were one object with
a shared reference.

Admittedly the programmer does not necessarily need to see this.

Cheers,
Andrew Bromage


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

Date: Wed, 30 Apr 1997 02:26:35 GMT
From: rsmith@netcom.com (Richard S. Smith)
Subject: Re: OOP & perl
Message-Id: <rsmithE9FIsB.4zy@netcom.com>

Jay Flaherty (fty@hickory.engr.utk.edu) wrote:
> I am not saying there is a conspiracy here but if you are a
> "renowned Perl hacker", I would lay low for awhile :-)

Maybe that's why Larry hasn't posted on c.l.p.m (or anywhere else on
usenet) in the past year or so.

Tom Christiansen (tchrist@mox.perl.com) wrote:
> If I had three days free, I could fix it all.  But I don't, and I'm not
> going to.  I cannot begin to have the time in my life right now to do any
> web maintenance.  In the next 6-8 weeks, I have publisher's deadlines for
> one existing book to update, another one to write from scratch, plus three
> books to tech-edit, and to top it off I have a bogus 7-figure nuisance
> lawsuit to try to get dismissed.

Ick...  Does this have anything to do with the nasty review you gave to
that "Perl 5.0 CGI Web Pages for WindowsNT" book?  ;-)

Seriously, though.  Last weekend there was a bunch of media hype surrouding
President Clinton, Colin Powell, George Bush, and Jimmy Carter encouraging
everyone to get out there and volunteer in their communities.

Funny how no one even mentioned how much the Internet has depended (and
still does) on people like Tom.  So Tom, in case no one else has done so
lately, I just want to say, "thank you".

Later...

--
+--------------------------------------------------------------------+
| Richard S. Smith / rsmith@netcom.com / http://www.captech.com/~rss |
| Progress(tm) 4gl v[678] Developer/DBA / Los Gatos, California, USA | 
| The PROGRESS FAQ --> http://www.captech.com/~rss/progress-faq.html |
+--------------------------------------------------------------------+


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

Date: Tue, 29 Apr 1997 22:26:52 -0500
From: perez@acm.org (Arturo Prez)
Subject: Re: Ousterhout and Tcl lost the plot with latest paper
Message-Id: <AF8C262C966811127@ppp233.itw.com>

In article <MPG.dc83ab56b77580498979b@news.demon.co.uk>,
cyber_surfer@gubbish.wildcard.demon.co.uk (Cyber Surfer) wrote:

>With a mighty <AF837FB99668DC55@ppp131.itw.com>,
>perez@acm.org uttered these wise words...
>
>> Apple, as usual, addressed this problem several years ago.  It's called
>> OSA (I think it stands for Open Scripting Architecture).
>
>Excellent. I guess I missed it coz I'm not a Mac developer. Since it 
>has some relevance to this thread, I wonder how it compares with Tcl?

There's all kinds of ways to look at this comparison.  If we go back to
the creating a button comparison then AppleScript loses because it is
extremely verbose.  This is a typical snippet (syntax not guaranteed 100%)

     repeat with w in {every word of every paragraph of window 1}
          set the first character of w to 'T'
     end repeat

On the other hand you can do exactly the same thing from MacPerl (I've
heard) so the syntax then acquires Perl's economy of expression.  I would
also expect that Macintosh Common Lisp does OSA.  I know that the GNU emacs
that runs on Mac also does OSA - I used it to get compilation errors from
CodeWarrior and parse them using the 'next-error' capabilities of emacs.

OSA is a strange hybrid of a thing.  The closest analogy to it that I've
seen in the Unix world is Xt actions.  If you could envision a way of
activating Xt actions via some IPC mechanism.  I'm not a windows guy but
the people I know who are agree that windows has _nothing_ comparable to
OSA.  It's another thing that keeps publishers on Macs.

In a nutshell (in case you're not familiar with Xtactions), the application
developer determines what capabilities a scripter might require.  This is
called "factoring."  The idea is, rather than allow the scripter to
activate GUI elements such as pushing buttons or selecting menu items,
allow the scripter to perform sensible operations. I've spent quite some
time scripting CodeWarrior so I'll use that as an example.  In CodeWarrior,
the Mac IDE, you have commands Make Project, Remove Binaries, Set
Preferences of ___ to ___.  Some of these correspond to menu items and some
of them don't.  One that doesn't is "Save Error Window to file."  There's
no corresponding menu item for it but the CW developers added it because it
was a sensible operation.

Let's define driving an application.  Under Unix you typically drive an
application by opening a pipe to it and feeding it the commands that you
would type at it because most Unix things are keyboard-driven.  This is the
entire paradigm behind expect.  So, when you drive ed you feed it a string
of cryptic one character commands.  You must get the command exactly right
because errorchecking is extremely difficult (although expect does make
this easier).  And, of course, every utility/tool has a completely
different command set.  So, you must know the "API" to awk,ed,sed,ls etc to
build fully functional glued together things.  And you have no way to
control GUIs - they don't tend to be able to read from pipes.  And GUIs
don't tend to have command languages anyway.

Tcl is just a better way of driving than the Bourne shell.  If you embed
Tcl into your apps then you could do TkSends I suppose.  But you have no
way of determining what are legal commands to Tksend.  And, in general, I
haven't seen people use Tcl to express operations the way that
OSA/AppleScript does.

With AppleScript (the Script Editor, in fact) you can query the application
for what AppleEvent's it accepts and it gives you the syntax for activating
them.  Whenever you execute a statement you get the results of that
statement.  It's more of a dialogue with the application then you tend to
see with Tcl.

And the best thing is:  your standard apps already do it.  Quark Express,
CodeWarrior, Filemaker Pro, etc all support it.  So you can use your
current favorite word processor to automatically process words.  With Tcl
you tend to have to get a new word processor that was written in Tcl.

On the downside, I think AppleScript is slower than Tcl.

>
>> You have your choice of syntaxes (Perl, AppleScript or Frontier are 
>> available or you can make your own).  You can do it from C (but man! 
>> does that hurt from what I hear).
>
>Even better. Is it possible to use Lisp? Tcl? You're saying that it 
>can be done, but has anyone _actually_ done it yet?

I've used EmacsLisp a few years back.  I imagine Macintosh Common Lisp can
do it.  I wonder how well MacGambit supports OSA?

>
>Not that it matters. What's important is that Apple - and now MS - 
>have a way of making the scripting language irrelevant. The choice is 
>with the user, instead of hardcoded by the app developer. Now, if the 
>Unix people could also use something like this...

Amusingly enough Apple ported OSA to AIX under the guise of their highend
network servers.  So, you could send AppleEvents from you Mac to the server
to perform operations.  

That's something else I forgot to mention.  OSA is "network aware."  So,
you could 
      tell application "FileMaker Pro" of machine "Sammy" in zone "Davis"
            to activate
      end tell

to start filemaker pro on that machine.

It's a fun capability to have when you're a nerd. :-)





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

Date: 29 Apr 1997 22:09:15 GMT
From: "joseph norris" <josephn@mail.mcoe.k12.ca.us>
Subject: perl script producing html with problems under netscape.
Message-Id: <01bc5557$077bc980$274d04c7@josephn.mcoe.k12.ca.us>

Hello group,

I have the following script that produces a title with a rolling wheat
field as background. Great under explorer, but the gif does not show up
with netscape. Am I doing something wrong. Any help appreciated. Joseph.

require 5.003;

$mcoe="http://www.mcoe.k12.ca.us";

require "/home/josephn/lib/cgi-lib.pl";

$script = "human.pl";

    print &PrintHeader;
    print &HtmlTop("MCOE Human Resources", "MCOE HUMAN RESOURCES HOME
PAGE");

print qq!
<body background="$mcoe/wheat.gif" bgcolor="#000000" text="#FFFFFF"
link="#FF0000"
vlink="#00FF00" alink="#800080">
<P>
!;

print &HtmlBot;
exit(0);


-- 
    Joseph Norris     			   
    email : josephn@mail.mcoe.k12.ca.us   
    Mendocino County Office Of Education   
 



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

Date: Wed, 30 Apr 1997 02:35:32 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: perl script producing html with problems under netscape.
Message-Id: <5k6a3n$bem$1@news3.microserve.net>

Wrong group use different news group 
       comp.infosystems.www.authoring.html

This answer should work -

use this edit site:

http://www.webtechs.com/html-val-svc/

It will inform you of the problem.  This is not a perl problem, but
a html problem.

After you correct the edit errors and still have a problem email me.
BTW 74K graphic or what ever is too big unless this is for intranet
only.  You have too much graphic for a general internet user.


"joseph norris" <josephn@mail.mcoe.k12.ca.us> wrote:

>Hello group,

>I have the following script that produces a title with a rolling wheat
>field as background. Great under explorer, but the gif does not show up
>with netscape. Am I doing something wrong. Any help appreciated. Joseph.

>require 5.003;

>$mcoe="http://www.mcoe.k12.ca.us";

>require "/home/josephn/lib/cgi-lib.pl";

>$script = "human.pl";

>    print &PrintHeader;
>    print &HtmlTop("MCOE Human Resources", "MCOE HUMAN RESOURCES HOME
>PAGE");

>print qq!
><body background="$mcoe/wheat.gif" bgcolor="#000000" text="#FFFFFF"
>link="#FF0000"
>vlink="#00FF00" alink="#800080">
><P>
>!;

>print &HtmlBot;
>exit(0);


>-- 
>    Joseph Norris     			   
>    email : josephn@mail.mcoe.k12.ca.us   
>    Mendocino County Office Of Education   
> 


-------  signature  ----------

Check out the Perl site!

http://www.microserve.net/~soccer/

use password perlmisc

Geat tool for Developers>



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

Date: Tue, 29 Apr 1997 19:01:24 -0500
From: "Thomas A. Ziem" <tziem@netaxis.com>
Subject: perl5.003 & SGI
Message-Id: <33668BD4.34B0@netaxis.com>

Has anyone compiled perl5.003 on SGI 6.3?
I need to do this and integrate Oraperl as well.
Does anybody have make files for this that I could look at?
Thanks for the help.
-- 

<Thomas A. Ziem>


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

Date: Tue, 29 Apr 1997 19:16:39 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: pre-RFD: comp.lang.perl.{data-structure,inter-process,porters,regex}
Message-Id: <7136k5.fq9.ln@localhost>

Douglas Seay (seay@absyss.fr) wrote:

: Evan Kirshenbaum wrote:
: > How about if we create clp.cgi and clp.www, but we make them
: > robomoderated groups, where the moderation policy is to reject all
: > postings with a note pointing to ciwa.cgi?
: > 
: > They'll be a relatively low-volume groups, so nobody should mind, and
: > it might cut down on the traffic here.
: > 
: > [Tongue only slightly in cheek.]

: Aye!

: Is it possible to make one usenet group an alias of another?  Just make
: this new c.l.p.www be a "symbolic reference" to c.i.w.a.cgi might do the
: trick.  I've never heard of such a thing, so I doubt if it is already in
: a RFC.


: Calle Dybedahl wrote:
: 	<snip of my post>
: > 
: > Agreed, but perhaps comp.lang.perl.cgi would be a better name? Not only is
: > it more obvious, it also comes before .misc when sorted alphabetically.

: Another good idea, but I'm afraid that many who post things claiming
: that perl is broken because it works from the command line, but not from
: the web server don't know what CGI is.  Although "www" comes after
      ^^^^^^^^^^

except they say "from the browser" instead...


: "misc", it is sure to be known by (nearly) everyone.


: More food for thought: how many "clueless web programmers" will
                                   ^^^^^^^^^^^^^^^^^^^^^^^^

You must be talking about the folks who think CGI scripts run
on their browser...


: cross-post to both the new group and good ol' misc?  Or even worse, send
: duplicate copies?  If this percentage is high, we're just wasting our
: time dreaming about stopping these boneheads.


I think it is hopeless.

Real moderation is the only way that I can see to save c.l.p.m.

But who would want to volunteer their time, only to reject 90% of all
submissions?


We are paying the piper for the popularity of the WWW.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 29 Apr 1997 20:17:54 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem with CGI form processing
Message-Id: <comdog-2904972017540001@nntp.netcruiser>


In article <3364D9C2.6ED0@stud.hitos.no>, Sondre Johan Walla
<sondrejw@stud.hitos.no> wrote:

> Ive been trying to get a perl script CGI to run correctly. It is

shhhh!  don't say CGI in this group! :)  luckily you don't go
on to ask a CGI kinda question.

> supposed to process a form and then send a mail to me. The problem is
> that the mail I get is totally empty. Can anyone help?? 

> sub do_mail
> {
>   local($filename) = "/tmp/cf-$$";
>   open(TFILE,">$filename");
>   @filetext = <TFILE>;

ahhh, here's the problem.  notice what you did when you opened the
file? you opened it for writing and effectively truncated it
to zero length.  there's nothing for <TFILE> to read, so later
on when you mail the contents of @filetext...

>  print MAIL "$filetext\n";

that is, when you thought you mailed the contents of @filetext
(perhaps you had snipped out a 

   $filetext = join '', @filetext;

?) there was nothing to send because there was nothing in 
@filetext.  when i debug this sort of thing i usually use a 
statement like:

   print MAIL "[$filetext]\n";

if it's a problem with mail, nothing shows up, but if it is a 
problem with the variable, the brackets show up and tell me that
whatever is between them is what the script thinks is stored in the
variable.  it's always nice to have something that will show up
no matter what the variable contains just so that you know it
works :)

-- 
brian d foy                              <URL:http://computerdog.com>                       
unsolicited commercial email is not appreciated


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

Date: Tue, 29 Apr 1997 17:55:08 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Joe Marzot <gmarzot@baynetworks.com>
Subject: Re: problem: array assignment to hashref slice
Message-Id: <Pine.GSO.3.96.970429175212.21595D-100000@kelly.teleport.com>


On 28 Apr 1997, Joe Marzot wrote:

> I know I can say
> 
> @hash{a,b,c,d} = (1,2,3,4);
> 
> but how do I do this with a hashref?

The rule is that you can always put (something that returns) a reference
in curly braces in place of the name of the hash. Since the name in that
line is 'hash', you could use this.

    $hashref = {};
    @{ $hashref }{a, b, c, d} = (1, 2, 3, 4);

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 29 Apr 1997 19:20:54 -0700
From: brannon@bufo.usc.edu (Terrence M. Brannon)
Subject: question: how to trim a string passed via hard reference?
Message-Id: <ysizyba1z1x7.fsf@bufo.usc.edu>

sub trim {
    chomp($$_[0]);
    $$_[0] =~ s/^\s+//;
    $$_[0] =~ s/\s+$//;
}

trim(\$x)

does not trim away leading and trailing whitespace. why?


-- 
o============o Sending  unsolicited commercial e-mail (UCE) to this address
 Legal Notice  is indication of your consent to pay me $120/hour for 1 hour
o============o minimum for professional proofreading & technical assessment.
terrence brannon * brannon@rana.usc.edu * http://rana.usc.edu:8376/~brannon


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

Date: Wed, 30 Apr 1997 03:18:57 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: shtml extension from perl?
Message-Id: <5k6cl2$c88$1@news3.microserve.net>


"Neil Sandow, Pharm.D." <rx@rxlist.com> wrote:

>I'm currently running a perl script on my website that searches
>the input (drugname) and outputs the results as an html file
>with a url which ends with ?drugname  

drug.html?drugname or
drug.cgi?drugname

This is a html question.  When using cgi the ?drugname is input
to the cgi.  I am not sure what it is with html (nothing).

> I'd like to modify the script
>to have the url end with ?drugname.shtml

Should be easy enough.  Find where it puts out ?drugname
and add .'shtml'  

> so I can run a server side
>script with the new html file.  Is adding this .shtml extension easy to
>do?  Can somebody point me in the right direction?  

>Thanks!  -Neil
>=================================================================
>Neil Sandow, Pharm.D. - RxList : The Internet Drug Index
>        http://www.rxlist.com     rx@rxlist.com

-------  signature  ----------

Check out the Perl site!

http://www.microserve.net/~soccer/

use password perlmisc

Geat tool for Developers>



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

Date: 29 Apr 1997 20:15:26 -0700
From: brannon@bufo.usc.edu (Terrence M. Brannon)
Subject: split returns erroneous value on a line beginning with '#'
Message-Id: <ysizvi55yzec.fsf@bufo.usc.edu>

The following simple script

#!//usr/bin/perl

unless ($#ARGV == 0) {
    print ("usage: $0 filename\n");
    exit;
}


$file = shift(@ARGV);

open(F,"<$file") || die "couldn't open $file \n";

while (<F>) {
    @els = split(/\s/);
    print $#els+1 . ": $_";
}

indicates that the first line of the file opened (listed below) has 1
column, even though it obviously has 6
#P		0.000007	0.000037	0.000047	0.000057	0.000067
0.000000	4.05880000000001e-06	2.75638999999999e-05	3.32321999999999e-05	3.99671000000001e-05
0.100000	4.14739999999998e-06	2.84536999999998e-05	3.26403e-05	3.97491000000001e-05


-- 
o============o Sending  unsolicited commercial e-mail (UCE) to this address
 Legal Notice  is indication of your consent to pay me $120/hour for 1 hour
o============o minimum for professional proofreading & technical assessment.
terrence brannon * brannon@rana.usc.edu * http://rana.usc.edu:8376/~brannon


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

Date: Tue, 29 Apr 1997 15:48:24 -0700
From: Devin Ben-Hur <dbenhur@egames.com>
To: jason@cimedia.com
Subject: Re: Turn array into hash then import into another namespace
Message-Id: <33667AB8.C7A@egames.com>

Jason Bodnar wrote:
> I have a list of ordered fieldnames in a array as such:
> @fields = qw(name address phone age);
> 
> I need to be able to refer to 'name' and know that it is element 0.
> Ideally, I'd like to import all this into another namespace so
> $Fields::name = 0; $Fields::address = 1.

> I thought I could do something with map like:
> @junk = map eval 'package Fields;' . "${$_} = ?", @fields;
> but I have no idea to get the index of an individual element inside
> map. (Plus I'm unsure of the rest of the code.)

map doesn't supply positional information; if you want it
you'll have to make your own control variable which you
increment in the map expression.

Since you're throwing away the results, why use map at all?
map transforms (maps) an array to another array which is
not what you're doing.  Don't use map instead of a looping 
control structure just because you think it's somehow niftier.

> Am I on the rigth track? Is there a better way to do this?

Are you particularly attached to the alternate namespace idea?
Why not just use a hash to map names to index?  eg:

my (%field_index,$i);
for ($i=0; $i<@fields; ++$i) { $field_index{$fields[$i]} = $i; }

Then instead of $Fields::name, you use $field_index{name}.

If you really must make these names in a package name space,
try:

my $i;
for ($i=0; $i<@fields; ++$i) { ${"Fields::$fields[$i]"} = $i; }

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"No, I'm not going to explain it. If you can't figure it out, 
 you didn't want to know anyway..." --Larry Wall



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

Date: 30 Apr 1997 00:19:45 GMT
From: lbrennan@postbox.usyd.edu.au (Luke Brennan)
Subject: WWW page mirroring with PERL?
Message-Id: <5k6371$s8d@metro.usyd.edu.au>
Keywords: NT PERL WWW MIRROR


Can someone point me at a PERL utility (running on NT) that
will mirror a remote WWW site? 

Luke



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

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

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