[11631] in Perl-Users-Digest
Perl-Users Digest, Issue: 5231 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 26 00:02:06 1999
Date: Thu, 25 Mar 99 21:00:17 -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 Thu, 25 Mar 1999 Volume: 8 Number: 5231
Today's topics:
'use' or 'include' ? <alrope@zaz.com.br>
Re: 'use' or 'include' ? (Sam Holden)
Re: Anything lchown()-like in Perl? (Abigail)
Bitwise Operators <bench@surfshop.net.ph>
Re: Bitwise Operators (Sam Holden)
Can Somedy Stop This Script From Crashing the Log File? tatabu@my-dejanews.com
cardinality of an associative array? (Peter Bismuti)
Re: cardinality of an associative array? (Sam Holden)
Re: DNS Module for Perl (Michael Fuhr)
drawing pixels in Perl? (Peter Bismuti)
dumping db header row before display <tlc@noble.cioe.com>
Re: dumping db header row before display (Sam Holden)
Re: get `top` into a string? kidkaboom@my-dejanews.com
Re: Need tips on improving performance. (Tad McClellan)
Open with a pipe (Gary S. Vanderlinden [Sun - DET SQA])
Re: Problem writing a file... file permissions ok on co <wflanagan@msn.com>
Q: how to evaluate a $var in a file you are reading in? <ivo@scsr.nevada.edu>
Re: Q: how to evaluate a $var in a file you are reading (Sam Holden)
Re: remote user password <markd@netwater.com>
Re: remote user password (Sam Holden)
Re: remote user password <eric.schwartz@acm.org>
Re: Running a perl script as a daemon.... (Sam Holden)
Re: Sorting multidimensional arrays (Andrew Johnson)
string substitution question (Brian Day)
Re: string substitution question (Sam Holden)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 26 Mar 1999 00:01:09 -0300
From: "Alexandre" <alrope@zaz.com.br>
Subject: 'use' or 'include' ?
Message-Id: <7detda$9mv$1@srv4-poa.nutecnet.com.br>
Friends,
Please, wich is the difference between 'use' and 'include' comands.
Tanks,
Alexandre
alrope@zaz.com.br
------------------------------
Date: 26 Mar 1999 03:48:53 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: 'use' or 'include' ?
Message-Id: <slrn7fm0t5.mkp.sholden@pgrad.cs.usyd.edu.au>
On Fri, 26 Mar 1999 00:01:09 -0300, Alexandre <alrope@zaz.com.br> wrote:
>Friends,
>
> Please, wich is the difference between 'use' and 'include' comands.
You could try reading the documentation....
I've never heard of include... then again I don't claim to know everything...
--
Sam
If your language is flexible and forgiving enough, you can prototype
your belief system without too many core dumps.
--Larry Wall
------------------------------
Date: 26 Mar 1999 03:37:53 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Anything lchown()-like in Perl?
Message-Id: <7deveh$2sd$1@client2.news.psi.net>
Halfdan Ingvarsson (halfdan@no-junk-mail.pison.com) wrote on MMXXXII
September MCMXCIII in <URL:news:36FA88F4.B3EA4C22@no-junk-mail.pison.com>:
$$ Haloo..
$$
$$ Was there any way in perl to change the owner of a symbolic link (ie.
$$ not the file it points to) without resorting to 'system()' (which is
$$ slow)?
chown $uid, $gid, readlink $file;
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
------------------------------
Date: Fri, 26 Mar 1999 11:58:10 +0800
From: "Benjamin" <bench@surfshop.net.ph>
Subject: Bitwise Operators
Message-Id: <7df0la$25q$1@tempo.news.iphil.net>
Are there equivalent of C bitwise operators such as AND (&) and OR (|) in
Perl?
------------------------------
Date: 26 Mar 1999 04:09:00 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Bitwise Operators
Message-Id: <slrn7fm22s.nan.sholden@pgrad.cs.usyd.edu.au>
On Fri, 26 Mar 1999 11:58:10 +0800, Benjamin <bench@surfshop.net.ph> wrote:
>Are there equivalent of C bitwise operators such as AND (&) and OR (|) in
>Perl?
What did you try???
Where did you look before posting???
'perldoc perlop' should shed some light on the matter.
Do so many programmers really lack the initive to actually try something
for themselves, to take a guess and see if it works, and to check the
manual to see what it says.
How much effort does it take to just try something?
How much effort does it take to actually learn a bit of the language from
the manual before using it?
--
Sam
testing? What's that? If it compiles, it is good, if it boots up it is
perfect.
--Linus Torvalds
------------------------------
Date: Fri, 26 Mar 1999 04:23:01 GMT
From: tatabu@my-dejanews.com
Subject: Can Somedy Stop This Script From Crashing the Log File?
Message-Id: <7df22t$rht$1@nnrp1.dejanews.com>
This CGI script keeps deleting the contents of the
HTML LOG file it reads/recreates too often. Can somebody
fix it? I would appreciate it.
@@-->>> tatabu
tatabu@ministre.com
open (LOG, "$logpath") || die;
@data = <LOG>;
close(LOG);
$url = "<tr><td align=\"right\"><a
href=\"$ENV{'DOCUMENT_URI'}\">$ENV{'DOCUMENT_URI'}</a>:</td>"; $count = 0;
$pad = "%.$pad"."d"; open (LOG, ">$logpath") || die; flock (LOG,2); foreach
$line(@data) { if ($line =~ /$url/) { $line =~ /<td>(.*)<\/td>/; $count =
$1; $count++; $count = sprintf($pad, $count); print LOG
"$url<td>$count</td></tr>\n"; } elsif ($count == 0 && substr($line,0,8) eq
"</table>") { $count++; $count = sprintf($pad, $count); print LOG
"$url<td>$count</td></tr>\n"; print LOG "$line"; } else { print LOG
"$line"; } } flock (LOG,8); close(LOG);
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 26 Mar 1999 02:22:21 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: cardinality of an associative array?
Message-Id: <7der0t$t2u$1@news.fsu.edu>
In class the instructor got stuck on the issue of printing out
an array:
print "the array is ", @array;
He could not get it to print out the array itself, just the
cardinality. When I tried it I could not reproduce it, I
could only get the array itself and not the cardinality,
what could explain this? What is the rule for printing
out the cardinalith of an arrah?
He also tried it on associative arrays and got interesting
someghing interesting, the output was what seemed to be the
cardinality of the ass array, it looked something like:
3/8
I'd never even heard of this before. Again, can somebody explain
to me the rule when cardinality is printed out as opposed to the
actual array itself?
Thanks in advance!
------------------------------
Date: 26 Mar 1999 02:44:34 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: cardinality of an associative array?
Message-Id: <slrn7flt4i.kih.sholden@pgrad.cs.usyd.edu.au>
On 26 Mar 1999 02:22:21 GMT, Peter Bismuti <bismuti@cs.fsu.edu> wrote:
>
>In class the instructor got stuck on the issue of printing out
>an array:
>
>print "the array is ", @array;
>
>He could not get it to print out the array itself, just the
>cardinality. When I tried it I could not reproduce it, I
>could only get the array itself and not the cardinality,
>what could explain this? What is the rule for printing
>out the cardinalith of an arrah?
An array in a scalar context is the length of the array...
'print "the array is ", scalar @array;' will print the length
of the array. There are many ways to get something into a scalar
context.
>
>He also tried it on associative arrays and got interesting
>someghing interesting, the output was what seemed to be the
>cardinality of the ass array, it looked something like:
>
> 3/8
>
>I'd never even heard of this before. Again, can somebody explain
>to me the rule when cardinality is printed out as opposed to the
>actual array itself?
>
>Thanks in advance!
If you read the documentation that comes with perl you will find the
answer to your queries...
'perldoc perldata' would be a good place to look...
It contains text like :
If you evaluate a hash in a scalar context, it returns a
value that is true if and only if the hash contains any
key/value pairs. (If there are any key/value pairs, the
value returned is a string consisting of the number of
used buckets and the number of allocated buckets,
separated by a slash. This is pretty much useful only to
find out whether Perl's (compiled in) hashing algorithm is
performing poorly on your data set. For example, you
stick 10,000 things in a hash, but evaluating %HASH in
scalar context reveals "1/16", which means only one out of
sixteen buckets has been touched, and presumably contains
all 10,000 of your items. This isn't supposed to happen.)
and :
If you evaluate a named array in a scalar context, it
returns the length of the array. (Note that this is not
true of lists, which return the last value, like the C
comma operator, nor of built-in functions, which return
whatever they feel like returning.)
--
Sam
Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work." --Larry Wall
------------------------------
Date: 25 Mar 1999 19:42:23 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: DNS Module for Perl
Message-Id: <7des6f$ho@flatland.dimensional.com>
"David Rose" <rose@gsc.nrcan.gc.ca> writes:
> I need to reconcile Internet addresses for out domain and would like to know
> if Perl can handle the job. I've checked at CPAN and there is a DNS module,
> however, its several years old and mentions that it is buggy.
Net::DNS 0.12 was released in Oct 1997 but many people are using it
successfully on production systems (including me, the module's
author). I also release development versions on the Net::DNS
home page, but they're not necessarily more stable than 0.12:
http://www.fuhr.org/~mfuhr/perldns/
The bug warnings are mostly CYA so people don't yell at me if something
goes wrong and they hose their DNS :-) Give it a try and see if it
does what you need.
> My preferred platform for Perl is Win95, however, I can also run it on a
> number of Unix systems.
Why on earth would you prefer Win95 over Unix? :-) Net::DNS 0.12
didn't run well on MS platforms, but you might have more luck
with the development versions. No guarantees, though.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
------------------------------
Date: 26 Mar 1999 03:17:03 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: drawing pixels in Perl?
Message-Id: <7deu7f$1k8$1@news.fsu.edu>
I'd like to be able to draw images at a very low level, i.e.
I want to be able to draw individual pixels in the screen.
What is the best module to do this with??
Also, I know nothing about color representation, I know you use
a 6 digit hex number, but lets say you have a frequency and
an intensity, how do you then translate that into hex and back
again??
Thanks!!
------------------------------
Date: Thu, 25 Mar 1999 22:52:26 -0500
From: "tlcora" <tlc@noble.cioe.com>
Subject: dumping db header row before display
Message-Id: <8ADK2.131$45.111@news.goodnet.com>
I have a flat text data file. The first row is the header row and I want to
remove it before displaying the entries. Everything else works fine, but I
can't figure out which perl function to use to remove only the header row
prior to displaying. I've looked through the faq several times and also
searched dejanews using several parameters, yet still can't quite figure it
out. Most of the postings deal with deleting a line in a file (faq5), but I
can't seem to adapt anything to get it to work. Faq4 deals with data, but I
couldn't find a solution here either. I don't want to edit the file at this
point, just display the entries without the header row. Could someone point
me in the right direction?
commented to show my understanding (or lack there of) of each line.
open (DATABASE, "$datafile"); # will add error checking later
while (<DATABASE>)
{
$row = $_; # puts all of the database file into the scalar $row
chop $row; # gets rid of \n at the end of the file
@fields = split (/\|/, $row); # splits each of the fields delimited by |
and places them in an array
print "...<html for @fields snipped> # outputs the contents of @fields to
the browser
close (DATABASE); # closes $datafile
}
TIA!
tlc-
------------------------------
Date: 26 Mar 1999 04:05:23 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: dumping db header row before display
Message-Id: <slrn7fm1s3.nan.sholden@pgrad.cs.usyd.edu.au>
On Thu, 25 Mar 1999 22:52:26 -0500, tlcora <tlc@noble.cioe.com> wrote:
>I have a flat text data file. The first row is the header row and I want to
>remove it before displaying the entries. Everything else works fine, but I
>can't figure out which perl function to use to remove only the header row
>prior to displaying. I've looked through the faq several times and also
>searched dejanews using several parameters, yet still can't quite figure it
>out. Most of the postings deal with deleting a line in a file (faq5), but I
>can't seem to adapt anything to get it to work. Faq4 deals with data, but I
>couldn't find a solution here either. I don't want to edit the file at this
>point, just display the entries without the header row. Could someone point
>me in the right direction?
>
>commented to show my understanding (or lack there of) of each line.
>
>open (DATABASE, "$datafile"); # will add error checking later
<DATABASE>; #add this line and you will discard the first line of input...
>while (<DATABASE>)
>{
>$row = $_; # puts all of the database file into the scalar $row
>chop $row; # gets rid of \n at the end of the file
>@fields = split (/\|/, $row); # splits each of the fields delimited by |
>and places them in an array
>print "...<html for @fields snipped> # outputs the contents of @fields to
>the browser
>close (DATABASE); # closes $datafile
>}
All you have to do is decide what you want done and do it. You want to
ignore the first line, well read it in and ignore it.
--
Sam
Perl was designed to be a mess (though in the nicest of possible ways).
--Larry Wall
------------------------------
Date: Fri, 26 Mar 1999 02:22:30 GMT
From: kidkaboom@my-dejanews.com
Subject: Re: get `top` into a string?
Message-Id: <7der0q$liu$1@nnrp1.dejanews.com>
> "top" is an interactive process viewer, it's not
> really suitable for this kind of operation.
Yes, I realised that, I wasn't aware of `uptime` which is much more useful for
what I am doing
> "uptime" is more what you want, the simplest way is
>
> chomp($ut = `uptime`);
>
> print "$ut\n";
Thanks a million and one.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 25 Mar 1999 14:09:26 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need tips on improving performance.
Message-Id: <6l1ed7.9r.ln@magna.metronet.com>
Gift Registry (webmaster@giftregistry.hypermart.net) wrote:
: Is there any good set of guidelines for tweaking better performance from
: Perl, besides the section in Wall's, "Programming Perl"?
: I currently have a large script, about 100k, which runs a site. I
: suspect that I can improve performance substantially by splitting this
: script up into smaller, logically related pieces. Is this true?
The breakup of files is seldom going to give much of a speedup.
Careful examination of the Running Time of your algorithms
is nearly always the best place to look for getting the most
speed up for the least labor.
: If I break up large scripts into a series of smaller scripts which are
: conditionally pulled in during runtime with a conditional REQUIRE, will
: performance likely improve?
I wouldn't think so generally, but then again it might...
: In other scripted languages, there is a CALL or PLAY verb, which loads
: the next requested script. Is there anything equivalent in PERL?
Sounds kinda like Perl's AUTOLOAD to me (though I don't know
what CALL/PLAY are).
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 26 Mar 1999 02:25:01 GMT
From: gsvan@Eng.Sun.COM (Gary S. Vanderlinden [Sun - DET SQA])
Subject: Open with a pipe
Message-Id: <7der5t$agt$1@engnews2.Eng.Sun.COM>
---
I am a bit confused.
Env:
SunOS 5.6
perl, version 5.005_02
Problem:
I get different output from diff when I do it from the command line and
in a perl script
I am looking at a perl script that does the following command:
open(DIFF,"diff -f $DiffArgs $OldFile $NewFile |");
with: my $DiffArgs='';
If I print DIFF to a file it looks something like this (without the two leading blanks):
c3 5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.02 [en] (X11; U; SunOS 5.5.1 sun4m) [Netscape]">
<TITLE>SQA Test Plan for xxx 1.0</TITLE>
.
c10
<B><FONT SIZE=+4> xxx 1.0
.
c13
<FONT SIZE=+2> Test Plan Version 0.1</FONT> </B><I>DRAFT</I>
.
c220 228
</A></B>
<I>This section will be completed when more about the development
process is known</I>
.
a231
<I>This section may change when the development process is defined.</I>
.
......and so on
If I do the same command at the command line I get this (without the two leading blanks):
c3 5
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.02 [en] (X11; U; SunOS 5.5.1 sun4m) [Netscape]">
<TITLE>SQA Test Plan for xxx 1.0</TITLE>
.
c23
<B><FONT SIZE=+4> xxx 1.0
.
c34
<FONT SIZE=+2> Test Plan Version 0.1</FONT> </B><I>DRAFT</I>
.
c303 305
</A></B>
<I>This section will be completed when more about the development
process is known</I>
.
d307 314
a317
<I>This section may change when the development process is defined.</I>
.
..... and so on.
________________________________________________________________________
Thanks for your help
Gary
------------------------------
Date: Thu, 25 Mar 1999 21:19:34 -0500
From: "William Flanagan" <wflanagan@msn.com>
Subject: Re: Problem writing a file... file permissions ok on computer
Message-Id: <922414776.367.78@news.remarQ.com>
David-
Thanks for the quick response! I did a "doh" there for a second, and then
went back and implemented what you suggested. In fact, just to make sure
that I wasn't imagining things, I explicitly set it to > mode, and still no
luck. I have a statement for test purposes that writes the same thing to
STDOUT, and that works like a champ. But, I can't seem to get it to write
to a file.
Any other suggestions? Any other suggestions from the group?
WF
David Robins <dbrobins@uwaterloo.ca> wrote in message
news:36FAF081.246E39E3@uwaterloo.ca...
> William Flanagan wrote:
> >
> > All-
> >
> > I'm trying to write a perl script that takes a structured text file, and
> > converts it to a comma delimited file. The problem that I am having is
that
> > I can't get it to write the file. I've tried everything. I'm writing
>
> Think about what happens when the output file doesn't exist: what is
> $mode? (Answer below, if you really need it :).
>
> > if ( -e $outfile) {
> > print STDERR "Output file $outfile exists!\n";
> > until ($ans eq 'r' || $ans eq 'a' || $ans eq 'e' ) {
> > print STDERR "replace, append, or exit? ";
> > $ans = getc(STDIN);
> > }
> > if ($ans eq 'e') {exit}
> > }
> > if ($ans eq 'a') {$mode='>>'}
> >
> > else {$mode='>'}
> >
> > open(OUTPUT,"$mode$outfile") ||
> > die "Can't create $outfile file, ensure that it does not exist $!";
>
> $mode is undefined UNLESS the file exists and the user selects an
> option. If the file doesn't yet exist, $mode is never set. Default to
> opening for write/create by inserting "$mode = '>';" before the 'if(-e
> ...' test. (That also lets you leave off the final else in the inner if
> block above).
>
> Dave
> Isa. 40:31
------------------------------
Date: Thu, 25 Mar 1999 18:08:13 -0800
From: "Ian M. Veach" <ivo@scsr.nevada.edu>
Subject: Q: how to evaluate a $var in a file you are reading in?
Message-Id: <36FAEC0D.D8197083@scsr.nevada.edu>
Greetings - Hope this is the right newsgroup
I've got a file I'm reading, and I want to take all %%$vals%% and
actually spit out the VALUE of the variable $vals. For example, I want
to read in an HTML file with <TITLE>%%$my_title%%</TITLE> using
scratch.cgi, and spit out <TITLE>Test</TITLE> where $my_title = "Test"
in scratch.cgi. How might I go about that? Here's what I have to read
the file:
while (<FORM>) {
if (/([^%]*)%%([^%]*)%%([^%]*)/) {
print "$1";
## WHAT GOES HERE???
print "$3";
} else {
print "$_";
}
Which will separate the HTML chaff from the variable name, but how do I
not print my_title or $my_title, but the VALUE of $my_title? I can
brute force it with a
if ($2 = "my_title") { print "$my_title" };
but if I have 50 different variables this is impractical and anyway not
elegant. I've tried substitutions and evals and various, but can't get
it to fly.
If you could cc my mail in addition to this group it would be
appreciated!
thanks for any help in advance and
cheers,
_____________________________________________________________________________
Ian Veach, Systems Software Analyst, UCCSN Systems Computing Services
ivo@nevada.edu, VOICE: (775) 784.6486, FAX: (775) 784.1108
_____________________________________________________________________________
------------------------------
Date: 26 Mar 1999 02:23:48 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Q: how to evaluate a $var in a file you are reading in?
Message-Id: <slrn7flrtk.jqs.sholden@pgrad.cs.usyd.edu.au>
On Thu, 25 Mar 1999 18:08:13 -0800, Ian M. Veach <ivo@scsr.nevada.edu> wrote:
>Greetings - Hope this is the right newsgroup
>
>I've got a file I'm reading, and I want to take all %%$vals%% and
>actually spit out the VALUE of the variable $vals. For example, I want
>to read in an HTML file with <TITLE>%%$my_title%%</TITLE> using
>scratch.cgi, and spit out <TITLE>Test</TITLE> where $my_title = "Test"
>in scratch.cgi. How might I go about that? Here's what I have to read
>the file:
>
> while (<FORM>) {
> if (/([^%]*)%%([^%]*)%%([^%]*)/) {
> print "$1";
> ## WHAT GOES HERE???
> print "$3";
> } else {
> print "$_";
> }
>
>Which will separate the HTML chaff from the variable name, but how do I
>not print my_title or $my_title, but the VALUE of $my_title? I can
>brute force it with a
> if ($2 = "my_title") { print "$my_title" };
>but if I have 50 different variables this is impractical and anyway not
>elegant. I've tried substitutions and evals and various, but can't get
>it to fly.
perldoc perlref
Just jump around in your pager searchig for 'symbolic' (by the fifth match or
so you should have a nice bunch of examples to copy from).
--
Sam
You are bordering on ridiculous if you think you need to support your
premises. Such an argument is an infinite regression.
--George Reese in <wv0O1.1521$Ge.4809664@ptah.visi.com>
------------------------------
Date: Thu, 25 Mar 1999 21:01:56 -0500
From: "Mark David!" <markd@netwater.com>
Subject: Re: remote user password
Message-Id: <36FAEA92.2702@netwater.com>
Eric The Read wrote:
>
> "Mark David!" <markd@netwater.com> writes:
> > is there a way in perl that when you use the basic authorization over
> > the web that generates the authorization dialog box, asking for user
> > name and password (.htaccess & .htpasswd), that when the REMOTE_USER
> > enters a password that is incorrect, to have that information passed
> > into a log?
>
> Er, unless, I'm sorely mistaken, perl doesn't generate any authorization
> dialog boxes, and doesn't have a log.
>
> > Basically, I have a logging system on my domain that logs 404's, 403's
> > and 401's. What I want when it logs 401's is to have the password the
> > user tried also passed along to the log in addition to the REMOTE_USER
> > variable.
> >
> > Is this possible?
>
> Pelr doesn't have 404's, 403's, or 401's, and doesn't log them either.
> This sounds like a web server problem, for which you should consult your
> web server documentation (if it's apache, it's all online at
> <URL:http://www.apache.org/docs/>). If you can't find it there, one of
> the comp.infosystems.www.servers.* newsgroups would be infinitely more
> appropriate.
>
> > P.S. While I'll check this forum for responses, emailing me would be
> > the best bet. Thanx.
>
> Sorry. Ask it here, it gets answered here.
>
> -=Eric
Okay, maybe I didn't make myself clear. I have written a PERL script
that when a 401 occurs on the server, it logs the passed variable
information into a log file (such as user's IP, HTTP_REFERER, etc), and
I can get it to log the "REMOTE_USER" variable, which is what the user
was trying to authenticate with, but is there a variable that contains
what password the user tried to enter?
Is that clear enough?
thanx
mark
------------------------------
Date: 26 Mar 1999 02:14:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: remote user password
Message-Id: <slrn7flrc3.jqs.sholden@pgrad.cs.usyd.edu.au>
On Thu, 25 Mar 1999 21:01:56 -0500, Mark David! <markd@netwater.com> wrote:
>Eric The Read wrote:
>>
>> "Mark David!" <markd@netwater.com> writes:
>>
>> > Basically, I have a logging system on my domain that logs 404's, 403's
>> > and 401's. What I want when it logs 401's is to have the password the
>> > user tried also passed along to the log in addition to the REMOTE_USER
>> > variable.
>> >
>> > Is this possible?
>>
>> Pelr doesn't have 404's, 403's, or 401's, and doesn't log them either.
>> This sounds like a web server problem, for which you should consult your
>> web server documentation (if it's apache, it's all online at
>> <URL:http://www.apache.org/docs/>). If you can't find it there, one of
>> the comp.infosystems.www.servers.* newsgroups would be infinitely more
>> appropriate.
>>
>Okay, maybe I didn't make myself clear. I have written a PERL script
>that when a 401 occurs on the server, it logs the passed variable
>information into a log file (such as user's IP, HTTP_REFERER, etc), and
>I can get it to log the "REMOTE_USER" variable, which is what the user
>was trying to authenticate with, but is there a variable that contains
>what password the user tried to enter?
>
>Is that clear enough?
Yes, but it is not a perl question, it is a server question. Perl passes
on whatever it gets, what it gets is a server question. So follow the
previous advice and ask somewhere more appropriate.
Logging incorrect passwords and usernames is asking to have someone read
other people's passwords...
--
Sam
Remember that the P in Perl stands for Practical. The P in Python
doesn't seem to stand for anything.
--Randal Schwartz in <8cemsabtef.fsf@gadget.cscaper.com>
------------------------------
Date: 25 Mar 1999 19:32:30 -0700
From: Eric The Read <eric.schwartz@acm.org>
Subject: Re: remote user password
Message-Id: <xkfr9qdgev5.fsf@valdemar.col.hp.com>
"Mark David!" <markd@netwater.com> writes:
> Okay, maybe I didn't make myself clear. I have written a PERL script
> that when a 401 occurs on the server, it logs the passed variable
> information into a log file (such as user's IP, HTTP_REFERER, etc), and
> I can get it to log the "REMOTE_USER" variable, which is what the user
> was trying to authenticate with, but is there a variable that contains
> what password the user tried to enter?
Again, I don't see what this has to do with perl. If it's your server
that's calling the perl script, then check the documentation for your
server. You'd still have this problem if you were programming in C,
pascal, or even assembly language.
If you're wondering how to access it in Perl, then that's easy: you do it
however you access everything else the webserver sends you.
In any event, this isn't a perl question, it's a server question, and as
such belongs on the 'froups I already referred you to.
> Is that clear enough?
Perfectly.
-=Eric
------------------------------
Date: 26 Mar 1999 02:20:15 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Running a perl script as a daemon....
Message-Id: <slrn7flrmv.jqs.sholden@pgrad.cs.usyd.edu.au>
On 26 Mar 1999 01:59:32 GMT, Greg Bacon <gbacon@itsc.uah.edu> wrote:
>In article <7dedl5$ti0$1@reader1.reader.news.ozemail.net>,
> "Diggy Tim" <tim@diggy.com> writes:
>: How do I go about running a perl script from the command line and have it
>: sit in the background and not die when I log out.
>
>I wonder whether this should go in the FAQ.
You mean like :
perlfaq8 : How do I fork a daemon process?
>
>This is a transliteration of Stevens[1].
>
> use POSIX qw( setsid );
>
> sub daemon_init {
> my $pid;
>
> return unless defined($pid = fork);
>
> exit 0 if $pid != 0; # parent goes bye-bye
Just to be critical... Why the '!= 0'
>
> # child continues
> setsid; # become session leader
>
> chdir "/"; # change working directory
>
> umask 0; # clear our file mode creation mask
>
> 1;
> }
>
>[1] Stevens, W. Richard. _APUE_. Program 13.1. pg. 418.
>
What about disconnecting STDIN, STDOUT and STDERR from the terminal???
--
Sam
Of course, in Perl culture, almost nothing is prohibited. My feeling is
that the rest of the world already has plenty of perfectly good
prohibitions, so why invent more? --Larry Wall
------------------------------
Date: Fri, 26 Mar 1999 02:51:49 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Sorting multidimensional arrays
Message-Id: <slrn7fltlg.aoh.andrew-johnson@24.66.40.189.mb.wave.home.com>
In article <36fb5ce8.0@news1.jps.net>,
Nathan <NOSPAMpenner@jps.net> wrote:
! Hello,
!
! I was wondering how to sort a multidimensional array. What I will need to
! do is take a 2-dimensional array, and be able to sort the elements of the
! first dimension in the order of any of the second dimensions. For example,
! say i have an array, called array.
!
! array[0][0] = B, array[0][1] = 3, array[0][2] = X
! array[1][0] = A, array[1][1] = 2, array[1][2] = Z
! array[2][0] = C, array[2][1] = 1, array[2][2] = Y
!
! What I need to do is sort the array by one of the sub-items. For example,
! If I sorted the array by element 0, array[1] would become array[0], array[0]
! would become array[1], and array[2] would stay array[2]. So in the new
! array, array[0][0] would be A, array[1][0] would be B, and array[2][0] would
! be c.
check out perlfaq4: How do I sort an array by (anything)?
(and be sure to look up the web page it recommends at the
bottom for further information)
there is also a Sort::Fields module on CPAN that you
may find helpful.
! NOSPAMpenner@jps.net (take out the NOSPAM).
I would, but I fear you would just put it right back in again.
regards
andrew
------------------------------
Date: 26 Mar 1999 02:12:52 GMT
From: bday@cbr.eng.sun.com (Brian Day)
Subject: string substitution question
Message-Id: <7deqf4$9vk$1@engnews2.Eng.Sun.COM>
Keywords: strings perl cgi
Hi,
I'm trying to substitute any whitespace in a string with a backslash followed by a whitespace character.
I need to pass the entire string as an argument and therefore need to have the whitespaces "escaped" before doing so.
The following won't work:
s/\s/\\s/g;
Any ideas would be greatly appreciated.
Thanks,
Brian Day
passme
---
Brian T. Day
email: bday@Eng.Sun.COM
voice: (650) 336-1331
Sun Microsystems, Inc.
mailstop: UMTV03-02
901 San Antonio Rd
Palo Alto, CA 94303-4900
------------------------------
Date: 26 Mar 1999 02:37:54 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: string substitution question
Message-Id: <slrn7flso2.kih.sholden@pgrad.cs.usyd.edu.au>
On 26 Mar 1999 02:12:52 GMT, Brian Day <bday@cbr.eng.sun.com> wrote:
>Hi,
>
>I'm trying to substitute any whitespace in a string with a backslash followed by a whitespace character.
>
>I need to pass the entire string as an argument and therefore need to have the whitespaces "escaped" before doing so.
>
>The following won't work:
>
>s/\s/\\s/g;
>
>Any ideas would be greatly appreciated.
perldoc perlre
s/(\s)/\\$1/g;
might be useful...
--
Sam
Basically, avoid comments. If your code needs a comment to be
understood, it would be better to rewrite it so it's easier to
understand. --Rob Pike
------------------------------
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 5231
**************************************