[12193] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5792 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 26 16:07:22 1999

Date: Wed, 26 May 99 13: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           Wed, 26 May 1999     Volume: 8 Number: 5792

Today's topics:
    Re: Access and Perl (Scott McMahan)
    Re: Better solution ? <uri@sysarch.com>
    Re: Calling a Perl script <cassell@mail.cor.epa.gov>
        Can someone help me on this challenging problem? <uyv_IGNORE_r@hotmail.com>
    Re: DBM File will not open after Redhat 6.0 upgrade <bruce@flair.law.ubc.ca>
    Re: DBM File will not open after Redhat 6.0 upgrade (Benjamin Franz)
        Embedding Perl in C <hagerty@fidnet.com>
        File I/O Help Needed (Jason McNorton)
        Flexibility questions.... jknoll@my-deja.com
    Re: Flexibility questions.... <tchrist@mox.perl.com>
    Re: Help needed! (hannibal josh)
        Help with Reading Config Files.  As seen in Perl Cookbo <portboy@home.com>
    Re: leeches, compilers, and perl, oh my (all mine?) <tchrist@mox.perl.com>
        Nested Data in MySQL.. getting at it with DBI.. <ptrainor@title14.com>
    Re: Nested Data in MySQL.. getting at it with DBI.. <raimi@cs.tu-berlin.de>
    Re: Nested Data in MySQL.. getting at it with DBI.. <garethr@cre.canon.co.uk>
    Re: Open a textfile with a cgi-programm <jeromeo@atrieva.com>
    Re: Password Protect <cassell@mail.cor.epa.gov>
        Pattern Matching -- Up a Certain Creek with no Paddle <webmaster@*nospam*mugomilk.freeserve.co.uk>
        perl -w, "uninitialized" variables, and the Perl langua <macintsh@cs.bu.edu>
    Re: perl -w, "uninitialized" variables, and the Perl la <tchrist@mox.perl.com>
    Re: perl -w, "uninitialized" variables, and the Perl la <macintsh@cs.bu.edu>
    Re: perl -w, "uninitialized" variables, and the Perl la (Andrew Allen)
    Re: perl -w, "uninitialized" variables, and the Perl la <macintsh@cs.bu.edu>
    Re: perl -w, "uninitialized" variables, and the Perl la <tchrist@mox.perl.com>
    Re: perl -w, "uninitialized" variables, and the Perl la <macintsh@cs.bu.edu>
    Re: perl -w, "uninitialized" variables, and the Perl la <tchrist@mox.perl.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 26 May 1999 18:21:09 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Access and Perl
Message-Id: <374c3b95.0@news.new-era.net>

Richard H (rhrh@hotmail.com) wrote:

> ... to find out WHY access is baad.

The reason why Access is bad is it is designed for desktop, single-user,
non-critical applications.  It is not robust, can't handle much traffic
at one time (one person typing slowly is about its limit), and has SQL
deficiencies (as an example, you can't do two queries at once; it did
not used to support BLOBs, although it might now).  The Access database
is not powerful enough to be used for Internet applications. I always
say it is useful for grocery lists, but that's about all.

Scott


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

Date: 26 May 1999 15:59:58 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Better solution ?
Message-Id: <x7ogj7eh4x.fsf@home.sysarch.com>

>>>>> "n" == nilrame  <nilrame@my-deja.com> writes:

  >> perl -pe 'print "X" x 2000 if ( 1 .. 2000 )'
  >> 

  n> I never can remember those switches :)

you should know -p and -n and -e. then add -0, -l and a few others. most
of the others are not that commonly used.

  >> perl -pe 'BEGIN {$x = "X" x 2000} print $x if ( 1 .. 2000 )'

  n>   I thought of something like this (After I posted). However to do the
  n> prepending (that my original does) you would need something like.

  n> perl -pe 'BEGIN {$x = "X" x 2000} print $x$_ if ( 1 .. 1000 )'

well, i beg to differ. in your case you have a syntax error. you need to
put $x$_ in "". but that is still wrong as you would find out by trying
both (with simpler prefixes and fewer lines). remember -p means print the
input line after loop block. so mine prints $x and the -p loop prints
$_. so in your case $_ is printed twice. use a -n loop for your version.

  n> (fixed the typo too)

2000 => 1000?  or what typo did you mean?

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Wed, 26 May 1999 11:36:23 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Calling a Perl script
Message-Id: <374C3F27.925BD4E9@mail.cor.epa.gov>

MomLucie wrote:
> 
> Hi,
> Is it possible to call a Perl script from a high level language?

Perl *is* a high-level language.  What higher-level language
are you planning on using?  A 5GL?

Perhaps you meant that you wanted to call Perl from a
lower-level language, like C.

Or maybe you meant that you wanted to call Perl from
something that is not a language at all, like the CGI
protocol which is only an interface specification?

The answer in all these cases is 'yes'.  Perl is a
very adaptable glue language, in addition to its many 
other uses.

> Thanks

You're welcome, 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 26 May 1999 13:49:11 -0500
From: "Ralph Emerson" <uyv_IGNORE_r@hotmail.com>
Subject: Can someone help me on this challenging problem?
Message-Id: <7ihfpl$t3u@dfw-ixnews11.ix.netcom.com>

I thought of this one on my own but because it just seems so common, I'm
sure someone else out there has done something very similar.  The way I'm
thinking of working it won't work for big input files.

The number 1 connects to numbers 4,5,8 and 9.
The number 2 connects to numbers 4 and 8.
The number 3 connects to 5 and 6.
 ........
The number 7 connects to nothing.
 ......
The number 9 connects to 2,5 and 8.

The input file looks like this
-----------
9 {The number of connectors}
3 4 5 8 9
4 8 9
1 5 6
1 2 8
1 3 9
3
0
1 2 4 9
5 2 8
--------------
I bet you can see what I'm asking already.  Find the shortest connection
path between two numbers.  For example the shortest connection between 1 and
2 is 1-4-2.  The shortest connection between 6 and 2 is 6-3-5-9-2.

I'm thinking a good old recursive function that calles itself with all the
numbers in it's row and stops when it hits the number it wants. (I wouldn't
have it loop back to itself somehow).  There's got to be a better way to do
this so that it will work for list 5000 long with 10-12 connectors each.  I
cross posted so that I could get all the ideas I can and even though I can
read the languages I posted to, please post back ideas/Visual English and
Report Language++ and not real code so that others can comment.




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

Date: Wed, 26 May 1999 11:08:36 -0700
From: Bruce Atherton <bruce@flair.law.ubc.ca>
Subject: Re: DBM File will not open after Redhat 6.0 upgrade
Message-Id: <374C38A4.2285547E@flair.law.ubc.ca>

I R A Aggie wrote:
> 
> You can control which DBM library you use by loading that library
>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> before you call dbmopen():

Just another note with the results of further experiments.

I tried changing from using dbmopen to using tie, but got the same
results.

Took my database file over to another machine still running Redhat 5.2,
which used perl 5.004_04 + MAINT_TRIAL_4. It reads it just fine. This
means I can get at the data, but I still can't use the database and
script on the machine which is supposed to be running it. If necessary I
will do a dump and reload, but has anyone any other suggestions? Is this
a bug in perl 5.005? A new feature that looks like a bug? Something
unrelated to perl?

I can make the database available to anyone that wants to take a look
for possible bugs. It is just a WikiWikiWeb collection of pages.


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

Date: Wed, 26 May 1999 19:34:06 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: DBM File will not open after Redhat 6.0 upgrade
Message-Id: <O0Y23.40682$ny.3266509@typhoon-sf.snfc21.pbi.net>

In article <374C38A4.2285547E@flair.law.ubc.ca>,
Bruce Atherton  <bruce@flair.law.ubc.ca> wrote:
>I R A Aggie wrote:
>> 
>> You can control which DBM library you use by loading that library
>>         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> before you call dbmopen():
>
>Just another note with the results of further experiments.
>
>I tried changing from using dbmopen to using tie, but got the same
>results.
>
>Took my database file over to another machine still running Redhat 5.2,
>which used perl 5.004_04 + MAINT_TRIAL_4. It reads it just fine. This

[snip]

RedHat 6.0 uses the Berkeley DB 2.x libraries instead of the Berkeley DB 1.x
libraries used in RedHat 5.2 or older. They are not inter-operable. 
That is probably your problem.

Benjamin Franz


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

Date: Wed, 26 May 1999 12:34:21 -0500
From: Jason Hagerty <hagerty@fidnet.com>
Subject: Embedding Perl in C
Message-Id: <374C309D.FBE9D928@fidnet.com>

Does anyone know how to embed perl into C?  I am using ActiveState 516,
and DevStudio5 for WinNT(sp5). 

I can get it to compile, but when it goes to link I get "unresolved
external symbol".  

Anyone got any ideas?
Thanks
Jason


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

Date: Wed, 26 May 1999 14:39:15 -0500
From: jmcn@msg.ti.com (Jason McNorton)
Subject: File I/O Help Needed
Message-Id: <MPG.11b609dc900b8dcf98991c@news.itg.ti.com>

Ok, I have a number coming in from a form.  I'm trying to make it into a 
filename.  The number is coming in in this form:
<option value="1003">1003</option>

So I bring that in as $ledger, and add stuff to it so it'll come out to:
"/server-root/c1st/1003.chk"

I'm doing this for now:

$checkfile="/server-root/c1st/";
$checkfile.=$ledger;
$checkfile.='.chk';


This will let me access files with this command:

open  (SAVES, "$checkfile");
close (SAVES);


but not:

open  (SAVES, ">$checkfile");
close (SAVES);

As soon as I put a > so I can write to it, it croaks.   If I set 
$checkname directly equal to "/server-root/c1st/1003.chk", they both 
work.  Any ideas on why it's working for reading only, but not if I try 
to write?  Thanks a ton for any help.


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

Date: Wed, 26 May 1999 18:43:51 GMT
From: jknoll@my-deja.com
Subject: Flexibility questions....
Message-Id: <7ihfd7$6d3$1@nnrp1.deja.com>

I am a Information systems intern for a large Honda supplier called
Indiana Percision Technology.  I am in charge of researching different
tools to develope their webpage.


How does Perl rate on the following?

Database linkability
Cross platform ability
Easy to learn?
Performance?

tia
jrk


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 26 May 1999 13:06:34 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Flexibility questions....
Message-Id: <374c463a@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, jknoll@my-deja.com writes:
:Database linkability
    Excellent.
:Cross platform ability
    Excellent.
:Easy to learn?
    Depends: it's easier if you're already a programmer.
:Performance?
    Faster than Java, slower than C.

It seems to me that you should have other criteria.

--tom
-- 
Besides, it's good to force C programmers to use the toolbox occasionally.  :-)
        --Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>


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

Date: Wed, 26 May 1999 10:18:51 -0800
From: hannibal59@hotmail.com (hannibal josh)
Subject: Re: Help needed!
Message-Id: <WZW23.2148$y6.1371036@WReNphoon3>

Thank you very much for help(Scratchie,Larry Rosler,John Porter,
Tony Greenwood)There is real gentlemans out there!
But.....i did not understand you or....??
as i wrote i am really beginner(what is perlfaq4?.or flush?)
and...
still same problem..:-(i have upploaded it ascii,permissions are
set,i checked all white(empty)spaces before: End_of_prog,lines
starting from left margin,
and there is nothing else on line __EOF__,but still:
"Can't find string terminator "End_of_prog" anywhere
before EOF at /u/prox/cgi-bin/penv.cgi line 17.
-------------------------------------------------------
#!/usr/bin/perl -w

use strict

$date = `date '+DATE: %A %e %B, %Y TIME: %I:%M %p %Z'` ;
($d , $t) = ($date =~ m#DATE: (.*) TIME: (.*)#) ;
$user = $ENV{'REMOTE_IDENT'};
$user = ($user eq "unknown")? "" : " $user" ;
$host = $ENV{'REMOTE_HOST'};

$browser = $ENV{'HTTP_USER_AGENT'};

($b,$v,$p) = ($browser =~ m/(.*)\/(\S*)(.*)/) ;
($p) = ($p =~ m/.*\((\w*).*\)/ );
$p = $p?$p:"unspecified platform";

$command = <<'End_of_prog';
$ping =`ping-s$host64 1`;
End_of_prog

if (eval $command) {
$* = 1; # Enable multi-line pattern match
$ping =~ m#min/avg\/max = (\d*)/\d*\/\d*# ;
$ms = $1 ;
if ( $ms <= 400) {
$link = "very fast link" ;
}
elsif ($ms <=1000 ) {
$link ="fast link" ;
}
else {
$link = "slow link" ;
}

$interrogate = <<"__EOInterrogate__";
Interrogation time of <b>$ms</b> milliseconds suggests that you're on a
<b>$link</b><p>

__EOInterrogate__

}
else {
$interrogate="";
}

print <<__EOF__;
Content-type: text/html

<html>
<head>
<title>Browser Recognition</title>
</head>
<body bgcolor=#fffff0 text=#000000 link=#0080ff vlink=#2e8b57>


<center><h3>Browser Recognition</h3></center>
<pre>
</pre>
Welcome <b>$user</b> from <b>$host</b> at
<b>$t</b> on <b>$d</b><p>

You are using <b>$b</b> Version <b>$v</b> for <b>$p</b><p>

$interrogate
<hr width=300>

<p>We have written this user interrogation program in Perl.
By running this type of program,
we can customise the pages you receive;
so that they look their best, no matter what configuration you are using.
We believe this is preferable to messages such as "these pages best
viewed"
<p>


<br>
Email <a
href="mailto:xxxx\@xxx">xxxx\@xxx</a>


</body>
</html>
__EOF__

ONCE AGAIN,THANK YOU!



**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Wed, 26 May 1999 18:03:31 GMT
From: Mitch <portboy@home.com>
Subject: Help with Reading Config Files.  As seen in Perl Cookbook...
Message-Id: <374BC7AD.8A47CBD6@home.com>

I'm playing around with reading of configuration files as seen in the
Perl Cookbook (8.16).  Here's what my config file looks like:

conlog 1
ilog 4
trace 4
media htx
speed 2400
logport tty00
bypass
pass servnow
spill
map this to that for foo

Here's my code that is reading the config:

#!/usr/bin/perl5
$CONFIG = "/usr/home/saint/test_scripts/test_config";
open(CFG, $CONFIG);
while(<CFG>) {
        chomp;
        s/#.*//;
        s/^\s+//;
        s/\s+$//;
        next unless length;
        my ($var, $value) = split ' ', $_, 2;
        print("Var is $var\n");
        print("Value is $value\n");
        $User_Preference{$var} = $value;
}

On to my questions....I am going to have two types of config files - one
is a default, and the other reflects the settings the user has set.
Upon the start-up of the program, I need to read this (default or user
settings) and set the program up according to the config.  How do I put
"hooks" in the program to get this information as the config file is
being read?  Also, assuming we are using the user's config, and they
make changes during the execution of the program (which consequently
updates the config) how do I continually ping the config file for any
updates?

Thanks again,

Mitch



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

Date: 26 May 1999 12:33:30 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <374c3e7a@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, Greg Bartels <gbartels@xli.com> writes:
:he wants to protect his copyrighted code. 

Then he should hire a lawyer, which is exactly what every other person on
the planet who has to deal with illegal copyright infringements has to do.

You're definitely way out there.

--tom
-- 
"Only in their dreams can men be free. It was always thus, and always thus will
 be." - Keating


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

Date: Wed, 26 May 1999 14:50:11 -0400
From: Pat Trainor <ptrainor@title14.com>
Subject: Nested Data in MySQL.. getting at it with DBI..
Message-Id: <Pine.LNX.4.05.9905261438380.12109-100000@aura.title14.com>

(forgive the cross-post, but it applies to both)

Here's an interesting(to me) problem:

situation: perl & mysql (there's another way?)

	I have lots and lots of rows in a table. Each row has an id. Each
row also has a 'parent' id. These are web pages, but that isn't important.
	Desired is to produce a query in mysql (sub-queries are not
possible yet with mysql) that will populate a complex perl array such that
the 'tree' can be printed to represent the way the arrays are actually
connected. Sounds weird, but it's easy:

id
id
|------>id
id
|------>id
	|------>id
	|------>id 
id
[...]

	Where the parent of a child is one less tab space(in the example
above). Each parent can have many children, but each child can only have
one parent.

	After a structure is in memory, it will be used to pull out the
names of the rows for each page, and a link to it with the graphical
representation.. hopefully better than what I drew above!
	
	I'm not looking for hand-holding, so flame-off, please. I can get
at the db no sweat, just puzzled as to how to approach building a large
array with the values of each child and it's parent, then be able to
output it in a way that will be logical.

TIA!	

pat 	
:)

ptrainor@title14.com (key: www.title14.com/pgp/pat.key)  
Programming Rates: I do it: $20 You watch: $40 You help: $80



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

Date: Wed, 26 May 1999 21:07:26 +0200
From: Raimi <raimi@cs.tu-berlin.de>
Subject: Re: Nested Data in MySQL.. getting at it with DBI..
Message-Id: <Pine.SOL.3.91.990526205701.15083A-100000@cerberus.cs.tu-berlin.de>

On Wed, 26 May 1999, Pat Trainor wrote:

Hi all!
(my first posting here, I am sorry for everything)


> situation: perl & mysql (there's another way?)
mSQL surely... http://www.Hughes.com.au

> |------>id
> id
> |------>id
> 	|------>id
> 	|------>id 

This looks like a perfect victim for being represented as a 
object-oriented structure. Each node is an object having a parent and a 
couple of children...

There are a couple of Persistence Modules for objects, AFAIK.

I personally implemented one too and I am looking for people to test it...
It's not quite finished yet but it will be soon.

But you can make a miniversion on your own:

- enumerate the nodes
- make a table with node-id and value
- make a table node-id and children id

finished. Just 2 tables for the whole task.
Find the children of a give node would be:
SELECT children FROM table2 WHERE node-id=$given

Find the parrent would be:
SELECT node-id FROM table2 WHERE children=$given

Is that what you wanted?

Email me privately if you want a deeper discussion...

Bye,
 _  __
| )  |                                "What do you get if you   *    **  |
|\aimund                               multiply 6 by 9?"        * *    * |
|    |                                                          ****  *
   \_/acob                                                        *  *** O
   
             **** Remember: 21 is just half the truth ****



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

Date: Wed, 26 May 1999 19:19:57 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Nested Data in MySQL.. getting at it with DBI..
Message-Id: <sir9o3bpuq.fsf@cre.canon.co.uk>

Pat Trainor <ptrainor@title14.com> wrote:
> I have lots and lots of rows in a table. Each row has an id. Each row
> also has a 'parent' id.  Desired is to produce a query in mysql
> (sub-queries are not possible yet with mysql) that will populate a
> complex perl array such that the 'tree' can be printed to represent
> the way the arrays are actually connected.

Why not just get all the data from the table:

    $sth = $dbh->prepare("SELECT * FROM the_table") or die $dbh->errstr;
    $sth->execute or die $sth->errstr;
    while ($row = $sth->fetchrow_hashref) {
      # DBI doesn't guarantee not to re-use the hashref, so copy it
      push @rows, { %$row };
    }

then create a hash allowing you to lookup rows by id:

    @lookup_by_id{map {$_->{id}} @rows} = @rows;

(or you could roll that into the fetchrow_hashref loop) and add each row
to the CHILDREN member of its parent:

    foreach (@rows) {
      $parent = $lookup_by_id{$_->{parent}};
      next unless defined $parent;
      push @{$parent->{CHILDREN}}, $_;
    }

Now you can use Data::Dumper to print the directed graph rooted at any
of the rows:

    use Data::Dumper;
    print Dumper($rows[0]);

Is this the kind of solution you need?

-- 
Gareth Rees


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

Date: Wed, 26 May 1999 12:02:21 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: lr@hpl.hp.com
Subject: Re: Open a textfile with a cgi-programm
Message-Id: <374C453D.18CD3BDC@atrieva.com>

Larry Rosler wrote:
> 
> [Posted and a courtesy copy mailed.]
> 
> In article <374B2B24.83B4B2B0@atrieva.com> on Tue, 25 May 1999 15:58:44
> -0700, Jerome O'Neil <jeromeo@atrieva.com> says...
>
> > How do you do it?
> 
> I run my code on a multiplicity of servers on both HP-UX and Windows NT.
> The servers (and, for that matter, the perl compilers) are maintained by
> webmasters over whom I have little or no control.  I understand the
> behavior and environment of the software that they run, but I cannot
> ensure that everything behaves in the same predictable manner.  Sigh...

Ah.  You need to beat your webmasters more.  This will ensure the
appropriate level of predictability and contritness for their sins.

And, uh, perspiciousness, too... ;->

> I keep absolute directory pathnames (and other installation-dependent
> parameters) in a configuration file, as Perl assignments to global
> variables.

Larry, we do dang near the same thing.  For all the dissagreein' that
goes on, we sure agree on a lot.

> On every CGI invocation, the program finds the configuration file in its
> own directory by analyzing the $0 variable:
 
> BEGIN {
>     require 5.002; # Because that's the most that I can rely on!!!
>     $0 =~ m!(.*?)[^/\\]+$! && $1 and unshift @INC, $1;
>     do 'config' or # The actual code also sends me email!
>         print("Content-type: text/plain\n\nconfig failed. $!.\n"), exit;
> }

Very clever.  I have a short package that loads my config data into a
hash, and returns the reference.  I'm sure you won't mind if I steal
this and incorporate it into my own stuff? 

Thanks!

-- 
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947 
The Atrieva Service: Safe and Easy Online Backup  http://www.atrieva.com


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

Date: Wed, 26 May 1999 11:53:48 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Alex <ex5316@netvigator.com>
Subject: Re: Password Protect
Message-Id: <374C433C.78FCCCCA@mail.cor.epa.gov>

Alex wrote:
> 
> Hi all,
> I need to protect some .html pages so that only persons have correct
> password can enter these pages.

Then you'll want to look at the docs for your web server.
That's the msot secure way to do this.  And you might want to
ask this question in a newsgroup devoted to your particular
web server.. after reading the FAQ for that newsgroup, which
probably explains this very situation.

> There are some ready made scripts on internet on this topic. However, I
> found out that they are not actually password protected !

Bingo.  That's why you want to do this from the server, and
not with a piece of Perl code which may or may not get called
in time to prevent Something Bad.

> For example, usually the scripts have a login.html where visitors can
> enter the "protect.html" if the password you fill in the form of
> login.html is correct. However, if you know the url of the
> "protect.html", you can enter the "protect.html" directly !!!

Yup.  And worse.

> Are there any real protect scripts ?

You're really better off using the built-in facilities of
the server.  If you try to use PWS on Win95 [I detected some
win95-ness in your header], you probably won't be satisfied
with the level of security.

HTH, 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 25 May 1999 14:22:52 +0100
From: "Mug-O-Milk" <webmaster@*nospam*mugomilk.freeserve.co.uk>
Subject: Pattern Matching -- Up a Certain Creek with no Paddle
Message-Id: <7ihj5o$35t$1@news8.svr.pol.co.uk>

Hello.  I've had several reports that my search engine is playing up
When a user types "land" as in "Land Rover" they get everypage for "finland"
, "England" etc.

Can anyone see where I am going wrong?
I've tried "eq" and "==" instead of "=~" but they do not work.

I need the search to be case insensitive, if possible [a-zA-Z]

Here is a snippet from the code

#BEGIN MAIN SEARCH
$matches = 0;
open(DATA, $datafile);
while ($record[0] = <DATA>) {
  chomp($record[0]);

  # SPLIT INPUT FROM DATAFILE
  ($record[1], $record[2], $record[3], $record[4]) = split(/\|/,
$record[0]);

  # TIDY UP DATA FROM DATAFILE
  for ($i=0; $i < @record; $i++) {
    $record[$i] =~ s/\s{1,}/ /g;
    $record[$i] =~ s/^\s{1,}//;
    $record[$i] =~ s/\s{1,}$//;
  }

  # SEARCH FOR KEYWORDS
  $score = 0; # RESET SCORE FOR EACH RECORD IN DATAFILE
  foreach $word (@searchword) {
    if ($record[$sel] =~ /$word/i) {
      $score += (100 / @searchword);
    }
  }

  # STORE MATCHING RECORDS ALONG WITH SCORES
  if ($score > 0) {
    $score = int($score + 0.5);
    $score = " " x (3 - length($score)) . $score;
    $results[$matches] = "$score | $record[0]";
    $matches++;
  }
}
close(DATA);

$matches = @results + 0; # CONVERT TO A NUMBER (weird I know!)
$resultnumber = 0;

Any help whatsoever would be appreciated!
Thanks in Advance!

--
=========================
@mugomilk - The UK's Premier Internet Guide and Instant Submission Search
Engine.
http://www.mugomilk.freeserve.co.uk




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

Date: 26 May 1999 18:02:30 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7ihcvm$2ec$1@news1.bu.edu>

The "-w on production code" topic has been beaten to death before
(although it may be time for a new round.  Let me check my UseNet
Topic Rehash calendar...).  My question is somewhat related.

It's my understanding that all newly-created perl variables are
guaranteed to to evaluate to be "empty" (i.e. evaluate to "false").
Notice I didn't call them "uninitialized" variables, because, IMO,
they *are* initialized--with undef or "emptiness" or whatever.  A
truly uninitialized variable would contain random garbage, as in
lower-level languages like C (in most circumstances).  This is one
of the reasons many people use Perl: it's a higher-level language
that isolates the programmer from many tedious tasks.

As anyone who uses -w knows, the use of "uninitialized" values is
among its complaints, and causes a lot of "tedious" work for
programmers obsessed with running everything under -w.  Let's try to
leave the merits of -w alone for now and concentrate on this:

    Is the "initialization with nothingness" (for lack of a better
    term) of newly created variables a "guaranteed" feature of the
    Perl language?

If so, then the -w warning about "uninitialized" values seems
inappropriate, no?  Would it even be possible to change this
"initialization with nothingness" behavior in some later version of
perl without breaking (I mean really breaking, much worse than 4.x
-> 5.x) huge mounds of code and/or making perl considerably less
useful for small/quick tasks?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow


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

Date: 26 May 1999 12:38:06 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <374c3f8e@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    John Siracusa <macintsh@cs.bu.edu> writes:
:The "-w on production code" topic has been beaten to death before
:(although it may be time for a new round.  

Anybody who doesn't by default always always run with -w had better also
not check their syscall retvals.  Or they're hypocrites.

:A truly uninitialized variable would contain random garbage, as in
:lower-level languages like C (in most circumstances).

Sorry, that's just C-brain-damage in action.  Render unto Perl
the things which are Perl's....

:If so, then the -w warning about "uninitialized" values seems
:inappropriate, no?  

No.

:Would it even be possible to change this
:"initialization with nothingness" 

Say what?  Are you saying that you prefer random stack garbage, 
or that you want to see CDB-inspired warnings?

Neither seems likely.

--tom

-- 
    X-Windows: "The first fully modular software disaster.
	--Jamie Zawinski


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

Date: 26 May 1999 18:48:36 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7ihfm4$iae$1@news1.bu.edu>

Tom Christiansen <tchrist@mox.perl.com> wrote:
> Anybody who doesn't by default always always run with -w had better
> also not check their syscall retvals.  Or they're hypocrites.

Heh, like clockwork ;-)  Anyway, leaving this holy war for now...

Let me try rephrasing: what is the danger of using "uninitialized"
variables in perl if all such variables are guaranteed to be in a
known (and unchanging from perl version to perl version) state?

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow


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

Date: 26 May 1999 18:57:27 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7ihg6n$s2q$1@fcnews.fc.hp.com>

John Siracusa (macintsh@cs.bu.edu) wrote:
: As anyone who uses -w knows, the use of "uninitialized" values is
: among its complaints, and causes a lot of "tedious" work for
: programmers obsessed with running everything under -w.  Let's try to
: leave the merits of -w alone for now and concentrate on this:

Okay. This is somewhat not along your point, but:

  $SIG{__WARN__}=sub{warn $_[0] unless $_[0]=~/uninit/}

You can even check for line numbers, if you're so inclined. Or if you
want something less "global", use

{
  local $^W;
  <dangerous code>
}

As for your other issue: I certainly hope "initial value is undef" is
a defined feature of the language. I'd argue strenuously against
changing it. Although perhaps a "smart uninitialized" module which you
could do things like:

  use okay_uninit ($var1,@var2,%var3);
  no autovivify @twodimensionalstaticarray;
  
would be nice.

Andrew


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

Date: 26 May 1999 19:16:45 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7ihhat$j84$1@news1.bu.edu>

Andrew Allen <ada@fc.hp.com> wrote:
>   $SIG{__WARN__}=sub{warn $_[0] unless $_[0]=~/uninit/}

"It's a mad house!  A maaaaaaaaaaadddd house!!" :-)

> perhaps a "smart uninitialized" module which you
> could do things like:

>   use okay_uninit ($var1,@var2,%var3);
>   no autovivify @twodimensionalstaticarray;

Yeah, that's what perl needs: more pedantic run-time mother-may-I
modules to slow script start-up times.  "use vars" anyone?  Bleh.

"Stay on topic....stay on topic..."
  -- Guy from Star Wars: ANH (paraphrased for UseNet)

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow


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

Date: 26 May 1999 13:26:06 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <374c4ace@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, John Siracusa <macintsh@cs.bu.edu> writes:
:Yeah, that's what perl needs: more pedantic run-time mother-may-I
:modules to slow script start-up times.  "use vars" anyone?  Bleh.

It's good for you.

But it's turning into our() in five-six.

--tom
-- 
Lispers are among the best grads of the Sweep-It-Under-Someone-Else's-Carpet
School of Simulated Simplicity.  [Was that sufficiently incendiary?  :-)]
        --Larry Wall in <1992Jan10.201804.11926@netlabs.com


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

Date: 26 May 1999 19:32:24 GMT
From: John Siracusa <macintsh@cs.bu.edu>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7ihi88$j84$2@news1.bu.edu>

Tom Christiansen <tchrist@mox.perl.com> wrote:
> it's turning into our() in five-six.

Is it symptomatic of prolonged clpm exposure that I can't
tell if you're joking?  Either way, I'm all for anything
that'll reduce the speed cost of "good behavior"...

-----------------+----------------------------------------
  John Siracusa  | If you only have a hammer, you tend to
 macintsh@bu.edu | see every problem as a nail. -- Maslow


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

Date: 26 May 1999 13:39:41 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <374c4dfd@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, John Siracusa <macintsh@cs.bu.edu> writes:
:> it's turning into our() in five-six.
:Is it symptomatic of prolonged clpm exposure that I can't
:tell if you're joking?  

I'm not.

You didn't read the perltootc pod!

    http://language.perl.com/misc/perltootc.html
    http://language.perl.com/misc/perltootc.pod
    http://language.perl.com/misc/perltootc.text
    http://language.perl.com/misc/perltootc.man
    http://language.perl.com/misc/perltootc.ps

tootc is in the _57 pods -- see 

    http://language.perl.com/admin/whats_new.html

--tom

--tom
-- 
"The devil can cite scripture for his purpose."
				- William Shakespeare


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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