[16172] in Perl-Users-Digest
Perl-Users Digest, Issue: 3584 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 18:06:15 2000
Date: Mon, 10 Jul 2000 15:06:03 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963266763-v9-i3584@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 10 Jul 2000 Volume: 9 Number: 3584
Today's topics:
Accessing WinNT/9x environment variables <craigc@natinst.com>
Re: Anyone have a Free Meta Crawler Script <uri@sysarch.com>
Re: Anyone have a Free Meta Crawler Script (Abigail)
Re: Can't dereference for AUTOLOAD <chuckwNOchSPAM@silverlink.net.invalid>
CGI Query string and Netscape <tgederbe@ems.jsc.nasa.gov>
Re: CGI Query string and Netscape newsposter@cthulhu.demon.nl
Re: Changes uid in CGI scripts <kasper@hauge.com>
Re: Comparing two strings (golf, anyone?) (Matthew Zimmerman)
Re: Constructing multi-level hashes <prakash@gate.net>
Re: Constructing multi-level hashes (Randal L. Schwartz)
Re: Hash vs. Array memory usage <mjcarman@home.com>
Re: Hash vs. Array memory usage <bwalton@rochester.rr.com>
Help with listing files in a directory dionysusmtl@my-deja.com
Re: Help with listing files in a directory <care227@attglobal.net>
Re: Help with listing files in a directory <bwalton@rochester.rr.com>
Re: Help with listing files in a directory <care227@attglobal.net>
Re: HTTP Last-Modified header not always returned (Abigail)
Re: HTTP Last-Modified header not always returned <flavell@mail.cern.ch>
Re: HTTPS with LWP <johnNOjoSPAM@appmagic.com.invalid>
Re: Joining lines <news@webneeds.com>
Re: Joining lines <care227@attglobal.net>
Re: multidimensional associative arrays <aqumsieh@hyperchip.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 10 Jul 2000 14:54:48 -0500
From: "Craig Conway" <craigc@natinst.com>
Subject: Accessing WinNT/9x environment variables
Message-Id: <smkaga89nu147@corp.supernews.com>
I'm writing an installer in Perl and want to update the %PATH variable
under WinNT/98/95.
How do you permanently modify an environmental variable under WinNT? Is
there a method that will also work under Win95/8 or do I just have to search
and replace in autoexec.bat for those two OS's?
Thanks.
------------------------------
Date: Mon, 10 Jul 2000 19:08:05 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Anyone have a Free Meta Crawler Script
Message-Id: <x7puoln6qz.fsf@home.sysarch.com>
>>>>> "J" == Josie <jnimpho@hotmail.com> writes:
J> Thanks very much for everyones help. You are all so helpful. What
J> happened to the time where people who visited NG's were helpful?
what happened to the time when usenet newbies lurked before posting, did
their homework, didn't expect this to be a free help desk, didn't expect
programs to be written for them, etc.
J> Sad, sad people
sad, sad poster.
there are free crawlers all around you. use a search engine to find them
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 10 Jul 2000 15:13:47 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: Anyone have a Free Meta Crawler Script
Message-Id: <slrn8mk94q.7v7.abigail@alexandra.delanet.com>
B. Chas Parisher (chas@chas.ch.intel.com) wrote on MMDV September
MCMXCIII in <URL:news:8kcu2b$8kb@news.or.intel.com>:
.. Abigail sez:
.. :) Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDIII September
.. :) MCMXCIII in <URL:news:m1itughg7a.fsf@halfdome.holdit.com>:
.. :) () Well, for the fourth time in four days, I get to plug yet another of
.. :) () my already-written columns. Is there anything *left* to write about
.. :) () after 102 columns? (Please, if you have an idea, send it to me! I'll
.. :) () give credit! Your name in lights! 2.5 columns a month is pretty
.. :) () busy!)
.. :) Well, you could always write about the question whether Paul lives or not.
..
.. *blink*
..
.. Well, how would you, using perl, play an MP3 backwards so that a new
.. generation of listeners can determine if the Beatles really sang "Paul is
.. dead"?
perldoc -f reverse
HTH. HAND.
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
------------------------------
Date: Mon, 10 Jul 2000 13:13:38 -0700
From: chuckw <chuckwNOchSPAM@silverlink.net.invalid>
Subject: Re: Can't dereference for AUTOLOAD
Message-Id: <04e476f4.41d512d2@usw-ex0105-036.remarq.com>
Yes, I would have done it that way, but I definitely do require
the index value $i.
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 10 Jul 2000 20:42:19 GMT
From: Tom Gederberg <tgederbe@ems.jsc.nasa.gov>
Subject: CGI Query string and Netscape
Message-Id: <8kdcf7$7rb$1@nnrp1.deja.com>
My appologies since this is not really a Perl question but a CGI
programming question.
I have two Perl programs that are used to view logbook entries on my
webpage (viewlog.pl and viewentry.pl). Everything works fine when
using Internet Explorer, but not with Netscape Communicator (at least
with version 4.5). Viewlog.pl reads the logbook and creates a html
page with a listing of each of the logbook entries by title. When a
user clicks on the title, viewlog.pl calls viewentry.pl to display the
logbook entry via html. Viewlog.pl has the following line:
print "<A HREF=\"/cgi-bin/viewentry.pl?$date\">$title</A>";
that calls the viewentry.pl script with $date which is the date and
time that the logbook entry was created.
In viewentry.pl, I have:
$query = $ENV{'QUERY_STRING'};
When using Internet Explorer, the QUERY_STRING contains the $date as
expected, but when using Netscape, the QUERY_STRING is empty.
Am I doing something wrong?
Thanks
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 10 Jul 2000 21:24:26 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: CGI Query string and Netscape
Message-Id: <8kdeua$dd3$1@internal-news.uu.net>
Tom Gederberg <tgederbe@ems.jsc.nasa.gov> wrote:
> My appologies since this is not really a Perl question but a CGI
> programming question.
Then you should have gone to comp.infosystems.www.authoring.cgi
I have set the followup-to for you.
> I have two Perl programs that are used to view logbook entries on my
> webpage (viewlog.pl and viewentry.pl). Everything works fine when
> using Internet Explorer, but not with Netscape Communicator (at least
> with version 4.5).
This could indicate you have an error in your HTML.
> logbook entry via html. Viewlog.pl has the following line:
> print "<A HREF=\"/cgi-bin/viewentry.pl?$date\">$title</A>";
What format is $date? Does it contain spaces?
Erik
------------------------------
Date: Mon, 10 Jul 2000 20:36:09 +0200
From: Kasper Hauge <kasper@hauge.com>
Subject: Re: Changes uid in CGI scripts
Message-Id: <396A1799.6462626C@hauge.com>
Hi again
Well ! Sorry to bother you again, but I have some problems.
Do you have any example of some code including setuid(), I can look at ??
Man page ?? do you mean the man page in my Linux shell or some place on the
net ??
I have tried a lot, but I can't find any information, that I understand, and I
still can't get it working :--(
I hope you can help, thanks
Kasper.
Kirill Miazine wrote:
> What you can do is to make the script setuid. Read man setuid for more
> info.
> Hope that helps
>
> On Tue, 4 Jul 2000, Kasper Hauge wrote:
>
> # Hi
> # I'm pretty new in writing Perl, but I have this problem. I can't changes
> #
> # uid when I'm using the script as a CGI script. It looks like I'm
> # "nobody" as default, but I'll like to changes that, to a known user. Is
> # it possible, and what command can I use ??
> #
> # I'm running Perl 5.005 on a Red hat 6.1
> #
> # Best Regards
> # Kasper
> #
> #
------------------------------
Date: 10 Jul 2000 19:33:40 GMT
From: mdz4c@node8.unix.Virginia.EDU (Matthew Zimmerman)
Subject: Re: Comparing two strings (golf, anyone?)
Message-Id: <8kd8ek$7vu$1@murdoch.acc.Virginia.EDU>
In article <m1og4553hp.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>
>I think the answer you want is something along these lines:
>
> sub compare {
> ("$_[0]" ^ "$_[1]") =~ /^(\0*)/;
> length $1;
> }
>
>Stringification necessary in case these have been used in numeric
>context.
Wow! That's so cool I barely understand it. (I wish I could get to yapc
sometime). But lemme give a crack at it. The bitwise XOR will cancel to
'\0' each character that is identical in both strings, and leave a
*non-zero* byte where each character that is not.
So, f'rinstance:
("aaaa" ^ "aaZa")
would yield
"\0\0;\0"
Then the regex essentially counts the number of '\0's from the beginning
of the string (which is not exactly what I want). But if I did something
like:
sub compare {
$xor = "$_[0]" ^ "$_[1]"; # bitwise XOR strings together
$count = $xor =~ tr/\0/\0/; # count nulls
return $count;
}
than it works fine.
That's great! Thanks!
Matt
--
--
|Matthew Zimmerman http://www.people.virginia.edu/~mdz4c |
|Interdisciplinary Biophysics Program |"I AM serious. |
|University of Virginia | And stop calling me Shirley."|
------------------------------
Date: 10 Jul 2000 18:56:47 GMT
From: Prakash Kailasa <prakash@gate.net>
Subject: Re: Constructing multi-level hashes
Message-Id: <8kd69f$1rfq$1@news.gate.net>
Tad McClellan <tadmc@metronet.com> wrote:
: On 8 Jul 2000 05:27:09 GMT, Prakash Kailasa <prakash@gate.net> wrote:
: >Please take a look at the following:
: >
: >$ perl -de 1
: >[....]
: >main::(-e:1): 1
: > DB<1> $h->{a}{b} = 'ab'
: >
: > DB<2> x $h
: >0 HASH(0xbdde5c)
: > 'a' => HASH(0xbddf94)
: > 'b' => 'ab'
: > DB<3> $h->{a}{b}{c} = 'abc'
: >
: > DB<4> x $h
: >0 HASH(0xbdde5c)
: > 'a' => HASH(0xbddf94)
: > 'b' => 'ab'
[.. code example deleted ..]
: Autovivification only happens when you try to dereference
: the undef value.
Thanks to Tad and Randal for their responses.
I did have "use strict" at the beginning of the script that I was
writing. However, the code where autovivification was supposed to
have taken place was in an eval statement. The eval expression
was being constructed at run time.
That could be why "use strict" didn't catch it. I also tried
an eval block instead of an expression, yet didn't get any error.
My question now is what could I have done to make these kind of
errors trappable even in an eval block/expression?
Thanks,
/prakash
------------------------------
Date: 10 Jul 2000 12:17:20 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Constructing multi-level hashes
Message-Id: <m1g0ph23sv.fsf@halfdome.holdit.com>
>>>>> "Prakash" == Prakash Kailasa <prakash@gate.net> writes:
Prakash> I did have "use strict" at the beginning of the script that I was
Prakash> writing. However, the code where autovivification was supposed to
Prakash> have taken place was in an eval statement. The eval expression
Prakash> was being constructed at run time.
Prakash> That could be why "use strict" didn't catch it. I also tried
Prakash> an eval block instead of an expression, yet didn't get any error.
Prakash> My question now is what could I have done to make these kind of
Prakash> errors trappable even in an eval block/expression?
Don't do that. :) Or check $@ when you come out of the eval.
If the answer is "use a runtime eval-string", you haven't asked
the right question, generally.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 10 Jul 2000 13:38:32 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Hash vs. Array memory usage
Message-Id: <396A1828.D5CE08CA@home.com>
nicolas wrote:
>
> Is there a way to know the memory usage of a variable?
>
> I have some very large variables (flat lists) that can be put in an
> array (@MyBigVar), or in a Hash (%MyBigVar) and would like to know
> the memory size of each to decide which is better.
The hash uses more. (i.e. there is higher overhead for hashes) cf.
'perldoc -q memory'
If you really want specifics, that's more difficult. Perl tries hard to
hide such implementation details from the end user. This is a Good
Thing, because otherwise you'd get bogged down worrying about memory
allocation when all you really want to do is solve some problem.
If you're truly concerned about using too much memory, look into using a
tied hash. Essentially this is a database file allowing the use of disk
space to store your data in instead of RAM. (The trade-off being speed,
of course.) cf. 'perldoc -f tie' and 'perldoc perltie'
One other thought which may or may not be applicable for you: when
processing a file it is much more memory-friendly to parse it line by
line instead of slurping the whole thing into memory first.
-mjc
------------------------------
Date: Mon, 10 Jul 2000 19:09:10 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Hash vs. Array memory usage
Message-Id: <396A1F9A.AFB3D911@rochester.rr.com>
nicolas wrote:
>
> Is there a way to know the memory usage of a variable?
>
> I have some very large variables (flat lists) that can be put in an array
> (@MyBigVar), or in a Hash (%MyBigVar) and would like to know the memory size
> of each to decide which is better.
...
> Nick
Usually memory usage isn't what decides if you need to use an array or a
hash. Rather, the method by which you need to access the data is the
deciding factor. If the data does not need to be "looked up", but does
need to be kept in some order (like even the original order), then an
array is called for. If you need to look up data by keys that are
strings, then a hash is called for. It would also be good to determine
if you even need to keep all your data in memory at once. If it, or
most of it, can be processed a line at a time, there is no need to bring
it all into memory. Probably hashes have a bit more overhead than
arrays.
Note that mostly Perl is a bit on the hoggish side with memory -- if you
have to worry about how much memory you are using, maybe some other tool
would be better? Most Perl programmers, including me, don't even know
how to check how much memory is being used by a given structure -- these
days, it doesn't usually matter much. If you want details, take a look
at "perldoc perlguts".
--
Bob Walton
------------------------------
Date: Mon, 10 Jul 2000 18:54:59 GMT
From: dionysusmtl@my-deja.com
Subject: Help with listing files in a directory
Message-Id: <8kd663$5r6$1@nnrp2.deja.com>
#!/usr/bin/perl
opendir(carts, "d\:/scripts/store2/shopping_carts");
@files = readdir(carts);
closedir(carts);
foreach $file (@files) {
print "$file\n";
}
----------------------------
I'm using the above script to view the files in a directory. It seems very
standard however, all I get returned is this:
CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are: #---- and there is nothing
after this.
Nothing I do seems to work, and once I get this working, I want to specify
listing only the filenames that contain "abc". But I can't even make this
beginning part work and I'm at the end of my rope. Can anyone figure this
out? I can't even find the word "misbehaved" anywhere in this forum.
Thanks,
George
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 10 Jul 2000 15:12:40 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Help with listing files in a directory
Message-Id: <396A2028.9E8089BB@attglobal.net>
dionysusmtl@my-deja.com wrote:
>
> #!/usr/bin/perl
>
> opendir(carts, "d\:/scripts/store2/shopping_carts");
> @files = readdir(carts);
> closedir(carts);
>
> foreach $file (@files) {
> print "$file\n";
> }
>
> ----------------------------
>
> I'm using the above script to view the files in a directory. It seems very
> standard however, all I get returned is this:
>
> CGI Error
>
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers. The headers it did return are: #---- and there is nothing
> after this.
>
The error couldn't be more verbose about why it appears. A simple
search of either the archives of this NG or of the web would have
quickly shown you your fault. Also, this is covered in _EVERY_ CGI
FAQ that I've ever seen.
Next time, look before you ask.
------------------------------
Date: Mon, 10 Jul 2000 19:34:28 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Help with listing files in a directory
Message-Id: <396A2588.5EF90F65@rochester.rr.com>
dionysusmtl@my-deja.com wrote:
>
> #!/usr/bin/perl
>
> opendir(carts, "d\:/scripts/store2/shopping_carts");
remove------------------^
Also add " or die "Oops, couldn't open shopping_carts, $!\n" after )
Also, by convention, filehandles are all caps.
> @files = readdir(carts);
> closedir(carts);
>
> foreach $file (@files) {
> print "$file\n";
> }
>
> ----------------------------
>
> I'm using the above script to view the files in a directory. It seems very
> standard however, all I get returned is this:
>
> CGI Error
>
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers. The headers it did return are: #---- and there is nothing
> after this.
>
> Nothing I do seems to work, and once I get this working, I want to specify
> listing only the filenames that contain "abc". But I can't even make this
> beginning part work and I'm at the end of my rope. Can anyone figure this
> out? I can't even find the word "misbehaved" anywhere in this forum.
>
> Thanks,
> George
...
Well, if the above script is supposed to be a CGI script, you are
missing lots. Like:
use CGI;
for starters. Do:
perldoc CGI
at a command prompt and follow along with the examples etc there.
You've got a lot to learn. Hints: search for fatalsToBrowser in the
above documentation for much easier debugging. See if you can get this
to work before doing anything else:
#!/usr/local/bin/perl -w
use CGI; # load CGI routines
$q = new CGI; # create new CGI object
print $q->header, # create the HTTP header
$q->start_html('hello world'), # start the HTML
$q->h1('hello world'), # level 1 header
$q->end_html; # end the HTML
--
Bob Walton
------------------------------
Date: Mon, 10 Jul 2000 15:40:08 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Help with listing files in a directory
Message-Id: <396A2698.E5B3680A@attglobal.net>
Bob Walton wrote:
>
> #!/usr/local/bin/perl -w
> use CGI; # load CGI routines
> $q = new CGI; # create new CGI object
> print $q->header, # create the HTTP header
> $q->start_html('hello world'), # start the HTML
> $q->h1('hello world'), # level 1 header
> $q->end_html; # end the HTML
>
> --
> Bob Walton
You forgot the must have CGI switch, -T and use strict;
#!/usr/local/bin/perl -Tw
use strict;
use CGI qw(:standard); # OO interface begone!
print header, # create the HTTP header
start_html('hello world'), # start the HTML
h1('hello world'), # level 1 header
end_html; # end the HTML
------------------------------
Date: 10 Jul 2000 15:19:06 EDT
From: abigail@delanet.com (Abigail)
Subject: Re: HTTP Last-Modified header not always returned
Message-Id: <slrn8mk9en.7v7.abigail@alexandra.delanet.com>
nicolas (webmaster@archiTacTic.com) wrote on MMDIV September MCMXCIII in
<URL:news:rL0a5.15324$DL.63646@nnrp1.none.net>:
"" Abigail <abigail@delanet.com> a écrit dans le message :
"" slrn8mh4l5.tts.abigail@alexandra.delanet.com...
"" > nicolas (webmaster@archiTacTic.com) wrote on MMDIV September MCMXCIII in
"" > <URL:news:scX95.15287$DL.63169@nnrp1.none.net>:
""
"" > No, it isn't. What makes you think so? Would you ask about FTP in a
"" > FORTRAN group, about NNTP in a Java group and about SMTP in an Ada
"" > group?
"" >
"" > Your question is not a Perl question. Please ask in a more appropriate
"" group.
"" >
"" Why are you so angry?
Someone thought The Big Red Button was a light switch.
"" Where are there HTTP groups?
Ask your news admin. There are a gazillions groups floating around.
You cannot expect this group to keep track of what is discussed where.
All we need to distinguish between is "on-topic" and "off-topic".
And "off-topic" issues are discussed "out there".
"" Isn't Perl meant to deal with HTTP?
Sure it is. It's also meant to deal with spam. Do you want to have this
group flooded with spam too?
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
------------------------------
Date: Mon, 10 Jul 2000 22:02:24 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: HTTP Last-Modified header not always returned
Message-Id: <Pine.GHP.4.21.0007102156580.25599-100000@hpplus03.cern.ch>
On Mon, 10 Jul 2000, Uri Guttman wrote:
> i don't know if you noticed,
If it's any help to you, yes I (for one) did notice.
> that there are 3 groups listed in the
> headers so 'this group' is meaningless.
S'OK, because it's sufficiently off-topic for all of them.
If there isn't a comp.protocols.http (the local news server says there
isn't: it's certainly arguable that one is needed, but that's another
issue) then the appropriate group is surely going to have WWW in its
name, n'est-ce pas?
------------------------------
Date: Mon, 10 Jul 2000 12:37:27 -0700
From: john <johnNOjoSPAM@appmagic.com.invalid>
Subject: Re: HTTPS with LWP
Message-Id: <03067aca.247b90c4@usw-ex0104-032.remarq.com>
I was finally able to get it working several weeks ago. The last
problem was forgetting to seed the random number geneerator.
Here's a complete transcript of what it took to make it
work--there are still a few problems, but none interfere with
use.
Perl SSL Build Notes for NT Perl version 5.004.02:
Download and unpack:
perl5_00402-bindist04-bc.zip
Crypt-SSLeay-0_16_tar.gz
openssl-0_9_5a_tar.gz
Install perl5_00402 to d:\perl. Specify paths for Visual C++
compiler.
put nasm.exe in the bin directory for Visual C++ (typically
C:\Program Files\Microsoft Visual
Studio\Common\MSDev98\Bin\nasmw.exe).
cd to the openssl directory (typically C:\TEMP\openssl-0.9.5a)
follow instructions in install.w32 using the assembler
instructions with the following exceptions:
As instructed, first do perl Configure VC-WIN32, then make the
following changes
Perl overrides all the socket routines so we must make sure that
openssl uses perl's versions. To do this modify
# include <winsock.h>
in e_os.h to
# include <openssl/socket.h>
and copy perl's socket definitions
(D:\perl\lib\CORE\sys\socket.h) to openssl's include directory
(C:\TEMP\openssl-0.9.5a\inc32\openssl\socket.h)
open the make file (ms\nt.mak of ms\ntdll.mak) and add the perl
library (D:\perl\lib\CORE\perl.lib) just before every occurrence
of wsock.dll.
Don't forget to seed the random number generator--security is no
better than your seed! Go to ssleay_rand_initialize in
crypto\rand\md_rand.c and add
#ifdef WINDOWS
RAND_screen ();
#endif
to the beginning of ssleay_rand_initialize. This uses the
contents of the screen for the seed.
test it as follows
> cd out32
> ..\ms\test
build openssl. I used the non-dll version, but the dll version
works as well. If you use the dll version you need to remember to
copy the dlls to the right perl bin directory.
nmake -f ms\nt.mak
Now build Crypt-SSLeay
It has a bunch of win32 problems you need to fix:
In Makefile.PL modify the possible ssl directories from the UNIX
version to the win23 version
my @POSSIBLE_SSL_DIRS = qw(/usr/local/openssl /usr/local/ssl
/local/ssl /opt/ssl /local /usr);
changes to
my @POSSIBLE_SSL_DIRS = qw(C:/TEMP/openssl-0.9.5a)
Modify every occurrence of "/include" to "/inc32" and "\lib" to
"\out32" and "/lib" to "/out32"
In SSLeay.xs modify the following code:
#ifdef _WIN32
SSL_set_fd(RETVAL,
_get_osfhandle(PerlIO_fileno(io)));
#else
SSL_set_fd(RETVAL, PerlIO_fileno(io));
#endif
to remove the use of _get_osfhandle:
SSL_set_fd(RETVAL, PerlIO_fileno(io));
This doesn't apply to our version of perl built with the Borland
compiler.
Also change all occurrences of PL_sv_undef to sv_undef in
SSLeay.xs for our version of Perl.
build the makefile:
perl Makefile.pl
Totally braindamaged Makefile.pl doesn't easily allow including
two required libraries: WSOCK32.LIB and gdi32.lib. Hack them in
to the link.
do a nmake install
run net_ssl_test in the Crypt-SSLeay-0.16 directory. Don't forget
to add
Proto => 'tcp'
to the Net::SSL->new call
Also, comment out the following lines. I'm not sure why they
cause a problem yet.
#$cert = $sock->get_peer_certificate;
#print "THIS IS: ", $cert->subject_name, "\n";
#print "CERTIFIED BY: ", $cert->issuer_name, "\n";
Also, modify get_peer_certificate in perl\lib\site\Net\SSL.pm to
add an extra line, say "my $junk" at the end of the routine. I'm
not sure why this causes a problem yet.
john <johnNOjoSPAM@appmagic.com.invalid> wrote:
>I made some progress. First downgrading openssl didn't work for
>me. By the way, I'm using NT, not UNIX.
>
>Bad file descriptor is returned in many situations were the
>connection fails.
>
>My version of Perl (perl5.004 binary for NT) overrides the
>socket functions, replacing them with aversion that isn't
>compatible with Microsoft's version. I solved this problem, but
>still get Bad file descriptor. DH_generate_key fails during the
>v3 ssl server connection.
>
>John
>
>
>
>In article <Pine.BSF.4.21.0006121715150.39206-
>100000@king.cts.com>, Jason Brown <jrbrown@cts.com> wrote:
>>
>>I think I may know the problem. According to the
>>Crypt:SSLeay on-line documentation, the following
>>OpenSSL versions are compatible:
>>
>>
>> PLATFORM CPU SSL PERL DATE
>WHO
>> -------- --- --- ---- ----
> ---
>> WinNT SP4 x86 OpenSSL 0.9.4 5.00404 1999-10-03
>Joshua Chamas
>> FreeBSD 3.2 ?x86 OpenSSL 0.9.2b 5.00503 1999-09-29
>Rip Toren
>> Solaris 2.6 ?Sparc OpenSSL 0.9.4 5.00404 1999-08-24
>Patrick Killelea
>> FreeBSD 2.2.5 x86 OpenSSL 0.9.3 5.00404 1999-08-19
>Andy Lee
>> Solaris 2.5.1 USparc OpenSSL 0.9.4 5.00503 1999-08-18
>Marek Rouchal
>> Solaris 2.6 x86 OpenSSL 0.9.4 5.00501 1999-08-12
>Joshua Chamas
>> Solaris 2.6 x86 SSLeay 0.8.0 5.00501 1999-08-12
>Joshua Chamas
>> Linux 2.2.10 x86 OpenSSL 0.9.4 5.00503 1999-08-11
>John Barrett
>> WinNT SP4 x86 SSLeay 0.9.2 5.00404 1999-08-10
>Joshua Chamas
>>
>>Looks like in both of our cases, we need to download and
install
>>OpenSSl 0.9.4. This also means we need to recompile
>Crypt:SSLeay.
>>
>>I have not tried it yet, but will let you know the results of
my
>>test.
>>
>>
>>
>>
>>On Thu, 8 Jun 2000, john wrote:
>>
>>> In article
>>> <Pine.BSF.4.21.0006071012350.79067-100000@king.cts.com>,
Jason
>>> Brown <jrbrown@cts.com> wrote:
>>> >
>>> >I am writing a PERL script to fetch a web page encrypted by
>SSL.
>>> >
>>> >I installed:
>>> >
>>> >>I got the following error:
>>> >
>>> >Failed: 500 Can't connect to www.helsinki.fi:443 (Bad file
>>> number)
>>> >
>>> >
>>> >What am I doing wrong?????
>>>
>>> I'm doing the same thing on Windows NT (using the same
>versions
>>> of modules Cryp-Leay, libwww, and openssl) and get the same
>>> error. With debugging turned on I see:
>>>
>>> LWP::UserAgent::new: ()
>>> retrieving
>>> https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+Loginpage
>>> LWP::UserAgent::request: ()
>>> LWP::UserAgent::simple_request: GET
>>> https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+Loginpage
>>> LWP::UserAgent::_need_proxy: Not proxied
>>> LWP::Protocol::http::request: ()
>>> LWP::UserAgent::request: Simple response: Internal Server
>Error
>>> Error: 500 Can't connect to trading.etrade.com:443 (Bad file
>>> descriptor)
>>>
>>> So far, I've tracked it down to the connect in openssl
>returning
>>> a -1 for all favors of SSL. Let me know if you figure it out.
>>>
>>> John Anderson
>>>
>>>
>>> * Sent from RemarQ http://www.remarq.com The Internet's
>Discussion Network *
>>> The fastest and easiest way to search and participate in
>Usenet - Free!
>>>
>>>
>>
>>Jason Brown
>>UNIX System Admin.
>>
>>
>>
>>
>
>
>* Sent from RemarQ http://www.remarq.com The Internet's
Discussion Network *
>The fastest and easiest way to search and participate in Usenet
- Free!
>
>
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 10 Jul 2000 14:18:58 -0600
From: "Dan Manion" <news@webneeds.com>
Subject: Re: Joining lines
Message-Id: <P1sa5.2133$yd.167560@news.uswest.net>
Woah .. lay off the crack or whatever you're smoking dude. I replied with 4
lines of code .. sorry if that exceeds you're definition of a snippet. I
answered a very basic question with a very basic reply. Seems to be a
little more productive than your contributions to this thread.
"Rick Stricker" <webmaster@[spamblock]web-slingers.com> wrote in message
news:395a8844.0@speedtrap.i2k.com...
> That's the reply I'd expect from someone who doesn't know
> the answer.
>
> Nobody asked for a complete app, just a code snippet.
> That's the purpose of Usenet, BTW
>
> .
> Dan Manion wrote in message ...
> >## First step ... open your file
> >open (FILE, "bigassfile") || die "open error: $!";
> >my @ALL = <FILE>;
> >close (FILE);
> >## SEE perldoc -f open
> >
> >##2nd step ... use chomp.
> >chomp(@ALL);
> >## SEE perldoc -f chomp
> >
> >##3rd Step ... use join.
> >my $str = join('',@ALL);
> >##perldoc -f join
> >
> >
> >There are tons of great books and online documentation on learning perl.
> >Might be worth your time to go find some good bathroom reading material
and
> >start to tackle some of the basics.
> >
> >Hope this helps!
> >
> >"R.Roe" <rroe@mail.com> wrote in message
> >news:8F617E505rroemailcom@64.34.205.9...
> >> I would appreciate help with with the following:
> >> I need to convert a text file containing several lines which have
> carriage
> >> returns at the end, into one long string by joining the lines. How do I
> >write
> >> the perl code for this please?
> >>
> >> Thanks in advance.
> >
> >
>
>
>
------------------------------
Date: Mon, 10 Jul 2000 16:30:11 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Joining lines
Message-Id: <396A3253.6D647703@attglobal.net>
Rick Stricker wrote:
>
> That's the reply I'd expect from someone who doesn't know
> the answer.
>
> Nobody asked for a complete app, just a code snippet.
> That's the purpose of Usenet, BTW
Here's the code snippet you need.
#snippet to follow
close (FILE);
That should point you in the right direction.
------------------------------
Date: Mon, 10 Jul 2000 20:03:26 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: multidimensional associative arrays
Message-Id: <7a66qdlplc.fsf@merlin.hyperchip.com>
Philip Rennert <phil.rennert@ioip.com> writes:
> Hmm... some constructions here I don't understand.
>
> 1) Does %{$a{"Fred"}} refer to a subarray (or sublist) of all elements
> of the
> multidimensional array which have "Fred" as the first index? If so,
> how would
> you indicate the same thing with "Fred" as the second index?
Let's get terminology correct first. Hashes have keys and corresponding
values. The important thing to remember is
"Keys and values have to be scalars."
So, in order to nest hashes, you have to use hash references (which are
scalars), and store those as values for corresponding keys.
Thus, $a{Fred} can not have a hash as a value. It can have a hash
*reference* as a value, though. In order to dereference the hash
reference, you need to prefix it with %. The braces are there just to
get precedence correct. So
%{$a{Fred}}
accesses the hash that is referenced by $a{Fred}.
Of course, all of this and more is explained in perldsc. Go read it.
> 2) What does "my" mean?
It defines the scope of the variable to be lexical to the current
scope. This means that code outside of that scope will not be able to
acces this variable. This is good programming practice. Read more about
my() in perlfunc and perlsub.
> What I want is, given:
> $a{"Fred"}{"hello"}=6;
> $a{"Fred"}{"goodbye"}=4;
> $a{"George"}{"hello"}=3;
> $a{"hello"}{"Fred"}=1;
> etc.,
> sum the values of all elements with "Fred" as the first index, say.
my $count = 0;
for my $innerkey (keys %{$a{Fred}}) {
$count += $a{Fred}{$innerkey};
}
or
my $count = 0;
for my $innervalue (vales %{$a{Fred}}) {
$count += $innervalue;
}
--Ala
------------------------------
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 3584
**************************************