[10994] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4594 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 8 17:07:17 1999

Date: Fri, 8 Jan 99 14:00:21 -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           Fri, 8 Jan 1999     Volume: 8 Number: 4594

Today's topics:
    Re: "internal server error" <webpages@email.com>
    Re: Automated site indexing (and more) with perl?! (Abigail)
    Re: best way to track time in a script for tuning? <dtbaker-@busprod.com>
    Re: best way to track time in a script for tuning? (brian d foy)
        calling ksh functions from perl <kvraman@lucent.com>
    Re: Can't find my way with a map (Abigail)
    Re: Checking for a Charictor in a Variable (Abigail)
        Contractor wanted <rupert.connelly@brunel.ac.uk>
    Re: Contractor wanted (brian d foy)
        excel file handling <walkerspace@yahoo.com>
    Re: filename from a filehandle (Abigail)
    Re: Help - cookies; check if a browser is set to accept (Abigail)
    Re: If Larry Wall's listening out there.... (Abigail)
    Re: Iternation of a loop, and why the hell doesn't this (Abigail)
    Re: Nasty regexp .... I'm stumped. (Abigail)
    Re: Need CGI database (Abigail)
    Re: ODBC Drivers <jwarner@tivoli.com>
    Re: Password Encryption (Abigail)
    Re: Password Encryption (Abigail)
        proper MIME type set up jason_longo@my-dejanews.com
    Re: Shame: Deleting List Elements (Abigail)
    Re: Short way to do this with a regexp?? Delete certain (Abigail)
        utmp / who <dwatanab@uci.edu>
    Re: Windows NT  - FrontPage server --   CGI - perl scri (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 08 Jan 1999 22:53:33 +0100
From: Eirik Johansen <webpages@email.com>
Subject: Re: "internal server error"
Message-Id: <36967E5C.733626E0@email.com>

Who wants to learn Perl after feedback like this???

When one gets a lot of replies one should probably thank for them, but in
this case, there are few replies to thank for. It's okay to give
constructive critisism, but very little of this critisism is constructive. I

agree that my first posting should'be been clearer, but why don't someone
just say that in a nice way instead of making such a big deal out of how
stupid I am.

Before I repost my question, I would like to say something to some of the
people replying to my message:

Abigail: What's your problem? Did you actually read my posting? The first
line goes something like this: "I've just started learning Perl..." Did it
ever occur to you that I either know what "-w" "use strict" or modules are
nor do I know how to use them. I'm supposing that modules are some pre-made
scripts since you say they are "made by people with a clue".(It's probably
not!) Well, you obviously didn't read the rest of the the first sentence,
cause it goes something like this: "...and I recently modified a CGI-script"

And did it ever occour to you that I might want to "have a clue" myself
someday? And the only way to leraning this, is by doing it myself !
I'm eager to learn CGI-scripting - so what if I "don't have the appropriate
environment to test my work with."? I want to learn it just the same, and I
will too, you'll see. And that I didn't give you an error message. The only
error message I can give is in the subject line, you see THAT'S THE PROBLEM.

If I had an error msg, I would've worked out the problem myself.

There - that's some constructive critisism for you. Try using it sometime,
instead of telling people to crawl under a rock (are you sure that your
daddy allows you to play with the computer?)


Bart Lateur:
Thanks for actually caring about helping a novice. The other posters have
got a lot to learn from you !

Okay, let's rewind this tape and start from the top.........<<............

Hi!

I have a problem with a CGI script which I altered. The script is a usual
mil-the-form
script which sends tha data of the form to someones (my) E-mail adress. I
altered the script a little so that it would read the recipient and the
subject-line from a two hidden-fields in the the form, and added the
following line:

$value =~ s/%40/@/;

and I also changed the output HTML-code to suit my needs. But when I hit the

submit-button I get a page in the web-browser with the following msg:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable
to complete your request.

Please contact the server administrator, webmaster@bardblikk.no and inform
them of the time the error occurred, and anything
you might have done that may have caused the error.


The form can be found at http://home.sol.no/~webpages/mailform.htm and a
copy of the script in *.txt version can be located at
http://home.sol.no/~webpages/mailform.txt

I would appriciate any help you can give my !

Regards

Eirik Johansen
A NEWBIE IN CGI AND PERL!!!




Eirik Johansen wrote:

> Hi !
>
> I've just started learning Perl and I recently modified a CGI-skripy,
> but now it won't work and I don't know why. Would someone be as kind as
> to rund it un their Unix shell (I don't have Unix) and tell me which
> line makes the error.
>
> Thanks so very much !
>
> Regards
>
> Eirik Johansen
>
> #!/usr/bin/perl
>
> # This script will take information from a form
> # and place it in a mail to the desired recipent
>
> print "Content-type:text/html\n\n";
>
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ tr/%40/@/;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $FORM{$name} = $value;
> }
>
> $mailprog = '/usr/sbin/sendmail';
>
> # this opens an output stream and pipes it directly to the sendmail
> # program. If sendmail can't be found, abort nicely by calling the
> # dienice subroutine (see below)
>
> open (MAIL, "|$mailprog -t") or &dienice("Can't access $mailprog!\n");
>
> # here we're printing out the header info for the mail message. You must
>
> # specify who it's to, or it won't be delivered:
>
> print MAIL "To: $FORM{$recipient}\n";
>
> # In case the owner of the form has any questions, I'll set the
> # reply-adress as my own
>
> $reply = 'webpages@email.com';
>
> print MAIL "Reply-to: $reply\n";
>
> # print out a subject line so you know it's from your form cgi.
> # The two \n\n's end the header section of the message. Anything
> # you print after this point will be part of the body of the mail.
>
> print MAIL "Subject: $FORM{$subject}\n\n";
>
> # here you're just printing out all the variables and values, just like
> # before in the previous script, only the output is to the mail message
> # rather than the followup HTML page.
>
> foreach $key (keys(%FORM)) {
> print MAIL "$key = $FORM{$key}\n";
> }
>
> # when you finish writing to the mail message, be sure to close the
> # input stream so it actually gets mailed.
>
> close(MAIL);
>
> # now print something to the HTML page, usually thanking the person
> # for filling out the form, and giving them a link back to your homepage
>
> print <<EndHTML;
> <h2>Thank You</h2>
> Thank you for writing. Your mail has been delivered.<p>
> Do you want a form like this one? Then visit <a
> href="http://webpages.findhere.com" target="_top">The Webpage of
> Webpages</a>
> </body></html>
> EndHTML
> ;
>
> sub dienice {
> ($errmsg) = @_;
> print "<h2>Error</h2>\n";
> print "$errmsg<p>\n";
> print "</body></html>\n";
> exit;
> }



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

Date: 6 Jan 1999 17:29:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Automated site indexing (and more) with perl?!
Message-Id: <7706ij$pdt$3@client3.news.psi.net>

luebbert@sfs-dortmund.de (luebbert@sfs-dortmund.de) wrote on MCMLIV
September MCMXCIII in <URL:news:76vgim$6h6$1@nnrp1.dejanews.com>:
## 
## I am quite a Perl newbie ( to warn you ;-))..
## 
## I am looking for a perl script that automates the
## development and use of a surface for our intranet file system.
## 
## [ .... ]
##
## Does anyone understand me? ;-)) Does anyone know such a script or even some
## fragments that would do the job?


So, what's your Perl question?



Abigail


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

Date: Fri, 08 Jan 1999 15:40:55 -0600
From: Dan Baker <dtbaker-@busprod.com>
Subject: Re: best way to track time in a script for tuning?
Message-Id: <36967B67.ADF94A92@busprod.com>

Michael Mongeau wrote:
> 
> perldoc Benchmark

-----------
close, but from the docs it looks like the maximum granularity of
Benchmark is in full seconds.... would be hard for me to pull the code
apart at this stage to run loops because lots of args and stuff are set
up in browser/cgi communication. I would much rather have something I
could insert that will record actual msecs at runtime on the server if
possible.

Thanx, Dan

# If you would like to reply-to directly, remove the - from my username
* no spam please... regulated by US Code Title 47, Sec.227(a)(2)(B)  *


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

Date: Fri, 08 Jan 1999 16:57:45 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: best way to track time in a script for tuning?
Message-Id: <comdog-ya02408000R0801991657450001@news.panix.com>

In article <369668E2.59B9992B@busprod.com>, Dan Baker <dtbaker-@busprod.com> posted:

> I'm looking for tips and hints on good methods to do some final tuning
> on scripts... I have some that are running, but take a little longer
> than I expect. Are there good ways to throw in some prints that will
> show the time in msec or something like that so I can narrow down what
> areas need tuning?

have you tried the Devel::DProf or ::SmallProf modules?

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Fri, 08 Jan 1999 15:21:43 -0600
From: Venkatraman Krishnan <kvraman@lucent.com>
Subject: calling ksh functions from perl
Message-Id: <369676E6.7494240A@lucent.com>

Hi,

How can I call functions implemented in ksh shell scripts from perl?

Regards,
Venky




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

Date: 6 Jan 1999 17:35:49 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Can't find my way with a map
Message-Id: <7706tl$pdt$4@client3.news.psi.net>

Jerry Pank (jerryp.usenet@connected.demon.co.uk) wrote on MCMLIV
September MCMXCIII in <URL:news:DR2nTBAvx4k2EwgS@connected.demon.co.uk>:
"" I want to use map to remove leading/trailing quotes that may exist in a
"" tab delimited file:
"" 
"" Something along the lines of:
"" 
""         @data = map { s/^"|"$//g; } split /\t/, $line;
"" 
"" What do I need to change so @data is the result of the s/// rather than
"" the number of matches?
"" 
"" I can obviously do this in two lines but one would be neater and the map
"" answer would satisfy my curiosity.  

s/// doesn't return the modified string. So, you would have to return
the string yourself:

           @data = map {s/^"+//; s/"+$//; $_} split /\t/, $line;

You can, however, get rid of the map:

           @data = split /"*\t"*/, $line;

Although that would be slow if you have many "'s not bordering tabs.



Abigail


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

Date: 6 Jan 1999 21:16:40 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Checking for a Charictor in a Variable
Message-Id: <770jro$s0s$1@client3.news.psi.net>

Artoo (r2-d2@REMOVEbigfoot.com) wrote on MCMLIV September MCMXCIII in
<URL:news:76vkj1$opn$1@plug.news.pipex.net>:
?? 
?? How can you check to see if a character exists with-in a variable.  ie: I
?? need to check there is an @ sign anywhere in the variable inorder to
?? process.


man perlre
perldoc -f index



Abigail


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

Date: Fri, 8 Jan 1999 21:13:59 -0000
From: "Rupert Connelly" <rupert.connelly@brunel.ac.uk>
Subject: Contractor wanted
Message-Id: <915829878.18350.0.nnrp-07.c29fdced@news.demon.co.uk>

London based company is looking for some help writing scripts that will
extract data from html and then load that data into our database.  There is
one to two weeks work and the possibility of a permanent job. Please reply
to cbstroc@brunel.ac.uk  thank you.




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

Date: Fri, 08 Jan 1999 16:56:23 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Contractor wanted
Message-Id: <comdog-ya02408000R0801991656230001@news.panix.com>

In article <915829878.18350.0.nnrp-07.c29fdced@news.demon.co.uk>, "Rupert Connelly" <rupert.connelly@brunel.ac.uk> posted:

> London based company is looking for some help

you might check with the London Perl Mongers <URL:http://london.pm.org>

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Fri, 08 Jan 1999 15:59:13 -0500
From: walker <walkerspace@yahoo.com>
Subject: excel file handling
Message-Id: <369671A1.920C0FBB@yahoo.com>

Anyone can point me to some places for ActiveState Perl + Excel on
Window NT, like example codes? Would appreciate it very much. I borrowed
a simple test file from http://www.mkaz.com/web/perl/xl_oleauto.html,
but just  cann't make it work, such as:

use Win32::OLE
  $xl_app = CreateObject OLE 'Excel.Application' || die $!;
 ............(little others)

Error says:  cann't locate object method "CreateObject" via package
"OLE" at test.txt line 2. I use ActiveState Perl on Window NT. Being a
beginner, details are the best. Thanks ahead.



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

Date: 7 Jan 1999 04:27:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: filename from a filehandle
Message-Id: <771d3b$2le$1@client3.news.psi.net>

Jeff Cieslak (jcieslak@inez.gsfc.nasa.gov) wrote on MCMLIV September
MCMXCIII in <URL:news:3693E3FD.5771FE15@inez.gsfc.nasa.gov>:
~~ Is there an easy way to get the filename that is associated with some (currently
~~ open) filehandle? I can get the device and inode numbers from the 'stat'
~~ function, but I suppose I'm not brainy enough to figure out how (or if) that can
~~ be mapped back to an actual filename.


You can't. In fact, there might be more than one filename (links), or
even no filename at all (after an unlink)!



Abigail


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

Date: 7 Jan 1999 04:28:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help - cookies; check if a browser is set to accept cookies
Message-Id: <771d4v$2le$2@client3.news.psi.net>

Dale Sutcliffe (dales@enhanced-performance.com) wrote on MCMLIV September
MCMXCIII in <URL:news:3693E521.31BC7B2E@enhanced-performance.com>:
[] How do I check if a browser is set to accept cookies?
[] 

You can't.

Note that this isn't a Perl question. For information about cookies,
see the rec.food hierarchie.



Abigail


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

Date: 6 Jan 1999 17:10:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: If Larry Wall's listening out there....
Message-Id: <7705ee$pdt$1@client3.news.psi.net>

Andrew Mayo (andrew@geac.co.nz) wrote on MCMLIV September MCMXCIII in
<URL:news:76urmk$ncd$1@news.akl.netlink.net.nz>:
II  Dear Larry and friends,
II  
II  What a wonderful thing you have wrought.... but there's one small
II  detail.....
II  
II  Those of us working in a Windows environment generally will use notepad as a
II  text editor. Simple-mindedly, notepad does *not* display line numbers. (it
II  also doesn't do brace matching, but this I can live with)

So? vi doesn't display line numbers by default, and nor does emacs. They
probably are responsible for over 95% of the programs written in Perl on
Unix. All you need is ability to jump to a certain line. I cannot imagine
doing any kind of programming in an editor lacking the ability to jump to
a certain line.

Tell me, do Java or C give context? Do they even give a line number on a
run time error?

If you insist on using a primitive editor, you can always do

   perl -wne 'print if (XX - 2) .. (XX + 2)' file

with XX the line number of the error.

II  Unfortunately, perl's syntax checker appears to assume we'll be using
II  something like vi, and so I get things like
II  
II  Missing right bracket at line 101...
II  
II  and with no printed context of where the parser blew up, I have to count
II  lines. This gets rapidly tedious. Particularly since I am not a very
II  experienced Perl programmer, to say the least...
II  
II  I cannot find a command-line switch to give me more detailed error
II  reporting; if there is one, my apologies, but what I really would like is
II  
II  foo(x,y,z
II                ^
II               Missing right bracket at line 101
II  
II  (the ^ is supposed to be just after the z, should your browser mangle the
II  above)

Then put the right amount of spaces there! Djeez. This is news, usually 
read with newsreaders doing fixed width fonts. Assuming everyone else uses
the same proportional font as you do is absurd.

II  Is there any way I can get Perl to print the context of the error message or
II  am I stuck counting lines. If the latter, may I humbly suggest this as an
II  enhancement for a future version?. While you're in there, how about a
II  severity level option for warnings, too, so that the -w flag could take a
II  parameter to indicate just how picky Perl ought to be.

That's being worked on.

II  (note: I raise these because I want to write elegant yet maintainable code
II  and these cons seem to put barriers up in front of me - perhaps illusory
II  ones, of course, were I more knowledgeable)
II  
II  1. Programs rapidly become unreadable if special care isn't taken to comment

Bullshit. A program is as readable as you make it. If you can't make 
readable programs, you aren't a programmer.

II  2. No macro pre-processor (AFAIK) which would let me add a bit of syntactic
II  sugar; most experienced C programmers find #define and #typedef are
II  invaluable for rendering sense out of chaos.

Bullshit. -P gives you the same preprocessor as C. RTFM.
And with source filters, you can use whatever preprocessor you want.

II  3. The variable argument list array is a nice idea but lack of proper
II  subroutine prototypes makes code rather obscure. Yes, I do see the section
II  on Perl 5.003 prototypes but, using VB as an example this time..
II  
II  sub DrawImage(pic as Picture, optional rotation as degrees=zero_degrees)
II  
II  it is relatively clear that the first argument is a picture, and the second,
II  optional argument is the rotation in degrees, with the default being zero
II  (degrees would be defined as an enum, probably, with perhaps four values for
II  0,90,180, and 270 degrees). Also the noiseword 'sub' tells me this routine
II  returns nothing, as does
II  'void' in C - how do I indicate this in Perl?.

You don't. There's no such thing as a fixed return thingy in Perl. What a sub
returns depends on the context. 

As for named arguments with defaults:

   sub DrawImage (%) {
       my %args = (rotation => $zero_degrees, @_);
       die "Inappropriate picture for DrawImage\n"
            unless defined $args {pic} && ref $args {pic} =~ /Picture/;
       ...
   }

II  I don't see how to write Perl code which comes close to being
II  self-documenting in this way, particularly function arguments.
II  
II  A further, related issue is that arguments appear to be passed by reference,
II  so that special care needs to be taken to avoid side-effects and there does
II  not appear to be an easy way for the function prototype to define that an
II  argument or arguments should be passed by value instead, as there is in both
II  C and VB.
II  
II  4. Lack of structures (aka VB types) and enums - at least, I can't find such
II  things. Sure, hashes are very nice, but they're not really the same thing.

Writing an enum package isn't that hard.

II  5. Try as I might, I find the bind operator counter-intuitive. Operating on
II  $_ by default was probably a good idea back when Perl was sort of
II  ancestrally-related to Awk, but having to use $myvar=~.... to get around
II  this still seems peculiar; I may or may not actually be assigning to $myvar
II  depending on whether the right-hand side of the expression is a match or a
II  substitute.

And the problem is?

II  6. Lack of strong typing. There are times when you want to prevent someone
II  from assigning a string to an integer and I don't see how to do this with
II  Perl - in fact, I don't know how to define a variable as being of a specific

die "That's not an integer!" if $var =~ /\D/;

II  type (other than an array, or a hash or a simple variable). Variables just
II  'spring into existence' as they did in early versions of BASIC - which can
II  lead to some very obscure programming errors. Does 'use strict' really help
II  here?.
II  
II  7. Lack of structured exception handling (I may, however, be wrong here, I
II  just haven't found it yet).

That's being worked on.

II  8. No switch() or case statement, leading to nasty indented if... else if
II  type of constructs.

Read the FAQ.

II  I conclude from these observations, some or all of which may turn out to be
II  mistaken, that Perl is suitable for fairly small programs (and indeed, was
II  designed this way, in all fairness) but that large Perl programming projects
II  will need considerable care in order to be maintainable. Has anyone out
II  there had experience in maintaining large (>10,000 line) Perl programs or
II  program suites, and if so, what techniques would you recommend to maximise
II  maintainability, other than the obvious recourse of commenting every line,
II  which is currently what I am doing?.

I use the same techniques as for writing large C, Pascal or whatever
programs.  Maintaining large programs, specially if it's being worked
on by many programmers isn't trivial. But which language is being used
is only a minor aspect.

II  You may think that the notion of writing larger systems in Perl is
II  ludicrous, but consider that if you want platform portability your current
II  mainstream choices are
II  
II  (a) C/C++ - compiled, hence slow development cycle, needs to be rebuilt on
II  each target platform, limited string processing (to say the least), easy to
II  create memory leaks.
II  
II  (b) Java - primitive runtime libraries, lacks powerful string functions,
II  still evolving, not under ANSI or open source control and hence subject to
II  vendor change. Has to be compiled to JVM each time source is changed, unless
II  someone knows of an incremental Java compiler (in which case this would have
II  to be widely available across platforms
II  
II  or
II  
II  (c) Perl - open source, hence widely available for almost all platforms,
II  interpreted, short development cycle, powerful string processing,
II  extendable.
II  
II  As we move to GUI RAD environments under, say, Linux, we need a quick
II  development language, similar to what we have with Visual Basic under
II  Windows. Is Perl going to be that future, or Java, or some other language?.

Why is that everyone thinks only one language has the future? I do not
think so. More and more languages will be used - and more and more will
be considered "mainstream". What the best language for a project is will
depend on several factors. What the program has to do. Which resources 
are available (both for the runtime and the development environment).
What are the preferences of programmers? What are the strong points of
the languages?

I also think there is a future for seamless intergration of languages.
Life would be a lot simpler if I could write a perl program and link
in a C library, a Python module and a Java class. Currently, all I can
do with Perl is link in C (maybe C++ as well), but then I need to know
both C and Perl internals to write the XS. 



Abigail


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

Date: 7 Jan 1999 04:33:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Iternation of a loop, and why the hell doesn't this work?
Message-Id: <771deh$2le$3@client3.news.psi.net>

Jim Matzdorff (syran@best.com) wrote on MCMLIV September MCMXCIII in
<URL:news:770nmj$66a$1@shell18.ba.best.com>:
[] Ok, first question -- does PERL keep a value for the number of times it
[] has been iterated in a foreach loop (simliar to the $. for files)?

No.

[] And second, the way I understand using indirect (i don't know that's the
[] proper word) reference to variables is that the following should work:
[] 
[] $wash="hi";
[] $wash_array[0]="wash";
[] print "$wash\n";
[] print "$wash_array[0]\n";
[] print "$$wash_array[0]\n";
[] 
[] perl -w thatfile.pl
[] hi
[] wash
[] hi
[] 
[] But.... I get...
[] hi
[] wash
[] Use of uninitialized value at thatfile.pl line 5.
[] 
[] HOWEVER... setting "$wash_array[0]" to just "$wash_value" (ie, take away
[] the array) it works just fine.
[] 
[] So... can you not use the form of variable addressing in arrays?


Yes you can. But the '$' binding is stronger than the '[]' binding.
So, "$$wash_array[0]" means, take the first element of the array,
whose name is in $wash_array.

If you really want to use softreferences use ${$wash_array[0]}.



Abigail


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

Date: 6 Jan 1999 21:35:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Nasty regexp .... I'm stumped.
Message-Id: <770kv9$s6k$1@client3.news.psi.net>

Zack (zack44@altavista.net) wrote on MCMLIV September MCMXCIII in
<URL:news:36938EF5.B300CC1C@altavista.net>:
"" I don't know if it's possible to do this in a single expression, but here's what I've been beating my head against the wall trying to do:
"" 
"" Scan a text string with the following rules:
"" 
"" 1. Some words are "required"
"" 2. Other words are "optional"
"" 3. Others are to be "screened"
"" 
"" 4. Not all 3 of these types of words will be searched for each time, and there may be multiples of each type.
"" 
"" 5. In other words, a given search may have 1 word 2 screen 1 required word, and 2 optional words.  Another search would have 1 optional word only .... etc.
"" 
"" 6. For each string searched, I need to report back the number of required matches, the number of optional matches, and the number of screened matches for reporting purposes.
"" 
"" What I've done so far is build up arrays containing the search terms (@opt, @req, @screen) and then try and go through them, building a big regexp string.  No luck, and quite frankly, my brain is a bit cooked from looking at it so long.
"" 
"" Any ideas?  Is it possible to do this in a single =~ line?


Of course.

I assume that with a "word", you mean a sequence of alphanumerical characters
(including _), bounded by non-alphanums. 

Assume required words are in @required, optional words in @optional,
and screened words in @screened. Let the text be in $text.

First, build a handy structure:

%words = ((map {$_ => 'required'} @required),
          (map {$_ => 'optional'} @optional),
          (map {$_ => 'screened'} @screened));
$text =~ s/(\w+)/$count{$words{$1} || 'other'} ++; $1/eg;

Now, the number of required words will be $count {required}, the number
of optional words $count {optional} and the number of screened words is
$count {screened}.



Abigail


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

Date: 6 Jan 1999 21:36:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Need CGI database
Message-Id: <770l0g$s6k$2@client3.news.psi.net>

philipbrown@my-dejanews.com (philipbrown@my-dejanews.com) wrote on MCMLIV
September MCMXCIII in <URL:news:770gjb$4ar$1@nnrp1.dejanews.com>:
 ..     Does anyone know where I can download a database which
 .. will allow people to upload their names, addresses, phone
 .. numbers, etc to a web site and also allow them to view
 .. the names, addresses, etc of other people who also uploaded
 .. this information?  It can use CGI for the server side.


1-800-8SYBASE



Abigail


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

Date: Fri, 08 Jan 1999 13:20:13 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: ODBC Drivers
Message-Id: <36965A6D.12CAD896@tivoli.com>

You do need to have the Oracle client software installed.  The DBD::Oracle module
make requires some of the Oracle libraries in order to compile.  You will also
need to make sure to set up the TNS (in your
OracleHomeDir/network/admin/tnsnames.ora file) for your SCO box so that the ODBC
call gets mapped correctly to the Oracle db.

John Warner

Andy.Fry@netserv.net wrote:

> Help,
>
> I have a SCO Unix Box and I'd like to connect to a remote Oracle server using
> PERL, what drivers do I need, and where the heck can I get them. Or do I need
> some Oracle Software (probably very expensive) in order to do this. I've
> tried the DBD::Oracle module, and had no joy with that, cause it requires
> some client software to be installed.
>
> Any Ideas ????
>
> Regards
>
> Andy
>
> --
> Andy Fry                                Phone:  +44 1924 422111
> Internet Consultant             Fax:            +44 1924 425220
> ICM NetServ Ltd
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own



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

Date: 6 Jan 1999 22:34:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Password Encryption
Message-Id: <770ocp$ss4$1@client3.news.psi.net>

Artoo (r2-d2@REMOVEbigfoot.com) wrote on MCMLIV September MCMXCIII in
<URL:news:770900$dcd$1@plug.news.pipex.net>:
^^ Is it possible to decrypt anything crypted with the crypt function if you
^^ have the correct SALT?

It's certainly possible, and the algorithm is easy:

   sub decrypt ($) {
       my $encrypted = shift;

       foreach my $l (1 .. 8) {
           my $pass = "\x00" x $l;
           {   return  $pass if $encrypted eq crypt $pass, $encypted;
               redo if $pass =~ s/([\x00-\xFE])(\xFF*)$/
                                  chr (ord ($1 + 1)) . ("\x00" x length $2)/e;
           }
       }
   }


^^                         We need to be about to de-crypt the encrypted info.

Why? Perhaps you should have used 'crypt' for things that need to be
decrypted.

^^ Otherwise is there anyother good method for crypting?  I've written a simple
^^ programme to encrypt in my own manor and can de-crypt that but would like
^^ know about other methods.

There are many ways of encrypting, and what a good method is depend on
various things. I suggest reading the sci.crypt faq and some literature
on cryptography and make yourself familiar with cryptographic methods
before you decide what you do.

crypt is very specialistic program suitable for only one thing. It's
not at all an all-purpose encryption method.



Abigail


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

Date: 6 Jan 1999 21:38:28 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Password Encryption
Message-Id: <770l4k$s6k$3@client3.news.psi.net>

Artoo (r2-d2@REMOVEbigfoot.com) wrote on MCMLIV September MCMXCIII in
<URL:news:76vkp3$ovu$1@plug.news.pipex.net>:
== Hi All
== 
== What is the best way to store passwords encrypted on a server?  How do I
== encode them and decode them to check on log-in to script?


You don't decode them.

You store the passwords encoded using one way encryption. And then,
if someone tries to log on, you encrypt the given password as well,
then compare those.


Of course, this has nothing to do with Perl.



Abigail


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

Date: Fri, 08 Jan 1999 21:36:45 GMT
From: jason_longo@my-dejanews.com
Subject: proper MIME type set up
Message-Id: <775tpc$r7v$1@nnrp1.dejanews.com>

Here is an error message that I don't understand. (I am trying to set up a
guestbook situation on my website) What does this error mean. By the way which
line would be the request line in my script. Thanks

HTTP ERROR 405

405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource
identified by the request. Please ensure that you have the proper MIME type
set up for the resource you are requesting.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 6 Jan 1999 22:44:06 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Shame: Deleting List Elements
Message-Id: <770ovm$ss4$2@client3.news.psi.net>

Richard Jelinek (rj@suse.de) wrote on MCMLIV September MCMXCIII in
<URL:news:36938070.534CBB6@suse.de>:
\\ Hi,
\\ 
\\ either there are tomatoes on my eyes or I'm still a bloody perl-newbie:
\\ 
\\ @list = (1,2,3,4,5);
\\ 
\\ How do I delete element 3? I mean not to clear it, I mean delete. I know
\\ shift,pop et al. but I need to delete elements inside a list.


perldoc -f splice
perldoc -f grep



Abigail


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

Date: 6 Jan 1999 17:15:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Short way to do this with a regexp?? Delete certain chars from string.
Message-Id: <7705o8$pdt$2@client3.news.psi.net>

Charles Wilt (charles.0272@worldnet.no.spam.att.net) wrote on MCMLIV
September MCMXCIII in <URL:news:MPG.10fd46e978c025e49896b2@netnews.worldnet.att.net>:
{} I need to replace the following characters with a space if the appear in 
{} a string:
{}  \ / : * ? " < > |
{} 
{} The string will be used as a filename.  I think I can do this in multiple 
{} lines with each line handling one char.  But I wonder if there is a way 
{} to do this in one line.


Yes there is. Is there any reason you cannot find how in the manual?



Abigail


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

Date: Fri, 08 Jan 1999 13:44:32 -0800
From: =?iso-8859-1?Q?d=E1na?= watanabe <dwatanab@uci.edu>
Subject: utmp / who
Message-Id: <36967C34.B8FBB14D@uci.edu>

Is there any perl function/module/way to do it that works with utmp?

I'd bassically like to get the same information as doing who.

Also, not so perl related, but does the utmp stuff contain IP addresses
that get tranlated for the host names or just a string?

i'm using iScreen (or screen) and the host comes out as:
"hostname:S.0" instead of "hostname.domain.foo.bar"

And the host doesn't recognize the host "hostname"
since it doesn't really know anything about 'domain.foo.bar'

If there's anyway anyone knows of telling the 'domain.foo.bar' part,
that would be just as good.


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

Date: 6 Jan 1999 17:46:15 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Windows NT  - FrontPage server --   CGI - perl script
Message-Id: <7707h7$pdt$5@client3.news.psi.net>

Rui (rren@cs.ust.hk) wrote on MCMLIV September MCMXCIII in
<URL:news:76vhv2$qn1@ustsu10.ust.hk>:
,, 
,, I am running  Frontpage on my PC.

Fine. This group is about Perl. Not frontpage.

,, Perl scripts can be run locally , but when they are accessed via   the web,
,, ie. when a perl script is the target of a form in a remote webpage,  the
,, client gets a error :
,, 
,, 500 Server Error
,, The server encountered an internal error or misconfiguration and was unable
,, to complete your request

Oh, goodie. Did you lookup what the perl manual has to say about it?
Did you? No? Maybe you should.

,, 
,, FrontPage  does  have a   cgi-bin directory so I supppose CGI is already
,, installed.

One doesn't install CGI. Just like one doesn't install something in ones
brains to stop for a traffic light that's showing red.

,,             My guess is that FrontPage server is not properly configurered
,, to run perl sctipt, ie. it has not idea how to deal with that file.

That could very well be. But then, you shouldn't be asking here. Go to
a server group.

,, What can I do about this ?    One possible thing is to   define a wrapper
,, batch file that calls the perl intepreter and the script ,  but how  ?

Well, then that wrapper wouldn't be written in Perl, would it? But in
some other language. Again, you shouldn't be asking here. Go to the
group dealing with that language.

Of course, it's also very likely that you have misconfigured things or
make the basic mistakes many people are making. But then, as you can
guess YOU ARE IN THE WRONG GROUP! Go to a CGI group. But, before you
do, you might look in the error log and find out what kind of error is
generated. If your server doesn't have an error log, get a better server.



Abigail


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

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

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