perl questions

laura hudson hudsonl at ouvaxa.cats.ohiou.edu
Fri Mar 6 08:59:02 EST 1998


Hello folks,

I went to a workshop on basic Perl a couple of years ago to learn how to do
forms, and subsequently have become the libraries Perl CGI programmer.
Unfortunately, programming, even simple programming, comes about as
naturally to me as acrobatics.  I have about every manual, but the
difficulty comes when actually testing the scripts--they run okay and I
think something is working until I get telephone calls from people in
buildings across campus saying "Hey, why can't I . . ." 

These are simple things I have problems with, having to do, usually, with
syntax.  I have nobody here to knock heads with.  

The people on this list have been very helpful in the past with sharing
scripts and giving advice, but I hate to take advantage of your kindness too
often. I've been hesitant to post to a Perl list or mail group because of
the reputation programmers in "the real world" have towards telling you to
RTFM.  Does anybody know of a good mellow list, perhaps a librarian's Perl
and/or programming  list?

Has anybody written, or considered writing, a CGI for Librarians book?
Librarians want to do different things than most businesses, "real"
programmers, or amateur web-page designers, which is who most of the books
are written for.

Is there any software which makes perl programming easier somehow?  I'm not
quite sure what I mean, but . . .

Here's my problems:  

I have been asked to write a script which passes a password to a database so
that we don't have to give the password to our users.  I know how to do this
with a form button for a database such as GeoRef where the password
interface is actually a Web page, but these databases seem to be using fmpro
or some other database protection--a box pops up asking for a password.  Can
this be scripted with CGI?  I find nothing about it out there.  The sites in
question are the Harvard Educational Review (www.edreview.org) and the
Directory of Electronic Journals, Newsletters, and Academic Discussions
(www.arl.org:591/).

Secondly (this is the "easy" one):

I borrowed a script which checks IP address and either gives a "sorry"
message or passes the user to the e-journal and makes a tally in a
tally-book.  Our IP addresses, which used to be simple, have gotten more
complex as of late.  

This line checks IP and it works:
if ($user_ip =~
/^132\.235\.\d*\.\d*|^198\.234\.69\.[241-254]|^198\.234\.122\.d*/){
  
However, I want to screen out several ranges within the "d*"s.  So I wrote this:

if ($user_ip =~
/^132\.235\.\[1-100|102-119|121-129|131|133-500]\.\d*|^198\.234\.69\.[241-25
4]|^198\.234\.122\.d*/){

It doesn't work.  This is odd, since, as I understand it, ranges should work
within a pattern match.  And, in fact, as you can see, ranges do work later
in the pattern.  I tried putting only one range in this bracketed statement,
and it still didn't work.

Ok, I thought, so I'll go the other direction and screen out the unwanted
IP's rather than include the wanted one's, so I knocked heads with O'Reilley
for awhile and  wrote:


if ($user_ip =~
/^132\.235\.\d*[^190|130|101|120|132]\.\d*|^198\.234\.69\.[241-254]|^198\.23
4\.122\.d*/){

This worked to screen out the people who should be screened.  Unfortunately,
it also screened out *anybody* in the 132.235 range.  Sigh.

Help?

Thanks much.  You probably should reply privately.

Laura Hudson
Alden Library Reference Department
Ohio University Libraries






More information about the Web4lib mailing list