[6336] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 958 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 16 10:07:09 1997

Date: Sun, 16 Feb 97 07:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 16 Feb 1997     Volume: 7 Number: 958

Today's topics:
     CGI/PERL,  JAVA Applet, HTM parameter problem ken_t@ids.net
     Re: Commercial success stories using perl. (Thomas R. Kauffman)
     Re: Comparing two dates basj@cyber.xs4all.nl
     Re: difference btw s/// & tr/// (Andrew M. Langmead)
     Error building 5.003 on BSDI 2.1 (Ned Schumann)
     Re: glob behavior with nonexistent directories (glob is (Gurusamy Sarathy)
     help downloading (RENEIN)
     Re: help downloading (Nathan V. Patwardhan)
     HELP: a newbie question <shiu@lis.pitt.edu>
     Re: How do I filter Files ending with ".std"  and rejec (Tad McClellan)
     I'm willing to pay for your help! <bob@apollo.gmu.edu>
     Learning perl from scratch (Kevin Posen)
     Locate/check/save image given a url webmaster@americhat.com
     Need Some CGI Security Advise <rwatkins@crosslink.net>
     Re: newlines and textarea boxes <dbenhur@emarket.com>
     Re: overwriting in-memory password ("Thomas A. Fine")
     Re: perl in varied environment <hammen@gothamcity.jsc.nasa.gov>
     Re: playing w/the $`,$&, and &' vars (Dave Thomas)
     Re: playing w/the $`,$&, and &' vars <dbenhur@emarket.com>
     Re: Porting Perl from UNIX to NT (Neil S. Briscoe)
     Re: PROGRAM: how to check for nice/valid email address (DUPLANTIER Bastien)
     Question Answer Script womlake@zip.com.au
     Re: Socket Programming Question (Drew Linsalata)
     Sorting a multi dimensional Array <owen,singleton@dial.pipex.com>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Sun, 16 Feb 1997 13:44:19 GMT
From: ken_t@ids.net
Subject: CGI/PERL,  JAVA Applet, HTM parameter problem
Message-Id: <5e72rn$pvm@paperboy.ids.net>

I have a PERL CGI script that creates an input form. After the user
sends me the variables, I generate a parameter (xxx.htm) file that is
input to a Java Applet. (xxx.class). I then send back the results with
the location command. The only problem is it will only work if I
change the name of the parameter file (xxx.htm). If the name of this
file is not changed,  the new variable changes are not reflected. 

It seems as if once the client program gets the final xxx.htm, it just
pulls the last copy of it from memory.

Is there any way to fix this? It must be something simple.

Thanks in advance



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

Date: Sun, 16 Feb 1997 04:14:13 GMT
From: namffuak@skyenet.net (Thomas R. Kauffman)
Subject: Re: Commercial success stories using perl.
Message-Id: <33068834.351486911@snews2.zippo.com>

On Fri, 31 Jan 1997 09:26:07 +0000, Steve Vanechanos
<stevev@dynamicweb.com> wrote:

>I am looking for significant commercial success stories where perl is
>being used.
>
IBM has written much of the dynamic configuration control software for
the nodes of their SP2 system in perl; they ship both perl4 and perl5
binaries (and source) in the current release. There is also heavy use
of kerberos, tcl and tk, and sysctl - all shipped in executable and
full source form.

TomK

namffuak@skyenet.net


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

Date: Sun, 16 Feb 1997 11:33:33 -0800
From: basj@cyber.xs4all.nl
To: "Nathan V. Patwardhan" <nvp@shore.net>
Subject: Re: Comparing two dates
Message-Id: <3307610D.41C6@cyber.xs4all.nl>

Nathan V. Patwardhan wrote:

With comparing I meant a function to see which is oldest date 
between the two (or vice versa).

> 
> basj@cyber.xs4all.nl wrote:
> 
> : Is there a function for this or will I have to split the dates in
> : components and compater them individually (hope not) ?
> 
> I don't see what's wrong with using localtime().  :-)  It's not very
> difficult to split the time into hours, minutes, and seconds, then compare
> the result with another entry.
> 
> HTH!
> 
> --
> Nathan V. Patwardhan
> nvp@shore.net
> "send me mail"
>         --Jamie Zawinski

-- 
basj@cyber.xs4all.nl
PGP 2.6.3i KeyID 7010044D    / -- I'm Powered By Silicon Graphics -- /
http://www.xs4all.nl/~basj


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

Date: Sun, 16 Feb 1997 14:09:18 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: difference btw s/// & tr///
Message-Id: <E5p8nI.8sD@world.std.com>

Elton Kong <fkong@scf.usc.edu> writes:

> I just wonder when both can be used, which one is more
>efficient?

Questions like this are why the Benchmark module was invented.

#!/usr/bin/perl5

use Benchmark;

$teststring = "string ending in \r\n";

timethese( 500000, { 'tr' => q{
                             $_ = $teststring;
                             tr/\r//d;
                          },

              's' => q{
                             $_ = $teststring;
                             s/\r//g;
                       }});


>You see, below is my problem. I have an input file with a certain
>character which I want to get rid of. So I can use either of the forms
>below.

>s/\cM//g;
>tr/\cM//d;

>Thus my question is: which is more efficient?

One thing to keep in mind is that there are different kinds of
efficiency.  The camel book (Programming Perl, 2 ed. Wall,
Christiansen, Schwartz ISBN 1-569592-149-6) gives some tips on how to
optimize for time efficiency (runs quickest), space efficiency
(smallest runtime memory footprint), programmer efficiency
(easiest/quickest to write), maintainer efficiency (easiest/quickest
to modify beyoind its original spec.), porter efficiency
(easiest/quickest to be made to run on a machine other than the one in
which it was developed), and user efficiency (least fustrating for the
user).

Under time efficiency, it says that tr/abc//d is faster than
s/[abc]//g. Under space efficiency it says to avoid tr///. Under
progammer efficency it says "use whatever you think of first."

Think about the last one for a bit, you've probably spent more time
composing your Usenet article and reading e-mailed and posted replies
than your program would have spent (in every instance of its execution
from now until it is retired) if you had said s/// instead of tr///.

>BTW, is there any difference if I don't put a "g" after the s/// opeator?
>I can't see the difference after trying.

Try a sample where the string you are changing appears more than
once. Without the modifer, s/// stops after it finds its first match,
and performs its substitution. With the /g modifier, it then continues
through the string to find additional matches.

-- 
Andrew Langmead


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

Date: 16 Feb 1997 13:45:08 GMT
From: ned@olympus.net (Ned Schumann)
Subject: Error building 5.003 on BSDI 2.1
Message-Id: <ned-1602970602000001@oak.olympus.net>

Am thwarted by a make error when building 5.003 on a fully patched BSDI
2.1 system and would very much appreciate a copy of config.sh that works.

Here's the error....

        Making FileHandle (static)
Makefile out-of-date with respect to ../../lib/Config.pm ../../config.h
*** Error code 1
AutoSplitting DB_File (lib/auto/DB_File)

Thanks!
Ned


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

Date: 16 Feb 1997 05:31:16 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: glob behavior with nonexistent directories (glob is not find)
Message-Id: <5e6634$6og$1@news.eecs.umich.edu>

In article <wsandersE5M16L.310@netcom.com>,
KF6IIU <spammers@must.die.com> wrote:

Hmm.  I guess you don't want an email reply either.

>If I put a bogus directory in the "path":
>
>perl -e 'print join("\n",glob("/bleah/* /*"))'
>{nothing}
>
>Is this supposed to happen? I checked the FAQ and didn't find
>anything. This behavior is actually consistent with "ls", which returns
>and no such file error givne the same arguments.

Perl actually feeds this to the system shell to do its globbing (where
csh is available):

    csh -cf 'set nonomatch; glob <your glob here>' 2> /dev/null

Disgusting, but true.

 - Sarathy.
   gsar@umich.edu


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

Date: 16 Feb 1997 03:37:15 GMT
From: renein@aol.com (RENEIN)
Subject: help downloading
Message-Id: <19970216033701.WAA21404@ladder01.news.aol.com>

I am just trying to download perl, and am having some problems.  


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

Date: 16 Feb 1997 04:19:14 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: help downloading
Message-Id: <5e61s2$meq@fridge-nf0.shore.net>

RENEIN (renein@aol.com) wrote:
: I am just trying to download perl, and am having some problems.  

Gosh, I'm sorry to hear that.  You have my blessings.  :-)  In other words,
if you told us what your problem *actually* was, it would be extremely
helpful (is someone going to call me an MIT AI program gone astray, again?).

--
Nathan V. Patwardhan
nvp@shore.net
"send me mail"
	--Jamie Zawinski


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

Date: Sun, 16 Feb 1997 04:59:06 -0500
From: tom <shiu@lis.pitt.edu>
Subject: HELP: a newbie question
Message-Id: <3306DA6A.2DF881AC@lis.pitt.edu>

Hi,

	I'm new to Perl and looking for someone who can help me out.  I got a
program called "simulate" which runs with two args(input_file and
output_file) and need to run it 10 times.  Here is my shell script :

#!/bin/sh
for i in 1 2 3 4 5 6 7 8 9 10 
do
        echo 10,$i,30 > input_file
	simulate input_file output_file
done


	This script runs well.  Now I want to rewrite it by Perl and couldn't
find a way to do it by browsing the book "Programming Perl".  My
question is how to execute my program ?  I know `command` can be
executed under Perl, but it didn't work for my case `simulate input_file
output_file`.  I did try two simple lines such as  @out=`ls`; print
@out;,   and it did execute and print all the files in the current
directory.  Can anyone tell me how to execute my program?

Thanks for any help,

--Tom


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

Date: Sun, 16 Feb 1997 08:31:27 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How do I filter Files ending with ".std"  and reject those with '.std_inc'?
Message-Id: <vn57e5.fo.ln@localhost>

Patrick Tan (patrickt@tm.net.my) wrote:
: Hello,
: I have two types of files in my directory, STDF_DIR, i.e.
:   * those ending with '.std'
:   * those ending with '.std_inc'

: My current method doesn't filter them by the ending portion, since
: it greps anything which matches 'std'.

: @DirList = readir(DIR);
: @StdfList = grep(/std/i,@DirList);

: How do I indicate that I'm interested in '.std', but not '.std_inc'?

@StdfList = grep(/\.std$/i,@DirList);
                  ^^   ^

dollar sign matches end of string.

added \. because without it you would also match 'mystd'


: Appreciate all the help....


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


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

Date: Sat, 15 Feb 1997 19:16:21 -0500
From: Bob Counts <bob@apollo.gmu.edu>
Subject: I'm willing to pay for your help!
Message-Id: <Pine.LNX.3.95.970214233514.9030A-700000@apollo.gmu.edu>

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
  Send mail to mime@docserver.cac.washington.edu for more info.

---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-ID: <Pine.LNX.3.95.970215190308.11570B@apollo.gmu.edu>


Hello:

Sincerely willing to pay for your help if you can answer quickly and if
your suggestion works.  Basically, you can be a consultant for me!  I know
most help here is "free" as many things on the net are, but I'm an honest
guy trying to get a good answer.  I'll offer $50 to the first person that
answers this and get's this program to work!

Okay ... here it is.  Simple for any PERL expert I figure.

I've attached to this email:  4 perl scripts and two HTML forms (they are
VERY basic), any butthead like me can understand them!

The perl scripts are A0,A1,A2,A3.  Put them in your cgi-bin
directory.  The form(s) put in your httpd accessible directory, so you can
execute them against the scripts.

You will note that form2.html works.  You will note that form.html DOES
NOT work!  If you can get form.html to work with A0 (A0 pipes to A2) just
like form2.html works with A3 then I WILL PAY you.  Of course, you have to
send me the corrected code (! this isn't a contest ;) ), which probably
means modifying perl scripts A0 and A2. 

You will note the script A1 is not called by any of the forms.  The reason
I've included it is to show that my basic concept works.  I think I've
just got to figure out how to get all the file handles and pipes straight
to get it to work how I want, in the web envirnonment (A1 with A2 works at
the bash prompt for me).

If you want to see my concept work, then just pipe input to A1, like this:
(this is how I do it anyway):

	From the bash prompt>  echo stuff|A1 <return>

>From there, you will see it work.  Anyway, if you know perl and html and
piping, then you'll know this I hope.

Pretty basic stuff, huh?  Except I cant figure it out!!! So, your help is
greatly appreciated and will be rewarded to the FIRST PERSON ONLY that
helps.

Sincerely,
Bob Counts
rcount1@gmu.edu

---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=A0
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.970215190333.11570C@apollo.gmu.edu>
Content-Description: 

IyEvdXNyL2Jpbi9wZXJsIC0tIC0qLXBlcmwtKi0NCg0KDQpzdWIgZG9fcG9z
dF9yZWFkIHsNCg0KcmVhZChTVERJTiwgJGJ1ZmZlciwgJEVOVnsnQ09OVEVO
VF9MRU5HVEgnfSk7DQpAcGFpcnMgPSBzcGxpdCgvJi8sICRidWZmZXIpOw0K
Zm9yZWFjaCAkcGFpciAoQHBhaXJzKQ0Kew0KICAgICgkbmFtZSwgJHZhbHVl
KSA9IHNwbGl0KC89LywgJHBhaXIpOw0KDQogICAgIyBVbi1XZWJpZnkgcGx1
cyBzaWducyBhbmQgJS1lbmNvZGluZw0KICAgICR2YWx1ZSA9fiB0ci8rLyAv
Ow0KICAgICR2YWx1ZSA9fiBzLyUoW2EtZkEtRjAtOV1bYS1mQS1GMC05XSkv
cGFjaygiQyIsIGhleCgkMSkpL2VnOw0KDQogICAgJEZPUk17JG5hbWV9ID0g
JHZhbHVlOw0KfQ0KDQojICAkRk9STXsnaWQnfSBpcyB3aGF0IGlzIHBhc3Nl
ZCAoYmFzaWNhbGx5IHRoZSBTSUQpLg0KIyAgZnJvbSB0aGUgSFRNTCBjYWxs
aW5nIGZvcm0NCg0KJHBhdHRlcm4gPSAiJEZPUk17J2lkJ30iOw0KDQp9ICAj
IGVuZCBzdWJyb3V0aW5lIGRvX3Bvc3RfcmVhZA0KDQoNCg0Kc3ViIGRvX290
aGVyX3Blcmxfc2NyaXB0IHsNCg0Kb3BlbiAoR1VFU1QsInxBMiIpIHx8IGRp
ZSAiQ2FuJ3QgT3BlbiBBMiBcbiI7DQpwcmludCBHVUVTVCAiJHBhdHRlcm4i
Ow0KY2xvc2UgKEdVRVNUKTsNCg0KfSAjIGVuZCBzdWIgZG9fb3RoZXJfcGVy
bF9zY3JpcHQNCg0KDQoNCmRvX3Bvc3RfcmVhZDsNCg0KZG9fb3RoZXJfcGVy
bF9zY3JpcHQ7DQoNCg0KDQojIEVORCBQUk9HUkFNDQo=
---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=A1
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.970215190333.11570D@apollo.gmu.edu>
Content-Description: 

IyEvdXNyL2Jpbi9wZXJsIC0tIC0qLXBlcmwtKi0NCg0KDQp3aGlsZSAoPD4p
IHsNCiRwYXR0ZXJuID0gJF87DQojIGNob3AoJHBhdHRlcm4pOw0KcHJpbnRm
ICIlMTVzXG4iLCAkcGF0dGVybjsNCnByaW50ZiAiXG4iOw0KcHJpbnRmICJT
ZW5kIFBhdHRlcm4gdG8gdGhlIG5leHQgcHJvY2VzcyBcblxuXG4iOw0KfQ0K
DQpvcGVuIChHVUVTVCwifEEyIik7DQpwcmludCBHVUVTVCAiJHBhdHRlcm4i
Ow0KY2xvc2UgKEdVRVNUKTsNCg0KIyBlbmQgYTENCg==
---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=A2
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.970215190333.11570E@apollo.gmu.edu>
Content-Description: 

IyEvdXNyL2Jpbi9wZXJsIC0tIC0qLXBlcmwtKi0NCg0KIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMNCiMgQTIgY2dpIHNjcmlwdA0KIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMNCg0KIwlyZWFkIGl0IGZyb20g
QVJHVg0KIw0KDQoNCnN1YiBkb19hcmd2X3JlYWQgew0Kd2hpbGUgKDw+KSB7
DQokcGF0dGVybiA9ICRfOw0KY2hvcCgkcGF0dGVybik7DQp9DQoNCn0gIyBl
bmQgZG9fYXJndl9yZWFkDQoNCg0KZG9fYXJndl9yZWFkOw0KDQpwcmludCAi
Q29udGVudC10eXBlOiB0ZXh0L2h0bWxcblxuIjsNCnByaW50ICI8aGVhZD48
dGl0bGU+U3R1ZmYgSGVyZTwvdGl0bGU+PC9oZWFkPlxuIjsNCnByaW50ICI8
aDIgYWxpZ249Y2VudGVyPlN0dWZmIDwvaDI+PGhyPlxuIjsNCnByaW50ICJZ
b3UgRW50ZXJlZCA8YnI+XG4iOw0KcHJpbnQgIjxiPiRwYXR0ZXJuPC9iPiBc
biI7DQpwcmludCAiPC9odG1sPlxuIjsNCg0K
---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME=A3
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.970215190333.11570F@apollo.gmu.edu>
Content-Description: 

IyEvdXNyL2Jpbi9wZXJsIC0tIC0qLXBlcmwtKi0NCg0KDQpzdWIgZG9fcG9z
dF9yZWFkIHsNCg0KcmVhZChTVERJTiwgJGJ1ZmZlciwgJEVOVnsnQ09OVEVO
VF9MRU5HVEgnfSk7DQpAcGFpcnMgPSBzcGxpdCgvJi8sICRidWZmZXIpOw0K
Zm9yZWFjaCAkcGFpciAoQHBhaXJzKQ0Kew0KICAgICgkbmFtZSwgJHZhbHVl
KSA9IHNwbGl0KC89LywgJHBhaXIpOw0KDQogICAgIyBVbi1XZWJpZnkgcGx1
cyBzaWducyBhbmQgJS1lbmNvZGluZw0KICAgICR2YWx1ZSA9fiB0ci8rLyAv
Ow0KICAgICR2YWx1ZSA9fiBzLyUoW2EtZkEtRjAtOV1bYS1mQS1GMC05XSkv
cGFjaygiQyIsIGhleCgkMSkpL2VnOw0KDQogICAgJEZPUk17JG5hbWV9ID0g
JHZhbHVlOw0KfQ0KDQojICAkRk9STXsnaWQnfSBpcyB3aGF0IGlzIHBhc3Nl
ZCAoYmFzaWNhbGx5IHRoZSBTSUQpLg0KIyAgZnJvbSB0aGUgSFRNTCBjYWxs
aW5nIGZvcm0NCg0KJHBhdHRlcm4gPSAiJEZPUk17J2lkJ30iOw0KDQp9ICAj
IGVuZCBzdWJyb3V0aW5lIGRvX3Bvc3RfcmVhZA0KDQoNCg0KZG9fcG9zdF9y
ZWFkOw0KDQoNCg0KcHJpbnQgIkNvbnRlbnQtdHlwZTogdGV4dC9odG1sXG5c
biI7DQpwcmludCAiPGhlYWQ+PHRpdGxlPlN0dWZmIEhlcmU8L3RpdGxlPjwv
aGVhZD5cbiI7DQpwcmludCAiPGgyIGFsaWduPWNlbnRlcj5TdHVmZjwvaDI+
PGhyPlxuIjsNCnByaW50ICJZb3UgRW50ZXJlZDogPGJyPlxuXG4iOw0KcHJp
bnQgIjxiPiRwYXR0ZXJuIDwvYj5cbiI7DQpwcmludCAiPC9odG1sPlxuIjsN
Cg0KDQoNCiMgRU5EIFBST0dSQU0NCg==
---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="form.html"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.970215190333.11570G@apollo.gmu.edu>
Content-Description: 

PEhUTUw+DQo8SEVBRD4NCjxUSVRMRT4NCkZPUk0NCjwvVElUTEU+DQo8L0hF
QUQ+DQo8Qk9EWT4NCg0KPEgxPg0KRm9ybQ0KPC9IMT4NCg0KPEhSPg0KDQo8
Rk9STSBtZXRob2Q9UE9TVCBhY3Rpb249Ii9jZ2ktYmluL0EwIj4NCg0KRW50
ZXIgYW55dGhpbmcgdXAgdG8gOSBjaGFyYWN0ZXJzIDxicj4NCjxJTlBVVCBz
aXplPTEwIG1heGxlbmd0aD05IE5BTUUgPSAiaWQiPg0KDQo8UD4NCjxJbnB1
dCBUWVBFPSJzdWJtaXQiIFZBTFVFPSIgIFN1Ym1pdCAiPg0KPElucHV0IFRZ
UEU9InJlc2V0IiBWQUxVRT0iQ2xlYXIgRW50cnkiPjxwPg0KPC9Gb3JtPg0K
DQo8SFI+DQoNCjxBRERSRVNTPg0KIA0KPC9CT0RZPg0KPC9IVE1MPg0KICAg
ICAgDQoNCg==
---1367254991-424575104-856051351=:11548
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="form2.html"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.3.95.970215190333.11570H@apollo.gmu.edu>
Content-Description: 

PEhUTUw+DQo8SEVBRD4NCjxUSVRMRT4NCkZPUk0NCjwvVElUTEU+DQo8L0hF
QUQ+DQo8Qk9EWT4NCg0KPEgxPg0KRm9ybQ0KPC9IMT4NCg0KPEhSPg0KDQo8
Rk9STSBtZXRob2Q9UE9TVCBhY3Rpb249Ii9jZ2ktYmluL0EzIj4NCg0KRW50
ZXIgYW55dGhpbmcgdXAgdG8gOSBjaGFyYWN0ZXJzIDxicj4NCjxJTlBVVCBz
aXplPTEwIG1heGxlbmd0aD05IE5BTUUgPSAiaWQiPg0KDQo8UD4NCjxJbnB1
dCBUWVBFPSJzdWJtaXQiIFZBTFVFPSIgIFN1Ym1pdCAiPg0KPElucHV0IFRZ
UEU9InJlc2V0IiBWQUxVRT0iQ2xlYXIgRW50cnkiPjxwPg0KPC9Gb3JtPg0K
DQo8SFI+DQoNCjxBRERSRVNTPg0KIA0KPC9CT0RZPg0KPC9IVE1MPg0KICAg
ICAgDQoNCg==
---1367254991-424575104-856051351=:11548--


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

Date: Sun, 16 Feb 1997 13:18:51 GMT
From: posenj@lancet.co.za (Kevin Posen)
Subject: Learning perl from scratch
Message-Id: <5e71ga$ge7@news1.saix.net>

Hi.

I've recently started to learn Perl using an HTML manual that I received with the Perl5 .zip file
(it contains perl.html, perltoc.html, perldata.html, etc.). The problem is that, although I have
been programming for about 5 years, I have only used Pascal and BASIC for DOS -- never Unix, sed,
awk or C. The manual assumes a fair amount of background from those and so I have run into many
incomplete explanations and I'm finding it very difficult to follow the manual.

Does anyone know of a manual that would be better? Or can anyone suggest a route/method for me to go
about learning it more easily?

(One of the things I'm having trouble on is why does
	/^\d+$/;
check if something is a whole number?)

Thanks a lot.

Kevin Posen



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

Date: Sun, 16 Feb 1997 00:51:09 -0600
From: webmaster@americhat.com
To: webmaster@americhat.com
Subject: Locate/check/save image given a url
Message-Id: <856075330.6251@dejanews.com>

Help...

>From a form, that will ask for an image url, i need to pull in that image
and save it to a directory in my server.   Anyone know how to do this...
I need to be able to tak in JPG and GIF images only.


Thank you
RSJ

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Sat, 15 Feb 1997 21:32:25 -0500
From: Richard Watkins <rwatkins@crosslink.net>
Subject: Need Some CGI Security Advise
Message-Id: <330671B9.50C1@crosslink.net>

I am considering placing some limited security into some of my web pages
via adding a REMOTE_HOST or REMOTE_ADDR lookup of an incoming surfer to
certain page.  Is it possible to create a "authorized list" type of file
that lists all authorized IP addresses or Domain names that are
authorized to visit this site?  This file must be protected and lookup
by the Perl script for authorization and deny access to all others. I
know the server admin people can place some user IP restrictions on my
pages in concern, but I'm avoiding bothering those guys when possible.
The web pages concerned are not really sensitive, but some of my company
people are putting pressure on me to develop some limited security into
my web site (I'm just hosting pages and have a shell account to store
CGIs and web pages).  I can't seem to find any examples of this - Please
help if you having any suggestions or know a site that shows some
examples.
Thanks, Rick       rwatkins@crosslink.net


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

Date: Sat, 15 Feb 1997 21:32:12 -0800
From: Devin Ben-Hur <dbenhur@emarket.com>
To: Geoffrey Baker <editor@mbeacon.com>
Subject: Re: newlines and textarea boxes
Message-Id: <33069BDC.2CC8@emarket.com>

Geoffrey Baker wrote:
> My problem is that I have a textarea box which the user inputs info into.
> I cannot get it to format the text properly. I can get it to replace a
> newline with a <BR> command, but I cannot get it to replace two newlines
> with a <P> command!
> Here is a snippet:
> The following line takes output from a textarea box named "conditions" and
> replaces newlines with <BR> tags.
>         $in{'conditions'} =~ s!\n!<BR>!g;
> 
> However, this line:
> $in{'conditions'} =~ s!\n\n!<P>!g;
> 
> will NOT replace two newlines with a <P> tag.

In what order do you execute these two lines?  If you do the <BR>
replacement first, there will be no more "\n\n"s in the string
to replace with <P>.

Another possibility is that your Mac or PC browser is sending
line-breaks in a format specific to their host (\r for Mac 
\r\n for DOS/Windows).  Try accommodating all variations:

$text =~ s/\r\n/\n/g;	# fix DOS
$text =~ s/\r/\n/g;	# fix Mac
$text =~ /\n\n/<P>/g;	# blank lines -> paragraphs
$text =~ /\n/<BR>/g;	# hard lines -> HTML BReak

HTH
--
Devin Ben-Hur      <dbenhur@emarket.com>
eMarketing, Inc.   http://www.emarket.com/
"Don't run away. We are your friends."  O-



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

Date: 16 Feb 1997 03:15:59 GMT
From: fine@net.ohio-state.edu ("Thomas A. Fine")
Subject: Re: overwriting in-memory password
Message-Id: <5e5u5f$q25@charm.magnus.acs.ohio-state.edu>

nvp@shore.net (Nathan V. Patwardhan) writes:
>Thomas A. Fine (fine@net.ohio-state.edu) wrote:
>: than necessary.  What's the correct way to _guarantee_ that I've removed
>: it from memory after use?
>
>undef $varname;

I don't just want to free the memory, I want to physically clear it first.
The point is that a clever evil type could rummage through /dev/kmem, or
through a core dump, and potentially find a password (or a lot of passwords
depending on how perl works deep down).

I don't know anything about perl internals, but I would guess that simply
assigning a new value e.g. $password="string of garbage"; wouldn't necessarily
overwrite, but may simply assign some pointer to the location of the string,
and free the old pointer, leaving the password floating around in purgatory
awaiting its ultimate fate.

What I want is to have some great wizard of the internals of perl come along
and say "Blessed art the ways of substr()", or some such nonsense.

Thus far, I've checked man pages, the Camel Book, and www.perl.com.  All
I've discovered is that it's been far too long since I've read Lord of
the Rings :-/.

      tom


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

Date: 16 Feb 1997 06:49:30 GMT
From: Dave Hammen <hammen@gothamcity.jsc.nasa.gov>
Subject: Re: perl in varied environment
Message-Id: <5e6alq$l0o@cisu2.jsc.nasa.gov>

[posted and mailed]

Terry Gorby, tgorby@emc.com writes:
>I am using perl in a unix environmet
>that is widely varied.  I have to live with for now.
>Perl can reside in /usr/local/bin, /usr/local/SOLARIS/bin,
>or in /home/bin.
>
>I would like my perl scripts to execute the available
>perl binary depending on the environment.
>Is this possible? If so, may I see an example?

The perlrun man page contains the start of a solution to this problem.
Here's a 'Hello world' script that runs on the machines in
my non-homogenous UN*X environment:

#!/bin/sh -- # -*- perl -*-  -w
eval 'exec perl -S $0 ${1+"$@"}'
if 0;
print "Hello, @ARGV\n";


A line-by-line interpretation:
   #!/bin/sh
      Invokes Bourne shell, which begins interpreting the script.
      I'll get back to the rest of the line later.

   eval 'exec perl -S $0 ${1+"$@"}'
      Bourne shell execs whatever perl *is in your $PATH* with
      the original arguments passed to perl intact. The -S
      flag causes perl to search the PATH environment variable
      for the script if needed.

   #!/bin/sh -- # -*- perl -*-  -w
      Perl scans this line and sees the word perl (good) and
      the -w flag (even better).  

   eval 'exec perl -S $0 ${1+"$@"}'
      This could cause serious problem, i.e., a fork bomb.
   if 0;
      This line kills that problem. Perl sees the eval
      statement as a big no-op. Its a perfectly legal perl
      no-op, so perl will continue to interpret the script.

   print "Hello, @ARGV\n";
      You might want to replace this line with a whole bunch
      of lines that do something a bit more meaningful.


The only trick then is making sure that your path is set correctly
on each machine, which is a problem not at all unique to perl.


Hope that helps,

-- 
Dave Hammen / LinCom Corporation


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

Date: 16 Feb 1997 02:15:57 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: playing w/the $`,$&, and &' vars
Message-Id: <slrn5gcr9n.ru7.dave@fast.thomases.com>

On Sat, 15 Feb 1997 19:32:42 -0600, Lyle <pirwani@blue.weeg.uiowa.edu> wrote:
 
> Hi!  I've been working on a script to fix parenthesis usage in ascii
> text.  Bascically what I want to do is insert a single space after every
> occurance of a ( on a line, and insert a space before every occurance of )
> on a line.
 
> This works fine until it encounters a line like
> (      text     )> which it turns into> (       text     ).
   
> What I'd like to do is chop up the $' var and insert it back into the
> string, ie
> 
>   $' =~ s/(\s+)\b//;


Well, the first thing I'd suggest is avoiding $' and friends totally - you
don't need them for this example and if you get into the habit of using them
you'll incurr a big performance hit in some more intensive pattern matching
program somewhere down the road.

I'm not too sure whether you're trying to make sure there's always exactly
one space after '(' and before ')'. If so, you could use something like:

   s/\(\s*/( /g;
   s/\s*)/ )/g;
   
Alternatively, if you just don't want to change the spaces around
parentheses that already have spaces, you could use:

   s/\((?!\s)/( /g;   # uses zero width negative look-ahead
   s/[^\s])/ )/g;    # and a plain old character class
   

Hope this helps

Dave



-- 

 _________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Sat, 15 Feb 1997 21:48:06 -0800
From: Devin Ben-Hur <dbenhur@emarket.com>
To: Lyle <pirwani@blue.weeg.uiowa.edu>
Subject: Re: playing w/the $`,$&, and &' vars
Message-Id: <33069F96.7C58@emarket.com>

Lyle wrote:
> Bascically what I want to do is insert a single space after every
> occurance of a ( on a line, and insert a space before every occurance of )
> on a line.
>     s/\(/$& /g;
>     s/\)/ $&/g;
> This works fine until it encounters a line like
> (      text     )
> which it turns into
> (       text     ).
> What I'd like to do is chop up the $' var and insert it back into the
> string, ie
>   $' =~ s/(\s+)\b//;
> and then append the new $' back in.  Unfortuantely the $' is read only!
> Besides, since I substitute all the ('s and )'s globally, this method
> would only work for the last located ( ...

No need to mess with $', just write a smarter regex.  (for that matter,
you didn't need to interpolate $& in your replacement either).

This will insist on one and only one space before/after ():
s/\(\s*/( /g;
s/\s*\)/ )/g;

While this will add a space if it doesn't already exist, but
won't collapse existing spaces:

s/\((?\S)/( /g;  # subst all '(' not followed by \s
s/(\S)\)/$1 )/g; # subst all ')' preceeded by non \s

HTH
--
Devin Ben-Hur      <dbenhur@emarket.com>
eMarketing, Inc.   http://www.emarket.com/
"Don't run away. We are your friends."  O-



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

Date: 16 Feb 1997 10:57:06 GMT
From: neilb@zetnet.co.uk (Neil S. Briscoe)
Subject: Re: Porting Perl from UNIX to NT
Message-Id: <memo.970216105539.4303G@zetnet.co.uk>

In article <E5K1rM.1qo@actcom.co.il>, syoung@actcom.co.il
(Sara Young) wrote:

> How hard is it to port Perl scripts from UNIX to NT?  Will I
be able to
> do
> such a thing, as a UNIX programmer (no experience with NT)?
>
> Thanks in advance,
>

Some things you can't do at all - for instance, forget about
forking and waiting for child processes.  Visit
www.perl.hip.com and read the FAQ's there - they'll tell you
all about it.

Regards
Neil




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

Date: 16 Feb 1997 14:28:24 GMT
From: duplanti@enstb.enst-bretagne.fr (DUPLANTIER Bastien)
Subject: Re: PROGRAM: how to check for nice/valid email address
Message-Id: <5e75i8$3gg@alfali.enst-bretagne.fr>

where could i get the Tom Christiansen's article about this subject?
'cause i'm a new news reader, so i can't get it...

thank you for reply...

-- 
 --------------------------------------------------
 Bastien DUPLANTIER  	       tel : 02 98 00 18 16 
 add : ENSTB technopole Brest-Iroise 29280 PLOUZANE 
 http://www-eleves.enst-bretagne.fr/~duplanti       





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

Date: Sun, 16 Feb 1997 23:40:24 +1100
From: womlake@zip.com.au
Subject: Question Answer Script
Message-Id: <33070038.2DEE@zip.com.au>

Hello Perl Gurus,
I'm just starting out in Perl and was after a script that displays a
questionnaire on screen with say 10 multiple choice questions. After the
questions are answered, results are displayed eg 7/10 correct as well as
answers given to the incorrect responses.
Does anyone know of a freebie I can get hold of, so I can fathom through
the script and see how to do it?
Thanks,
Warren


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

Date: 15 Feb 1997 23:48:11 GMT
From: dlinsalata@equinox.net (Drew Linsalata)
Subject: Re: Socket Programming Question
Message-Id: <dlinsalata-1502971847270001@dialup8.equinox.net>

> Actually it was a generic "how do I read from the socket after
> I send the request question".  Anyway I got my answer from
> another poster.  Thanks though.


And that was ? ...

I could use that info myself, if you still have the post.

Thanks in advance.

Drew


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

Date: 16 Feb 1997 12:40:57 GMT
From: "Owen Singleton" <owen,singleton@dial.pipex.com>
Subject: Sorting a multi dimensional Array
Message-Id: <01bc1c05$b9763fc0$a6f282c1@ozalu01>

I am new to Perl and can't seem to figure how to sort a multi dimensional
array for a dynamic HTML creation script I'm writing (using the CGI-LIB.pl
library).  The array is built up from a tab deliminated text file using the
following code:

sub BuildArray {
	open (nlcbdata, "awards.txt") or die "can't open data file: $!\n";
	while (<nlcbdata>) {	
		@temp = split /\t/;
		if ($temp[$FieldPosition{$in{SearchType}}]=~/$in{Criteria}/i) {
			for $i (0..6) {$result[$count][$i] = $temp[$i] };
		$count++
		}			
	}

As you can see the text file is parsed to meet the supplied criteria and
each matched line is placed in @result

I then print it out using:

sub PrintResult {
	if ($#result < 1) {
		print '<b>The query did not return any records.<b>';
	}
	else {	
		print '<b>The query returned '.($#result + 1).' records<b>';
		&BeginTable;
		for $i (0..$#result) {
			print '<tr>'."\n";
			print '<td
valign="top">'.$result[$i][$FieldPosition{LAAREA}].'</td>'."\n";
			print '<td
valign="top">'.$result[$i][$FieldPosition{OrgName}].'</td>'."\n";
			print '<td
valign="top">'.$result[$i][$FieldPosition{Summary}].'</td>'."\n";
			print '<td valign="top">#'.commify
$result[$i][$FieldPosition{Award}].'</td>'."\n";
		#	print '<td valign="top">&nbsp</td>'."\n";
			print '</tr>'."\n";
		}
		print '</table>'."\n";
	}
}


Unfortunately @result is printed in the order it is created.  I'd like to
be able to sort on any one of the six columns determined by input from my
HTML form.

Any help would be greatly appreaciated.

For reference here's the whole program:

require "cgi-lib.pl";


&Main;


sub Main {
	print &HtmlTop;
	&ReadParse();
	&SetFieldPositions;
	&BuildArray;
	&PrintResult;
	print &HtmlBot;
}

sub commify {
	    local($_) = shift;
	    1 while s/^(-?\d+)(\d{3})/$1,$2/;
	    return $_;
	}

sub SetFieldPositions {
	%FieldPosition = (
		OfficeID 	=> 0,
		Office 		=> 1,
		URN 		=> 2,
		OrgName 	=> 3,
		Summary		=> 4,
		Award		=> 5,
		LAAREA		=> 6,
	);
}

sub BuildArray {
	open (nlcbdata, "awards.txt") or die "can't open data file: $!\n";
	while (<nlcbdata>) {	
		@temp = split /\t/;
		if ($temp[$FieldPosition{$in{SearchType}}]=~/$in{Criteria}/i) {
			for $i (0..6) {$result[$count][$i] = $temp[$i] };
		$count++
		}			
	}
}
sub PrintResult {
	if ($#result < 1) {
		print '<b>The query did not return any records.<b>';
	}
	else {	
		print '<b>The query returned '.($#result + 1).' records<b>';
		&BeginTable;
		for $i (0..$#result) {
			print '<tr>'."\n";
			print '<td
valign="top">'.$result[$i][$FieldPosition{LAAREA}].'</td>'."\n";
			print '<td
valign="top">'.$result[$i][$FieldPosition{OrgName}].'</td>'."\n";
			print '<td
valign="top">'.$result[$i][$FieldPosition{Summary}].'</td>'."\n";
			print '<td valign="top">#'.commify
$result[$i][$FieldPosition{Award}].'</td>'."\n";
		#	print '<td valign="top">&nbsp</td>'."\n";
			print '</tr>'."\n";
		}
		print '</table>'."\n";
	}
}

sub BeginTable {
	print '<table border="1">'."\n";
    print '<tr>'."\n";
    print '<td valign="top"><p align="center"><font color="#000080"
size="5"><b>Local Authority Area</b></font></p></td>'."\n";
    print '<td valign="top"><p align="center"><font color="#000080"
size="5"><b>Organisation</b></font></p></td>'."\n";
    print '<td valign="top"><p align="center"><font color="#000080"
size="5"><b>Summary</b></font></p></td>'."\n";
    print '<td valign="top"><p align="center"><font color="#000080"
size="5"><b>Award Amount</b></font></p></td>'."\n";
#   print '<td valign="top"><p align="center"><font color="#000080"
size="5"><b>Total for Area</b></font></p></td>'."\n";
    print '</tr>'."\n";
}




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

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 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.

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 V7 Issue 958
*************************************

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