[10831] in Perl-Users-Digest
Perl-Users Digest, Issue: 4432 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 15 20:07:19 1998
Date: Tue, 15 Dec 98 17: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 Tue, 15 Dec 1998 Volume: 8 Number: 4432
Today's topics:
Re: array initialisation <aqumsieh@matrox.com>
Re: Complicated sorting problem (Bill Moseley)
Re: Complicated sorting problem (Larry Rosler)
Re: Disk Free <metcher@spider.herston.uq.edu.au>
Eval vs. Subroutine? (Jim Matzdorff)
Re: Eval vs. Subroutine? <andy@focus-consulting.co.uk>
Formatting Numbers <scott@reflector.net>
Re: hash predefined length <aqumsieh@matrox.com>
Re: hash predefined length (Larry Rosler)
Hashref Compatibility with Perl 4.0 -- TIA (Christian M. Aranda)
Re: how do I do this common text import task? (Larry Rosler)
Re: how do I do this common text import task? <rick.delaney@home.com>
Re: How to extract emails from HTML page (John Stanley)
making html change <kevin@utig.ig.utexas.edu>
Re: Multithreading on Win32 (Jan Dubois)
Re: Need some speed tips on this script.. <due@murray.fordham.edu>
Re: Need some speed tips on this script.. (Larry Rosler)
Re: NEWBIE! - need help with sar output on UNIX and per (Christian M. Aranda)
Re: Origin of 'local'? <p-fein@uchicago.edu>
Perl & Microsoft IIS Server <johkar@netins.net>
Re: Perl multithread/multiprocess socket server example <john@dlugosz.com>
Perl Netware and Timeout question <goffin@popmail3.vnet.net>
Re: Perl newbie question.. <ludlow@us.ibm.com>
problem with grep and readdir for subdirectories <millerd@carleton.edu>
Re: reading HTTPS connections <markscottwright@hotmail.com>
Re: Sorting a Two-dimensional Numerical Array <perl@nullspace.com>
Re: Trying to get all directories recursively (Christopher Parent)
Re: Trying to get all directories recursively (I R A Aggie)
Re: Why Is Perl not a Language? (Thomas Brian Holdren)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 15 Dec 1998 13:28:03 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: array initialisation
Message-Id: <x3yg1ah6z0s.fsf@tigre.matrox.com>
jwl@worldmusic.de (Joergen W. Lang) writes:
>
> Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
> > Michael Renshaw <michaelr@lndn.tensor.pgs.com> writes:
> >
> > >
> > > does anyone know how to preallocate an array size within a hash array ?
> >
> > my %hash;
> > keys %hash = 100;
>
> print scalar keys %hash;
> # gives: 0
Yep .. the keys are not defined yet.
> If I get this correctly, the above assigns 100 "hash bucket"s for %hash.
This tells the script to "preallocate a certain-sized dynamic array".
(Note: Quote from the Panther, page 340).
The above quote almost exactly matches the question asked word for word.
> I think, Michael wanted to use the size ('number of elements') of a
> given array to predestine the number of key-value-pairs of a hash.
Maybe ... I don't know how to operate my new crystal ball yet.
Under the given circumstances, I believe both solutions (mine and
yours) are equally acceptable.
BUT .. on second thought, I will give your solution more credit than
mine. The quote I mentioned above continues on to say:
"Perl rounds it up to the next higer power of two."
Maybe not what the original poster wanted.
Ala.
------------------------------
Date: 15 Dec 1998 23:44:42 GMT
From: moseley@best.com (Bill Moseley)
Subject: Re: Complicated sorting problem
Message-Id: <3676f46a$0$227@nntp1.ba.best.com>
Ok, I'm still new at all this, but the Schwartzian Transform example shown
seems like a waste of memory. But maybe it's fast? (I'm too new at perl
to know how to time such things.)
>@lines = <DATA>;
>
>@sorted = map { $_->[0] } # Schwartzian Transform
> sort {
> $a->[1] cmp $b->[1] or # names
> $a->[2] <=> $b->[2] # numbers
> } map {
> [$_, m/^(\D+)(\d+)/]
> } @lines;
This last map creates a copy of all the data, no? At least wouldn't
it be better to save just a reference to the original data in the
first array position instead of creating a copy, especially if the records
were really, really big?
Why wouldn't one just do this?
my @sorted = sort {
my @a = $a =~ /^(\D+)(\d+)/;
my @b = $b =~ /^(\D+)(\d+)/;
$a[0] cmp $b[0] or
$a[1] <=> $b[1];
} @lines;
--------------
Bill Moseley
moseley@best.com
------------------------------
Date: Tue, 15 Dec 1998 16:34:11 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Complicated sorting problem
Message-Id: <MPG.10e09fdfc0b87dda9898ca@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <3676f46a$0$227@nntp1.ba.best.com> on 15 Dec 1998 23:44:42
GMT, Bill Moseley <moseley@best.com> says...
> Ok, I'm still new at all this, but the Schwartzian Transform example shown
> seems like a waste of memory. But maybe it's fast? (I'm too new at perl
> to know how to time such things.)
Yes, it's fast, and there are ways that are even faster. They all *use*
(not *waste*) extra memory.
Search DejaNews from December 11 through 14 for much more discussion,
with benchmark results. Also, look in your Perl distribution for
Benchmark.pm.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 16 Dec 1998 10:48:56 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Disk Free
Message-Id: <36770378.2FFCBF0E@spider.herston.uq.edu.au>
# Prints free space on C: drive
print (`cmd /c dir c:` =~ /[\d,]+ bytes free/);
__END__
Tools, gentlemen, remember your tools. (1)
--
Jaime Metcher
1. Tom Christiansen, Usenet post today or yesterday.
Pep Mico wrote:
>
> How can I get how many disk free space is available in one volume disk?
>
> I'm working in Windows NT environment.
>
> Regards
> pep_mico@hp.com
------------------------------
Date: 15 Dec 1998 16:40:42 -0800
From: syran@shell1.ncal.verio.com (Jim Matzdorff)
Subject: Eval vs. Subroutine?
Message-Id: <756via$k91$1@shell1.ncal.verio.com>
If I have a little snipped of code, that say, sets a few variables and i have that iterated
many times over in my program ... which is faster, creating a subroutine, copy/pasting
everywhere (yuck), or assigning the snippet to a (global) variable and eval'ing it everytime?
sub Snippet
{
$session_id=$TELNET[$session_number];
SetCurrentPrompts ($session_number);
}
...or...
$snippet=" $session_id=$TELNET[$session_number]; SetCurrentPrompts ($session_number);"
eval $snippet;
...or...
(well, cut/paste everywhere).
Soooooooooo........ is there any real difference (speed/memory wise, that is)?
--jim
------------------------------
Date: Wed, 16 Dec 1998 00:55:49 +0000
From: Andy Mendelsohn <andy@focus-consulting.co.uk>
Subject: Re: Eval vs. Subroutine?
Message-Id: <36770515.DF72FC21@focus-consulting.co.uk>
Jim Matzdorff wrote:
>
> If I have a little snipped of code, that say, sets a few variables and i have that iterated
> many times over in my program ... which is faster, creating a subroutine, copy/pasting
> everywhere (yuck), or assigning the snippet to a (global) variable and eval'ing it everytime?
>
> sub Snippet
> {
> $session_id=$TELNET[$session_number];
> SetCurrentPrompts ($session_number);
> }
>
> ...or...
>
> $snippet=" $session_id=$TELNET[$session_number]; SetCurrentPrompts ($session_number);"
> eval $snippet;
>
> ...or...
>
> (well, cut/paste everywhere).
>
> Soooooooooo........ is there any real difference (speed/memory wise, that is)?
>
> --jim
Do you know about the Benchmark module?
perldoc Benchmark and then...
Use Benchmark;
hth
andy
------------------------------
Date: 15 Dec 1998 23:50:15 GMT
From: "Scott Phillips" <scott@reflector.net>
Subject: Formatting Numbers
Message-Id: <756sjn$edn@bgtnsc02.worldnet.att.net>
Lets say I have:
$amount = "100230.00";
how can I format it so that it places a "," after every third digit to the
left of the decimal point.....so it would like this:
100,230.00
Thanks, its been stumping me.
-Scott
------------------------------
Date: Tue, 15 Dec 1998 13:31:08 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: hash predefined length
Message-Id: <x3yemq16yvm.fsf@tigre.matrox.com>
Michael Renshaw <michaelr@lndn.tensor.pgs.com> writes:
>
> does anyone know how to pre-define the size of a hash array ?
>
Damn .. we answered your *SAME* question that was posted a few days
ago! Search DejaNews for your own posting!
------------------------------
Date: Tue, 15 Dec 1998 15:52:48 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: hash predefined length
Message-Id: <MPG.10e0962d154936019898c8@nntp.hpl.hp.com>
In article <x3yemq16yvm.fsf@tigre.matrox.com> on Tue, 15 Dec 1998
13:31:08 -0500, Ala Qumsieh <aqumsieh@matrox.com> says...
>
> Michael Renshaw <michaelr@lndn.tensor.pgs.com> writes:
>
> > does anyone know how to pre-define the size of a hash array ?
>
> Damn .. we answered your *SAME* question that was posted a few days
> ago! Search DejaNews for your own posting!
Actually, we didn't answer the question, because we didn't understand it
(what is a 'hash array'?). Michael clarified his intent to me via
email.
He wants each element of a hash to be a reference to an array of size
100.
foreach (@keys) { $#{$hash{$_}} = 99 }
creates the arrays if they do not already exist, and sets their size to
100 in either case. If the keys are already in the hash, then:
foreach (keys %hash) { $#{$hash{$_}} = 99 }
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 15 Dec 1998 23:16:37 GMT
From: christian.aranda@iiginc.com (Christian M. Aranda)
Subject: Hashref Compatibility with Perl 4.0 -- TIA
Message-Id: <756qjt$gfn$1@news-1.news.gte.net>
Folks -
I have the need to write perl scripts using only verion 4.0. There
are many reasons that I can not use a current version. Here is the
exact version of perl I'm using --
----------
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
---------
I need to use a hashref which I've grown to know and love lately, but
can't seem to get it to work with 4.0. Here is the hashref I'm
initializing:
%how_found_map = (
"code review" => $phase_intro[0],
"customer use" => $phase_intro[1],
"doc review" => $phase_intro[0],
"functional test" => $phase_intro[0],
"integration test" => $phase_intro[0],
"internal use" => $phase_intro[2],
"metric validation" => $phase_intro[0],
"new requirement" => $phase_intro[3],
"new functionality" => $phase_intro[4],
"regression test" => $phase_intro[0],
"unit test" => $phase_intro[0]
);
@phase_intro is an array (obv.). Here is the exact error message I
receive when trying to execute my script:
------------
syntax error in file migrate_ddts_delim.pl at line 44, next 2 tokens
"=>"
-----------
Any insight into this at all is appreciated. There must be a
"correct" way to initialize a hashref with perl 4.0, but I have
exhausted my resources.
TIA -
Christian Aranda
christian.aranda@iiginc.com
Impact Innovations Group
------------------------------
Date: Tue, 15 Dec 1998 15:01:33 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how do I do this common text import task?
Message-Id: <MPG.10e08a2c5169e0fa9898c7@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <367639C8.672F5850@portal.ca> on Tue, 15 Dec 1998 02:28:24 -
0800, Terry Haroldson <tharold@portal.ca> says...
> I'm new at this and am sure this is a easy question. I have data in a
> text file similar to the following (retrieved from a Informix d/b). I
> would like to transpose it into a csv format, so I can stick it into
> Excel. (I don't care about the field names.) This must be a common
> task. Any ideas.
#!/usr/local/bin/perl -w
use strict;
{
local $/ = ''; # Paragraph mode.
print join(',', /\d+/g), "\n" while <DATA>;
}
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 16 Dec 1998 00:28:34 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: how do I do this common text import task?
Message-Id: <36770063.9871B481@home.com>
[posted & mailed]
Larry Rosler wrote:
>
> #!/usr/local/bin/perl -w
> use strict;
>
> {
> local $/ = ''; # Paragraph mode.
> print join(',', /\d+/g), "\n" while <DATA>;
^^^
> }
Some of the original sample data had letters in it. Perhaps:
print join(',', / (\w+)/g), "\n" while <DATA>;
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 15 Dec 1998 23:25:40 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: How to extract emails from HTML page
Message-Id: <756r5k$961$1@news.NERO.NET>
In article <3676C918.3E42008F@popcorn-studio.ch>,
Philip Class <philip.class@popcorn-studio.ch> wrote:
>Dear Friends ;-)
Not here.
>To be honest - The main purpose for collecting emails is a commercial one.
Yes, spam.
>Contancting potential customers in a discrete way (inculding our own personal
>address data as sender and offering a 'REMOVE ME' feature) is not what I call
>usual cheap spam.
Perhaps not "usual cheap spam", but spam nonetheless. Assuming that the
inclusion of someone's email address in a web page is an invitation for
you to try to sell them something is stupid or arrogant.
>That's my opinion, ...and that's why I didn't hesitate
>posting a usenet message with my real emailaddress appending.
>But I realize it's a personal issue where to draw the line between spam and (a
>small percentage of) useful mail.
The line between spam and "useful news" is at twenty. You are now at 4.
Please keep posting the same reply you have already posted 4 times and
see what happens when you get to twenty.
------------------------------
Date: Tue, 15 Dec 1998 17:10:37 -0600
From: Kevin Johnson <kevin@utig.ig.utexas.edu>
Subject: making html change
Message-Id: <3676EC6C.7F7B1922@utig.ig.utexas.edu>
Hi. I'm missing something simple here I'm sure. I've added quite a bit
of code trying various things, but maybe one of you could point out my
mistakes.
What I have is a directory full of html files. I would like to search
for the names of
these files in a html document I specify. When I find a match, I would
like to change
the text to an href pointing to the html file it corresponds to.
This is my program so far...
markup.pl:
if ($ARGV[0]) {$ifile=$ARGV[0];} else {die "markup.pl file.html"}
open(HTML,"$ifile") || die "Can't open $ifile";
open(OUT,">$ifile.bak");
opendir(THIS,"../patches");
@files=grep(!/^\.\.?$/,readdir(THIS));
closedir(THIS);
for ($i=0;$i<=$#files;$i++) {
$files[$i] = substr($files[$i],0,9);
}
while (<HTML>) {
for ($i=0;$i<=$#files;$i++) {
$href = "<a href=\"../patches/$files[$i].htm\">$files[$i]</a>";
$t = $_;
$t =~ s/$files[$i]/$href/og;
$_ = $t;
}
print OUT $_;
}
close(OUT);
close(HTML);
rename("$ifile","$ifile.old");
rename("$ifile.bak","$ifile");
Thanks in advance for your help.
Kevin Johnson
kevin@utig.ig.utexas.edu
------------------------------
Date: Wed, 16 Dec 1998 00:47:44 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Multithreading on Win32
Message-Id: <3685ef30.62974442@news3.ibm.net>
[mailed & posted]
asang@yahoo.com wrote:
> I have looked at previous postings related to multithreading, but couldn't
>get the answer. I am using Activeperl build 507 on Windows NT. It doesn't have
>Thread package. Is it possible to create multiple threads from perl on WinNT ?
>Does 'Thread' package come as a seperate extension?
No, you cannot use the Threads package with ActivePerl. ActivePerl is
build with the PERL_OBJECT option, which encapsulates the Perl interpreter
in a C++ object. You can create multiple threads outside of Perl and use
one or more Perl interpreters in each though (warning: some assembly
required). PERL_OBJECT is currently incompatible with USE_THREADS.
But you don't really want to use threaded Perl just yet. Threading is
still seriously broken in 5.005 and should be considered early alpha level
at best.
-Jan
------------------------------
Date: 15 Dec 1998 23:03:51 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Need some speed tips on this script..
Message-Id: <756psn$kt0$0@206.165.165.152>
Larry Rosler wrote in message ...
|[Posted to comp.lang.perl.misc and a copy mailed.]
|
|In article <756g7i$gei$1@spider.ci.lubbock.tx.us> on Tue, 15 Dec 1998
|14:14:08 -0600, Chris Beatson <cbeatson@mail.ci.lubbock.tx.us> says...
|> This script works fine, but it runs a bit slow. Any advice to speed it up
|> would be appreciated. Please explain any suggestions.
[snipped all the cool stuff]
|This should run blindingly fast compared to your original. Benchmarking
|up to you...
What? Benchmarking us up to someone else? No way. Larry are you considering
giving up the mantel? Passing on the pumpkin? Say it ain't so, Joe. Hope
this is just that resting up during Hanukah thing ;-).
AmD
------------------------------
Date: Tue, 15 Dec 1998 16:06:29 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need some speed tips on this script..
Message-Id: <MPG.10e0995be43e5db9898c9@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <756psn$kt0$0@206.165.165.152> on 15 Dec 1998 23:03:51 GMT,
Allan M. Due <due@murray.fordham.edu> says...
> Larry Rosler wrote in message ...
> |[Posted to comp.lang.perl.misc and a copy mailed.]
> |
> |In article <756g7i$gei$1@spider.ci.lubbock.tx.us> on Tue, 15 Dec 1998
> |14:14:08 -0600, Chris Beatson <cbeatson@mail.ci.lubbock.tx.us> says...
> |> This script works fine, but it runs a bit slow. Any advice to speed it up
> |> would be appreciated. Please explain any suggestions.
>
>
> [snipped all the cool stuff]
I looked back at my submission to see what cool stuff you are referring
to. I agree that the one-liner mapped hash slice *is* cool, and have
thanked Uri Guttman several times for pushing hash slices on me in my
infancy, many months ago. But I also found the following (essentially
copied from the original code):
> print RESULTS map "$_\n", sort keys %ips;
This is decidedly un-cool. There have been lots of discussions about
how to sort IP addresses, and this is *not* one of them. See DejaNews.
> |This should run blindingly fast compared to your original. Benchmarking
> |up to you...
>
>
> What? Benchmarking us up to someone else? No way. Larry are you considering
> giving up the mantel? Passing on the pumpkin? Say it ain't so, Joe. Hope
> this is just that resting up during Hanukah thing ;-).
This one was a no-brainer. Nothing to learn from comparing O(n**2) to
O(n). Maybe some other time when it is more interesting.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 15 Dec 1998 23:25:35 GMT
From: christian.aranda@iiginc.com (Christian M. Aranda)
Subject: Re: NEWBIE! - need help with sar output on UNIX and perl
Message-Id: <756r4i$gfn$2@news-1.news.gte.net>
On Tue, 15 Dec 1998 21:00:22 GMT, jdennis@alldata.net wrote:
>Help!
>
>I need to use perl (I think it is probably the BEST language to use)
>to format the output of sar -d on an HPUX system.
>
>sar -d gives output for each disk and tape device on a separate line, with
>only the first line giving the timestamp.
>
>I need to duplicate the timestamp for all disks in my output file.
>
>For example, the original sar -d output is as follows:
>
>00:10:01 c0t1d0 0.07 0.51 1 7 3.12 1.88
> c0t1d3 0.04 0.50 0 1 3.42 2.07
>00:20:01 c0t1d0 0.26 0.50 1 8 3.41 3.30
> c2t0d0 0.00 0.50 0 0 4.76 0.79
> c0t1d3 0.03 0.50 0 1 3.49 1.76
>00:30:01 c0t1d0 0.22 0.50 1 5 3.23 3.91
> c2t0d0 0.00 0.50 0 0 4.84 0.78
> c0t1d3 0.03 0.50 0 2 3.32 1.71
>
>I need the resulting file to look like this:
>00:10:01 c0t1d0 0.07 0.51 1 7 3.12 1.88
>00:10:01 c0t1d3 0.04 0.50 0 1 3.42 2.07
>00:20:01 c0t1d0 0.26 0.50 1 8 3.41 3.30
>00:20:01 c2t0d0 0.00 0.50 0 0 4.76 0.79
>00:20:01 c0t1d3 0.03 0.50 0 1 3.49 1.76
>00:30:01 c0t1d0 0.22 0.50 1 5 3.23 3.91
>00:30:01 c2t0d0 0.00 0.50 0 0 4.84 0.78
>00:30:01 c0t1d3 0.03 0.50 0 2 3.32 1.71
>
>Maybe this is easier than I am assuming (probably) but I have been looking at
>sed, awk, and other tools.
>
>Any help appreciated
>
>Jamie
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
you can use perl to trap the output such as:
@sar_output = `sar -d`;
then use a regular expression (regex) to grab the timestamp
/([0-9]:[0-9]:[0-9])/
$timestamp = $1;
and concat
$new_text .= $timestamp
I'm assuming you want to learn about these things instead of having
someone write the whole thing for you. With that said, what I've
written here is probably enough to get you going.
Good luck
-C
------------------------------
Date: Tue, 15 Dec 1998 22:50:50 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: Origin of 'local'?
Message-Id: <opg7lvthved.fsf@harper.uchicago.edu>
David L Nicol <david@kasey.umkc.edu> writes:
>
> Steven Morlock wrote:
> >
> > I have had an opportunity to develop in several different
> > languages and I never encountered anything quite like 'local'.
>
> Really? Ever "develop" in Pascal? Local implements scoping so that
> references to non-declared variables in called routines get the variable
> with that name from the calling function rather than the global
> namespace,
> just like Pascal variables.
Umm, what? Last time I checked (which was about a week ago for my CS
class), Pascal, along with C/C++ & Java, all implemented lexical
scoping. 'Local' does dynamic scoping.
> This is a feature which is completely absent from C/C++/Java/Basic
> but is present in Pascal. Don't know about *ol, not that old.
I believe Algol did lexical as well; some of the earlier LISP variants
used dynamic (though unintentionally, IIRC).
--
Peter A Fein
773-324-6630
p-fein@uchicago.edu
T-shirts are th' novels of the nineties. --Zippy the Pinhead
------------------------------
Date: Tue, 15 Dec 1998 18:47:03 -0600
From: johkar <johkar@netins.net>
Subject: Perl & Microsoft IIS Server
Message-Id: <36770307.2A43@netins.net>
I am a total non-programmer so please bear with me. Many of the free
perl scripts at places like Matt's script archive say they are geared to
a UNIX server. Will these work on a Windows based Microsoft server
anyway? If not, what is the difference and can they be adapted? At work
they just switched to a Microsoft server.
John
--
Check out the Des Moines Mountain Bike Page! website at:
http://www.netins.net/showcase/zoodas1/
------------------------------
Date: Tue, 15 Dec 1998 18:54:34 -0600
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: Perl multithread/multiprocess socket server example?
Message-Id: <9029BF0C90AA6E48.721488548611BC02.0FFDF941544C3159@library-proxy.airnews.net>
I've done something similar under NT. I wrote code in C++ to use completion
ports to actually have the threads come up to bat, and part of the cycle was
to call a script written in Perl, which the user can supply. I linked the
Perl DLL to the program and called perl functions and looked at perl
variables from C++. I don't remember exactly how I handled the threading --
I think calls to the script were serialized, even though the server itself
was multithreaded for data I/O.
Kyle Cordes wrote in message <74s8ki$q0aa_002@news.anet-stl.com>...
>Hi...
>
>I'm looking to build a rather simple server application in Perl. The
tricky
>part is that I want it to be a multitasking/threading/whatever server, so
>that each incoming connection spawns another process to handle the request,
>so more than one can be processes concurrently.
>
>I'm thinking that such a thing should already exist, waiting for me to plug
in
>my actual service code. However, searching CPAN, DejaNews, etc. has led me
>nowhere.
>
>I have found a few examples of single-threaded servers, always with a note
>that this is a very simple example, and a real app would probably want to
be
>able to service more than one request at once.
>
>Ideas?
>
>
>[* kyle@kylecordes.com | For Delphi | BDE Alternatives Guide *]
>[* http://www.kylecordes.com | developers: | MIDAS Alternatives Guide *]
------------------------------
Date: Tue, 15 Dec 1998 19:34:45 -0500
From: Dawn Lewandowski & Miguel Rodriguez <goffin@popmail3.vnet.net>
Subject: Perl Netware and Timeout question
Message-Id: <36770025.366C@popmail3.vnet.net>
I'm using perl to write some quick and easy network scripts for myself
to help automate some maintenance process for our 600+ server WAN.
Before upgrading to the 4.5 Netware client, my login control process,
which uses the open and | trick to run attach.exe in a dos window and
feed it a password read from my NT workstation environment, worked well
enough that I could get away with just dumping a whoami call for a
specific server into a file and test the file size to determine if I got
attached to the server. After upgrading to the latest and greatest
netware client, I had to change my process by dumping the whoami into an
array, splitting the array, and testing the first field for a user id to
determine if I got attached to the server. Does anyone have any
suggestions for a better process that I could try to attach to netware
servers and test to see if I actually got attached? It must be a bindery
login since we are still in the planning stages for upgrading to an NDS
tree. I have run across a perl module designed for NDS but have been
unwilling to try it because I work in a prodution environment.
Also, I have been looking at using SIGALRM as shown in the Perl Cookbook
(16.21) but am having a hard time getting handle on it from just reading
that short description. Can anyone provide a more understandable example
or directions to more information on using this?
--
Alea iacta est.
------------------------------
Date: Tue, 15 Dec 1998 16:25:08 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Perl newbie question..
Message-Id: <3676E1C4.E62F0BB6@us.ibm.com>
bryanb@walls-media.com wrote:
> Is there a way to delete an entire line in a text file if perl finds a
> specific string?
Consult the FAQ:
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_change_one_line_in_a_fi
It may be easier for you if, instead of thinking of the problem in terms
of deleting specific lines, you think of it as printing only those lines
which don't match your search string.
BTW: Consider next time using a more appropriate subject. Something
like "deleting lines from text files" is much more descriptive and is
more likely to attract a response. (Although, in this case, all you're
going to attract is references to the FAQ.)
Tom Phoenix provides the following URL many, many times during the
course of a single week. It's a how-to guide for picking subject
lines. It's really quite good.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Tue, 15 Dec 1998 17:13:51 -0600
From: Dane Miller <millerd@carleton.edu>
Subject: problem with grep and readdir for subdirectories
Message-Id: <3676ED2F.2DC37F06@carleton.edu>
I am trying to get a list of subdirectories for a given directory path
but am having problems. I can only retrieve subdirectories if I have
run the script from the parent-level of these directories.
For example, when I run the following code from /export/home1/netweb, I
get a list of subdirectories as I expected. But if I run it from
another location, say /export/home1/, I only get the two relative
directories '.' and '..'
opendir TEST, "/export/home1/netweb" or die "cannot open directory $!";
@subs = grep -d, readdir(TEST);
close TEST;
for (@subs){print "$_\n";}
Am I making a perl error or is this an issue with my the unix file
system?
thanks,
Dane
------------------------------
Date: Tue, 15 Dec 1998 17:26:40 -0600
From: "Mark Wright" <markscottwright@hotmail.com>
Subject: Re: reading HTTPS connections
Message-Id: <3676f03c.0@news3.uswest.net>
kevin scott wrote in message <3675CAFA.82AE93D4@nowhere.com>...
>I looking at writing a robot that will navigate my corporate intranet
>looking for specific text. PERL is the perfect language to do this,
>however, most of the sites at work are encrypted using SSL. So I
need
>to get PERL to read a HTTPS: connection. Is there a way to do this
>that is legal in the USA?
>
>I know that the PERL module LWP will allow you to read HTTPS
documents
>using using SSLeay , however, SSLeay is not legal to use in a
>corporate setting(in the USA), because of RSA's patent.
>
>Can anyone provide any help (CODE would be nice!) even if it only
works
>with HTTP
As I understand it (and since I'm not a lawyer, I probably don't
really understand it), the only way for you legally implement the SSL
protocol in the U.S. is to buy the right to do so from RSA.
Specifically, you probably will have to purchase their BSAFE product,
and then integrate it yourself with SSLeay (which might not be so
bad - from what I remember, the crypto routines for SSLeay are pretty
well modularized. Of course, you'd have to be a C programmer...)
Here's what SSLeay's FAQ (http://www.psy.uq.oz.au/~ftp/Crypto/) has to
say:
3. Is this legal?
...
inside the USA RSA hold patents over the RSA algorithms, however if
you use RSAREF (which SSLeay can link to) then non-commercial use is
probably okay. For commercial purposes you need to talk to RSA to
license one of their toolkits (BSAFE) or come to some other licensing
arrangement with them.
Mark.
---
Mark Wright
Blue Frog Software, Inc
mwright@pro-ns.net
------------------------------
Date: Tue, 15 Dec 1998 16:54:57 -0800
From: Steve Harris <perl@nullspace.com>
Subject: Re: Sorting a Two-dimensional Numerical Array
Message-Id: <367704E1.CCBA0D42@nullspace.com>
Ummm...invert the matrix (reverse x & y components),
assume that X is the number of x values and Y is the
number of y values:
foreach $x (0..X-1) {
foreach $y (0..Y-1) {
$new[$y][$x] = $util[$x][$y];
}
}
Then you can sort intuitively. Better, see if you
can rewrite just "one line" somewhere else in your
program to alter the population of the datastructure
so the components are inverted.
OR!
Use a hash of lists for each index, instead of values.
Store the array indices and not the value in those lists
and you sort your second criteria easily.
OR!
Sort everything by a composite value ($y*X + $x).
TAMTOW!
--Steve
Tom Briles wrote:
>
> What's the best (or any!) way to sort the following array on the second
> dimension (in this example 1, 2.5, and 2.5):
>
> util[0][0]=50
> util[0][1]=1
>
> util[1][0]=45
> util[1][1]=2.5
>
> util[2][0]=60
> util[2][1]=2.5
>
> No entries are guaranteed to be unique, so I don't see a way to use a hash.
>
> I'd also like to sort on the first dimension after sorting on the second.
>
> TIA,
> Tom
------------------------------
Date: Tue, 15 Dec 1998 23:16:48 GMT
From: parenc@rpi.edu (Christopher Parent)
Subject: Re: Trying to get all directories recursively
Message-Id: <3676ed53.7411542@news.ntplx.net>
Here's my resulting perl code that I didn't include in my original
message:
#!/usr/local/bin/perl
sub isDir {
if ($_[0]=~/^d/) {
/(\w*)$/;
$currentDir = $&;
@dir = (@dir, $currentDir);
return 1;
}
else { return 0; }
}
@allfiles = `ls -l`;
sub findImage {
if (isDir($_[0])) {
chdir ($currentDir);
@test = `ls`;
findImage(`ls -l`);
}
}
foreach (@allfiles) {
findImage($_);
}
----------------------------------------------------------------------
So you're saying that I have to chdir back up? to which one? Should I
have say a $prevDir and $nextDir ?
Chris
Chris
------------------------------
Date: Tue, 15 Dec 1998 18:05:29 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Trying to get all directories recursively
Message-Id: <fl_aggie-1512981805290001@aggie.coaps.fsu.edu>
In article <3676e1f1.4497610@news.ntplx.net>, parenc@rpi.edu (Christopher
Parent) wrote:
+ for some reason, i'm coming up short. After I change into the
+ directory, the script dies. If anyone has written something like this
+ and can help, I'd appreciate it.
Take a look at the docs for File::Find (perldoc File::Find). If you're
familiar with unix find(1), you can use find2perl to make things a tad
easier.
James
------------------------------
Date: 16 Dec 1998 00:33:30 GMT
From: irc_addict@hotmail.com (Thomas Brian Holdren)
Subject: Re: Why Is Perl not a Language?
Message-Id: <756v4q$rsb$1@cletus.bright.net>
In article <m3btl5kbau.fsf@moiraine.dimensional.com>,
dgris@moiraine.dimensional.com says...
>
>bart.lateur@skynet.be (Bart Lateur) writes:
>
>> "Interactive" means that the programs stops in situations like:
>>
>> Well here's the data I've got so far, now tell me what to do with it.
>>
>> Programs without an interface don't stop and ask. They go from start to
>> finish in one go.
>
>So an http server (make one request, receive one reply) is not
>interactive, while an ftp server is? Seems strange to me.
I'm not too experienced, but I wrestled with this concept not too long ago
myslef. I believe the kind of user interface Mr. Lateur is referring to as a
user interface is event driven programming (a la Visual Basic), and Mr.
Grisinger is referring to it as linear programming (a la command line). I'm
not sure which one is really considered a user interface, but the VB kind is
definitely more user-friendly.
Or maybe I'm way off the mark *again*.
tbholdren
--
Thomas Brian Holdren irc_addict@hotmail.com
"My mind is drawing a "", a '', and a //." -Me
------------------------------
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 4432
**************************************