[14016] in Perl-Users-Digest
Perl-Users Digest, Issue: 1426 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 19 12:10:50 1999
Date: Fri, 19 Nov 1999 09:10:32 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943031431-v9-i1426@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 19 Nov 1999 Volume: 9 Number: 1426
Today's topics:
great perl web site <zxcvbzxcvbNOzxSPAM@aol.com.invalid>
Re: great perl web site <cassell@mail.cor.epa.gov>
Re: hash value ends up being NULL <otis@my-deja.com>
Re: Help! - grep for x then echo y from a line in a log <cassell@mail.cor.epa.gov>
Re: HELP! (Kragen Sitaker)
Re: HELP! <cassell@mail.cor.epa.gov>
Re: how to do multiple search and replaces (Andrew Johnson)
Re: how to do multiple search and replaces (Kragen Sitaker)
Re: How to know the space occuped by a directory?? <cassell@mail.cor.epa.gov>
Re: how to make perl executable (Kragen Sitaker)
Re: html via perl <cassell@mail.cor.epa.gov>
Re: Is there anyone out there with experience setting u <cure@texas.net>
Re: Is there anyone out there with experience setting u <rootbeer@redcat.com>
Re: legal names and about sorting <cassell@mail.cor.epa.gov>
Re: legal names and about sorting <cassell@mail.cor.epa.gov>
Re: legal names and about sorting <lr@hpl.hp.com>
Re: legal names and about sorting <lr@hpl.hp.com>
MacPerl on the MAC SE? (Neil Cherry)
Re: mapping .cgi to .pl <cure@texas.net>
Re: MD5 encryption <cassell@mail.cor.epa.gov>
Re: MD5 encryption <gehring.u@zdf.de>
Re: nesting level in perl subroutines (Mark-Jason Dominus)
Re: Oracle via the web <cpcollin@wam.umd.edu>
Re: Oracle via the web <makkulka@cisco.com>
param() problem? <l.hogerhuis@chello.nl>
Re: param() problem? <moseley@best.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Nov 1999 15:17:37 -0800
From: - <zxcvbzxcvbNOzxSPAM@aol.com.invalid>
Subject: great perl web site
Message-Id: <0ec4c663.bc224c1b@usw-ex0105-039.remarq.com>
http://devlib.virtualave.net/
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Thu, 18 Nov 1999 17:03:41 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: great perl web site
Message-Id: <3834A1ED.BECE3A75@mail.cor.epa.gov>
- wrote:
>
> http://devlib.virtualave.net/
Funny, it looks like the same old ultra-lame website it has been
for some time. And they care so little about this NG that they
have never bothered to correct that annoying "Perl/CGI"
category.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 19 Nov 1999 16:41:19 GMT
From: Otis Gospodnetic <otis@my-deja.com>
Subject: Re: hash value ends up being NULL
Message-Id: <813uj6$stm$1@nnrp1.deja.com>
In article
<Pine.GSO.4.10.9911181452020.16575-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Thu, 18 Nov 1999, Otis Gospodnetic wrote:
>
> > This does not (one key/value always ends up blank):
>
> Can you make a small, stand-alone program which illustrates this
anomalous
> behavior? Ideally it should use no more than a dozen or so lines, and
> should be able to run without a webserver. (The CGI module normally
makes
> this possible.)
my bad, sorry about the confusion - I fixed it. Perl/CGI/hashses are all
working fine, my mistake.
Otis
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 18 Nov 1999 16:06:27 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Help! - grep for x then echo y from a line in a logfile
Message-Id: <38349483.F54115BE@mail.cor.epa.gov>
James Nedham wrote:
>
> Hi,
Howdy,
[snip]
> What I want my perl script to do is from the line where 2124499062 is on
>
> tell me whatever machineb is on that line, it could be anything.
>
> This is the line in the log file...
>
> commsvr_bridge [544] machinea (Mon Nov 15 07:15:23 1999) ERROR: can't
> send to remote host machineb on program 2124499062
> pattern ABCDEFGHIJKLMNOPQPing (Permission denied)
You mean something like this?
print "$1 is on program 2124499062\n" if /host (\w+) on.+ 2124499062/;
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Nov 1999 19:52:29 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: HELP!
Message-Id: <1OYY3.25918$YI2.1152977@typ11.nn.bcandid.com>
In article <38345cc2.0@news2.cluster1.telinco.net>,
Chris <chris@chrismail.connectfree.co.uk> wrote:
>The error now is told to me by my debugger (for both files) is and I quote
>main::(sign_up.cgi:5): @ENV{qw(PATH IFS)} = '' x 2;
>and they are two single quotes!
'' x 2 is '' . '', which becomes ''. You want ('') x 2, which becomes
('','').
>and if you're wondering why I've taken out the -T from sign_up.cgi it's
>because my debugger says and I quote again
>too late for -T
Just don't forget to put it back in :)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 18 Nov 1999 16:52:14 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: HELP!
Message-Id: <38349F3E.1AA89349@mail.cor.epa.gov>
Chris wrote:
[big snip]
> and if you're wondering why I've taken out the -T from sign_up.cgi it's
> because my debugger says and I quote again
> too late for -T
The fuller explanation is in the 'diagnostics' pages.
perldoc diagnostics
You can help Perl here by starting Perl from the command line
with the -T switch, so that Perl can tell that you haven't
done something bad before it gets to the shebang line.
perl -wT programname
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Nov 1999 19:40:54 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: how to do multiple search and replaces
Message-Id: <aDYY3.3595$Zu4.44047@news1.rdc1.mb.home.com>
In article <MPG.129e5ef7d4c33579989682@news.ukonline.co.uk>,
Ben Osman <ben@smooth.co.uk> wrote:
[snip]
! I am now trying to search multiple strings and replace them with a
! corresponding string,
[snip]
! how do I replace string1 with replace1, string2 with replace2 and so on.
!
! line =~ s/(string1|..)/I_want_to_replace_the_matching_string/g;
!
! I have put all queries into a hash with stringx/replacex key/value pairs,
!
! how do i get it to replace the corresponding string without using a for
! loop.
you already have the hash, so capture the match and use it
as the key in the replacement:
#!/usr/bin/perl -w
use strict;
my %hash = ( string1 => 'new1',
string2 => 'new2',
stringX => 'newX',
);
my $pattern = qr/(string(?:1|2|X))/;
while(<DATA>){
s/$pattern/$hash{$1}/g;
print;
}
__DATA__
blah string1 foo string2 bar stringX quux
and more string1 string1 blah
string2 string4 blah
regards
andrew
--
Andrew L. Johnson http://www.manning.com/Johnson/
Some people, when confronted with a problem, think 'I know,
I'll use regular expressions.' Now they have two problems.
-- Jamie Zawinski, on comp.lang.emacs
------------------------------
Date: Thu, 18 Nov 1999 19:48:52 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: how to do multiple search and replaces
Message-Id: <EKYY3.25916$YI2.1152590@typ11.nn.bcandid.com>
In article <MPG.129e5ef7d4c33579989682@news.ukonline.co.uk>,
Ben Osman <ben@smooth.co.uk> wrote:
>$line =~ s/(string1|string2|string3)/g;
>
>how do I replace string1 with replace1, string2 with replace2 and so on.
If you have a relatively small, fixed set of replacements, just go
ahead and write a separate s/// for each one. It won't be slower.
for ($line) {
s/string1/replace1/g;
s/string2/replace2/g;
s/string3/replace3/g;
}
(This won't work right if replace1 might constitute part of string2 and
you don't want that.)
Otherwise, Andrew Johnson's advice is fine.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 18 Nov 1999 15:51:24 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to know the space occuped by a directory??
Message-Id: <383490FC.4424FEF5@mail.cor.epa.gov>
Abel Almazán wrote:
>
> I want to know how many kbytes are stored on a directory, that have
> subdirectories.
On unix boxes, the program du does this for you.
On other systems, there are Perl programs which reproduce the
functionality of du. Go to http://language.perl.com/ppt/
and look for du among the other nifty Perl Power Tools.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Nov 1999 20:01:45 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: how to make perl executable
Message-Id: <JWYY3.25925$YI2.1152303@typ11.nn.bcandid.com>
> Good question about how to make perl executable.
>
> I have found the ability of Perl on the Mac to save the thing as an
> executable useful in some contexts--particularly those in which you
> want to make it easy for people to run the thing while making somewhat
> harder to modify it (accidentally or otherwise). Whatever the
> technique, it doesn't have to be totally secure to be useful in such a
> context; it just has to make it difficult enough to get into the source
> so as to raise the bar for those that try.
>
> I wish there were something for this as simple and straight-forward in
> the Active State implementation as in the Mac Perl implementation.
It's people like you that make me glad there isn't.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 18 Nov 1999 15:45:04 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: html via perl
Message-Id: <38348F80.FB27ECEC@mail.cor.epa.gov>
Jeremy Gurney wrote:
>
> In article <810al6$oqt$1@autumn.news.rcn.net>,
> "Bryan Doyle" <bdoyle@wiannoassociates.com> wrote:
> > Hi,
> <Snip>
> > Inserting
> > TARGET="_top" after print "<a href=\"$guestbookurl\" obviously
> > does not work.
>
> Why not?
>
> print "<a href=\"$guestbookurl\" TARGET=\"_top\">Proceed to the
> Registered Users' Page!</a>";
Alternatively Brian, you can cure that backslashitis with a
brisk dose of qq() there. If you want lots of print lines, you
might prefer to learn about here-docs in the perldata pages.
But this is still not a Perl question, and as such you'll
usually get better, more direct answers asking HTML questions
in an HTML newsgroup. I hope.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Nov 1999 19:09:43 -0600
From: Cure <cure@texas.net>
Subject: Re: Is there anyone out there with experience setting up Microsoft's Personal Web Server to run perl/CGI scripts?
Message-Id: <3834A357.142C4916@texas.net>
why dont you d/l apache for windows to runa web server its alot better
than the one that comes with windows, i have tried both of them
www.download.com
and d/l apache for windows
and d/l active perl
once you did that emial me and i will tell you how ot set it all up
cure@texas.net
Raymond Gordon wrote:
>
> I would like to learn CGI programming with perl and get som practical
> experience too. I have Windows98 (second edition) and have installed the
> Personal Web Server software which came with it. The browser being used is
> IE v5.0. I am not connected to any LAN. I have internet access via a modem
> and telephone line. When I choose a link to launch a perl script using the
> CGI module, I get a DOS window with text informing me that the I am working
> offline and requesting me for the input parameters. This happens whether or
> not I am connected to the internet. The Personal Web Server instructions
> for configuring the browser to access a web site not connected to a network
> do not work for IE v/5.0. I have experimented a couple of days now without
> getting anywhere. Have not tried anything really drastic which may cause me
> to irrevocably loose my present IE configuration, though, because I still
> need to access the internet on a regular basis. Would appreciate any help I
> can get. --raymond
------------------------------
Date: Thu, 18 Nov 1999 18:09:28 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Is there anyone out there with experience setting up Microsoft's Personal Web Server to run perl/CGI scripts?
Message-Id: <Pine.GSO.4.10.9911181805240.16575-100000@user2.teleport.com>
On Thu, 18 Nov 1999, Raymond Gordon wrote:
> Subject: Is there anyone out there with experience setting up Microsoft's
Personal Web Server to run perl/CGI scripts?
If your webserver isn't doing what you want, you should check its manual.
If you can't find the manual, you should ask your webmaster. If you are
the webmaster and you still don't have a manual, you should throw the
webserver away and get a better one. If you've read the manual and you
still aren't sure how to make it work, you should ask in a newsgroup about
your webserver. If you want to hire someone to fix your webserver, you
should ask in a newsgroup with the word 'jobs' in its name.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 18 Nov 1999 15:39:22 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: legal names and about sorting
Message-Id: <38348E2A.1713FC6C@mail.cor.epa.gov>
Jaakko Puurunen wrote:
[snip]
> Yesterday I noticed that by first defining a variable for the device
> ($a = '+C1-A1') and then using that to create an array (@$a = (1,2,3)),
> it passes.
This is not a good thing. This is a symbolic reference. There
has been a substantial discussion about them in this newsgroup
over the last two days [with a good bit by Mark-Jason Dominus].
Read that and see all the awful ickiness that can ensue if you
use them without understanding why you should *not* use them
under ordinary circumstances.
> I think this is all very fine because I would not need to strip to +
> anymore but since I don't feel very sure it's safe I'd like to hear
> some comments first.
You're right. You'll be much better off using a hash of arrays
[it is called a hash of lists in the perldsc pages].
> So, can I use this feature without fearing that my programs will
> be unusable in the future?
Well, they probably won't be unusable. But they may have
intermittent bugs which are impossible to track down since
the Perl debugger won't walk through the symrefs for you.
[snip to next question]
> then be 103 and in the last line 102. Numbers after the dot represent
> the number of that device on that specific bus (the device on the first
> line would then be device #13 on bus #103).
>
> The following program is what I'm using now to sort these but I does
> not sort the devices (after the dot) numerically (it does sort them
> correctly by the bus).
>
> #!/usr/bin/perl -w
Good. But you should use 'use strict;' too. Even though
it will complain bitterly about your symrefs.
> open (FILE, "1.txt"); @a = <FILE>; close FILE;
You really need to check the return on that open() and that
close(). Like this:
open (FILE, '1.txt') or die "Can't open for read: $!\n";
[and ditto for the close()]
> chomp @a;
>
> @b = sort by_asi_bus @a;
>
> for (@b) { print "$_\n" }
>
> sub by_asi_bus {
>
> @alist = (split (/-\D+/, $a))[-1];
> @blist = (split (/-\D+/, $b))[-1];
>
> return $alist[$#alist] <=> $blist[$#blist];
>
> } # end of by_asi_bus
Ewww. Sorry, but a complex expression like this is really
going to slow down your sort when you get more lines in your
array. And you're doing something odd with your indexing,
since you've already made @alist and @blist into single-element
arrays. Right?
> If the data after splitting are treated as numbers shouldn't the above
> program return them sorted in numberical order? The following is what I
> get now:
>
> +CV72.3-B102.20
> +CV82.1-B102.3
> +CV42.1-B102.5
> +CV43.4-B103.10
> +CV54-BM103.13
> +CV73.2-B103.18
> +CV43.1-B103.5
Umm, this is *exactly* what you told sort() to do. It is
treating 102.20 as the value 102 + 1/5 instead of what you
had in mind. It then sorted on that single non-integer
number.
> I'd be very happy if somebody could point me to the right direction
> about this (the above sorting is adapted from FMTEYEWTK/sorting). I've
> pretty much spent all my (limited :) resources on this one (and I think
> it shouldn't be that difficult).
Well, you did great by getting as far as the FMTEYEWTK on
sorting. But try this doc:
http://www.hpl.hp.com/personal/Larry_Rosler/sort/sorting.html
to learn
[1] about sorting in general
[2] about the GRP [Guttman-Rosler Packsort as I like to call it]
[3] how to do the GRP on a case just like yours [numbers
separated by dots which are not to be treated as decimals]
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Nov 1999 15:42:40 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: legal names and about sorting
Message-Id: <38348EF0.5AB8FF25@mail.cor.epa.gov>
Jaakko Puurunen wrote:
>
> On 18 Nov 1999 11:53:36 GMT, Martien Verbruggen <mgjv@wobbie.heliotrope.home>
> wrote:
> >You are doing evil things. If you don't understand why, you shouldn't
> >even be contemplating it.
>
> Whatever you say man ... I'll have to look "contemplating" from the
> dictionary first.
Thinking about it.
[snip]
> I have the 'use strict' in my code but it's commented out because it
> complains too much :) Warnings from -w I do check and fix.
Yes. You have symrefs, which make 'use strict' gag.
And you'll want to read about using my() and about the
strict pragma:
perldoc -f my
perldoc strict
That way you'll know the ways to shut 'strict' up.
You may also want to stick 'use diagnostics' into your code
to get the error messages explained a bit. Then take the
'use diagnostics' bit back out before you put the code into
production, since it is a performance hit.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 18 Nov 1999 17:29:53 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: legal names and about sorting
Message-Id: <MPG.129e47f0e6ff1ae998a236@nntp.hpl.hp.com>
In article <38348E2A.1713FC6C@mail.cor.epa.gov> on Thu, 18 Nov 1999
15:39:22 -0800, David Cassell <cassell@mail.cor.epa.gov> says...
...
> Well, you did great by getting as far as the FMTEYEWTK on
> sorting. But try this doc:
> http://www.hpl.hp.com/personal/Larry_Rosler/sort/sorting.html
> to learn
> [1] about sorting in general
> [2] about the GRP [Guttman-Rosler Packsort as I like to call it]
I'm beginning to like 'Prefix sort' myself. People may be scared away
by pack(), as several posters have said recently; sprintf() will often
do the job; but there is always a prefix no matter how generated.
> [3] how to do the GRP on a case just like yours [numbers
> separated by dots which are not to be treated as decimals]
I posted one way in response to Martien Verbruggen in this thread.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 18 Nov 1999 17:41:44 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: legal names and about sorting
Message-Id: <MPG.129e4ab3dc88098c98a237@nntp.hpl.hp.com>
In article <slrn837q6v.1qp.mgjv@wobbie.heliotrope.home> on 18 Nov 1999
11:53:36 GMT, Martien Verbruggen <mgjv@wobbie.heliotrope.home> says...
...
> You could probably use one of the packed sorts (Have you guys finally
> decided on a name?) that Uri and Larry have successfully been
> talking about for a while now.
It seems to be GRP (Guttman-Rosler Prefix sort -- see my discussion in
response to David Cassell in this thread), but some are using ROGUE
(Rosler-Guttman E\w+; my choice is Excellent :-).
...
> I'll leave it up to Larry to come up with the fastest method :)
How can one refuse a challenge like that?
Here is one way, which works for unsigned integers up to 16 bits, a
reasonable assumption for this problem. One could make the sortkey even
shorter by using 'CCA*' and substr($_, 2); but the performance benefits
of all this minimizing are likely to be minuscule. In complete
ignorance of the range of the data < 2**32, one could use 'NNA*' and 8.
As Abigail pointed out, one of the coding advantages of the Schwartz
here is that numerical comparison <=> works for all numbers, independent
of their ranges or integrality.
#!/usr/local/bin/perl -w
use strict;
print map substr($_, 4) =>
sort
map pack('nnA*' => /-\D+(\d+)\.(\d+)/, $_ ) => <DATA>;
__END__
+CV54-BM103.13
+CV72.3-B102.20
+CV43.1-B103.5
+CV43.4-B103.10
+CV73.2-B103.18
+CV82.1-B102.3
+CV42.1-B102.5
Output:
+CV82.1-B102.3
+CV42.1-B102.5
+CV72.3-B102.20
+CV43.1-B103.5
+CV43.4-B103.10
+CV54-BM103.13
+CV73.2-B103.18
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 18 Nov 1999 19:31:12 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: MacPerl on the MAC SE?
Message-Id: <slrn838kvb.apb.njc@dmc.uucp>
What version of MacPerl can I run on a MAC SE running System 7.1? I've
checked various FAW's and it seems that at least parts of MacPerl run
on the SE (MC68000 processor) but other part seem to be for the PPC or
the new generation of MAC's. I'm very confused.
--
Linux Home Automation Neil Cherry ncherry@home.net
http://members.home.net/ncherry (Text only)
http://meltingpot.fortunecity.com/lightsey/52 (Graphics GB)
------------------------------
Date: Thu, 18 Nov 1999 17:56:52 -0600
From: Cure <cure@texas.net>
Subject: Re: mapping .cgi to .pl
Message-Id: <38349244.20AB6E02@texas.net>
thats real easy.
email me iand i will explain it to you
cure@texas.net
jobmail@my-deja.com wrote:
>
> I am trying to run perl scripts on Infradig web server on win95. When
> I run scripts with .pl they work fine. When I change the extentions
> from .pl to .cgi I get an error message -- 'doc. contains no data'.
> Can anyone help me to map .cgi extention to .pl ? Thanks.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 18 Nov 1999 16:02:03 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: MD5 encryption
Message-Id: <3834937B.82B9123@mail.cor.epa.gov>
Uwe W. Gehring wrote:
>
> Hi,
Howdy,
> I am running Apache on NT and build AuthFiles with htpasswd.exe which
> uses MD5 encryption. How can I create the same strings using Perl?
> Digest::MD5 does not create the same strings. I am using the ActiveState
> Port of Perl 5, Build 522.
Umm, are you aware that there is more than one way of returning
MD5-encrypted info? Digest::MD5 has three such functions.
If you read the docs you'll see that you may need to try all
three to see which one matches the strings your program is
generating.
If none of them match what your program generates, you may
need to delve into the manual for htpasswd.exe on your
system and find out how it does MD5.. then implement it in
Perl. If that's the case, please send your work to the
author of Digest::MD5 so the module can be updated.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 19 Nov 1999 01:24:48 +0100
From: "Uwe W. Gehring" <gehring.u@zdf.de>
Subject: Re: MD5 encryption
Message-Id: <383498D0.DA78569B@zdf.de>
Tom Phoenix schrieb:
> On Thu, 18 Nov 1999, Uwe W. Gehring wrote:
>
> > I am running Apache on NT and build AuthFiles with htpasswd.exe which
> > uses MD5 encryption. How can I create the same strings using Perl?
>
> Find out what formula or algorithm is being used, then use the same one.
>
> > Digest::MD5 does not create the same strings.
>
> Then you've got the wrong formula or algorithm. When you find the right
> one, if you're not sure how to implement it in Perl, feel free to ask
> here. Cheers!
>
The source of htpasswd.exe seems to be distributed with Apache on NT. It is
written in C, but I am not a C expert to find (and understand) the right
piece of code. Un fortunately there is no forther documentation about
htpasswd.exe, i.e. no formula given. Should/may I post the source code here?
Thanks,
Uwe
------------------------------
Date: Thu, 18 Nov 1999 19:34:04 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: nesting level in perl subroutines
Message-Id: <811ka6$93l$1@monet.op.net>
In article <uzowcd4og.fsf@ksp.com>, Sam Steingold <sds@goems.com> wrote:
>suppose I have a recursive perl subroutine. how do I calculate the
>nesting level?
>
>In Lisp I could do something like this:
You can do the same thing in Perl in the same way.
$call_level = 0;
sub nesting {
local $call_level = $call_level + 1;
my $indent = ' ' x $call_level;
print "${indent}call level: $call_level\n";
nesting() unless $call_level == 10;
print "${indent}call level: $call_level\n";
print " - top level over\n" if $call_level == 1;
}
nesting();
You can also use the `caller()' function to get information about the
current call stack, and use that to figure out the call depth without
tracking it explicitly. For example:
sub call_depth {
my $d = 0;
++$d while caller($d);
return $d-1;
}
sub nesting {
local $call_level = call_depth();
print "call level: $call_level\n";
nesting() unless $call_level == 10;
print "call level: $call_level\n";
print " - top level over\n" if $call_level == 1;
}
nesting();
>thanks
Yeah.
------------------------------
Date: Thu, 18 Nov 1999 14:27:06 -0500
From: "Chris Collins" <cpcollin@wam.umd.edu>
Subject: Re: Oracle via the web
Message-Id: <811jvt$md7$1@hecate.umd.edu>
Thanks for your tips.
I believe it is DBD::Oracle installed on the machine I'm working on.
I modified my code based on the suggestions here, and the script works
perfectly when I run it in the shell.
When I run it via a browser, all I get is the correct html format and my
first test message. I have another dummy print message following the
DBI->connect(...) call that it never gets to nor prints any error messages.
I don't know how to approach finding what the problem is.
Thanks for the help,
Chris
Dan Wilga <dwilgaREMOVE@mtholyoke.edu> wrote in message
news:dwilgaREMOVE-1811991335230001@wilga.mtholyoke.edu...
> In article <8116m6$nq7$1@hecate.umd.edu>, "Chris Collins"
> <cpcollin@wam.umd.edu> wrote:
>
> > use DBI;
> > use Env;
> > use Env qw(WWW_myquery);
> > use Exporter();
> >
> [...]
> >
> > $dbname = 'DBNAME';
> > $user = 'USERNAME';
> > $password = 'PASSWORD';
> > $dbd = 'Oracle';
> >
> [...]
> >
> > $dbh = DBI->connect ($dbname, $user, $password, $dbd);
>
> You need two things. First, you need to install a database interface.
> Either DBD::Oracle or DBD::ODBC should work, but DBD::Oracle is much
> easier to set up.
>
> Next, you need to construct a valid DSN, and pass the correct arguments to
> connect(). This depends on which driver you're using, but for DBD::Oracle,
> this sequence should work. It assumes the Oracle database is on the same
> machine as the Perl script:
>
> $dsn = 'dbi:Oracle';
> $user = 'USERNAME';
> $password = 'PASSWORD';
>
> $dbh = DBI->connect ($dsn, $user, $password);
>
> Dan Wilga dwilgaREMOVE@mtholyoke.edu
> ** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Thu, 18 Nov 1999 15:04:03 -0800
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Oracle via the web
Message-Id: <383485E2.42736DA7@cisco.com>
Chris Collins wrote:
> This script works fine when I run it in the shell, but when I run it via the
> web, it never gets past connecting to Oracle.
Try setting $ENV{'ORACLE_HOME'} = your oracle_home ;
--
------------------------------
Date: Thu, 18 Nov 1999 23:30:49 GMT
From: "L. Hogerhuis" <l.hogerhuis@chello.nl>
Subject: param() problem?
Message-Id: <38348CDE.81869A06@chello.nl>
For my web based calendar i'm making a perl program. I'm using Perl
5.005_02, Apache 1.3.4, mod/perl 1.18 and MySql 9.32 on a Linux system.
After sending serveral forms (using POST) the perl program is
misbehaving (after working properly). It looks like some variables are
not initialized by the param(...) function (the variables param refers
to exist).
I'm using 'use strict'. I dont see errors in my httpd log error file.
Is it my programming skills or have i found a bug??
Who can give me some infomation about this topic?
Thx.
------------------------------
Date: Thu, 18 Nov 1999 15:53:47 -0800
From: Bill Moseley <moseley@best.com>
Subject: Re: param() problem?
Message-Id: <MPG.129e316a7e2eb1c4989892@nntp1.ba.best.com>
L. Hogerhuis (l.hogerhuis@chello.nl) seems to say...
> For my web based calendar i'm making a perl program. I'm using Perl
> 5.005_02, Apache 1.3.4, mod/perl 1.18 and MySql 9.32 on a Linux system.
>
> After sending serveral forms (using POST) the perl program is
> misbehaving (after working properly). It looks like some variables are
> not initialized by the param(...) function (the variables param refers
> to exist).
Are you running the program as a mod_perl script under Apache::Registry?
Do you have something like
use CGI;
my $q = new CGI;
at the top of your program?
If so, you might have a closure problem?
Try running the server with -X in single server mode.
> Who can give me some infomation about this topic?
http://perl.apache.org/guide/
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 1426
**************************************