[7253] in Perl-Users-Digest
Perl-Users Digest, Issue: 878 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 16 04:07:20 1997
Date: Sat, 16 Aug 97 01:00:30 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 16 Aug 1997 Volume: 8 Number: 878
Today's topics:
(try this:) Arraynames in associative arrays as local o ptrainor@aura.title14.com
Re: (try this:) Arraynames in associative arrays as loc <rootbeer@teleport.com>
Re: .htgroup files and HTTPD:GroupAdmin:Text.pm <jwyates@netcom.com>
Formats from w/in a sub <delta@user1.inficad.com>
Re: How can I make traceroute CGI? <rootbeer@teleport.com>
Re: I'm looking for a perl logo... (Scott Maxwell)
Re: Indexing search engine? (Michael Schuerig)
newbie cgi question. <raymond@sj.bigger.net>
Re: Perl 5.00[2 and 3] compile problems under SCO OSR 5 (Danny Aldham)
Perl Performance FAQ? (Mark A. Lehmann)
Re: perl5 regexes slower than perl4? (Andrew Dalke)
Re: perl5 regexes slower than perl4? (Andrew Dalke)
proxy problem in perl <xuchu@iscs.nus.edu.sg>
Question on SSI #exec <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Question <galin@sprynet.com>
Re: Question <rootbeer@teleport.com>
Saving array in hash tied to dbm? (Michael Schuerig)
sockets on IRIX? ((classified))
Re: The eternal question: Has anyone gotten DynaLoader <dan_aug97@unitech.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Aug 1997 23:21:57 -0600
From: ptrainor@aura.title14.com
Subject: (try this:) Arraynames in associative arrays as local or global variables.
Message-Id: <871704882.15526@dejanews.com>
>From jefpin@bergen.org Fri Aug 15 23:38:19 1997
Date: Fri, 15 Aug 1997 17:41:49 -0400 (EDT)
From: Anagrams of the Word 'A' <jefpin@bergen.org>
To: Pat Trainor <ptrainor@aura.title14.com>
Subject: Re: Perl Problem: Sorting
> $a="SECT_" . $SECTION . "_CHOICES";
> print $a; yields:
> SECT_0001
It works with Perl4 and Perl5 here...
just try:
$a = "SECT_${SECTION}_CHOICES";
That should work.
---
And it does, _except_ when I try this translation of variables in
an associative array:
(note: the call to the dbm file works, and creates/opens the
indicated file. In the case where $SECTION would be equal to 0002, that
would be the file: sect_0002_choices.db and
sect_0002_choices_descriptions.db)
######################
dbmopen
(%SECT_${SECTION}_CHOICES,"sect_${SECTION}_choices.db",0600);
dbmopen
(%SECT_${SECTION}_DESCRIPTIONS,"sect_${SECTION}_choices_descriptions.db",0
600);
foreach (sort keys %SECTION_${SECTION}_CHOICES ) {
print "\<a href=\"$base\FAQ.pl/2?SECTION=$SECTION\&SUB=$_\"\>
$SECT\_${SECTION}\_CHOICES{$_} </a> ";
print "$SECT\_${SECTION}\_DESCRIPTIONS{$_} <br>";
$nextsub="$_";
}
(btw: $nextsub is used when it's time to add a new db entry.)
dbmclose ...
################################
Initially the problem that got me this far (that I quoted at the
top of the message here, was due to (apparently) a call to variables
parsed
from the previous pass earlier in the script:
# parse input passed from last pass
if (&parse_input(*fields)) {
$SECTION=$fields{'SECTION'};
$SUB=$fields{'SUB'};
$ITEM=$fields{'ITEM'};
}
this code was outside (above) the subroutine called that _did_ have the
'error'.
################################
At this point, I should say that the entire program resides in one
script. I use the POST method with QUERY_STRING and PATH_INFO to pass
changed/generated variables back to the script. The script then uses these
variables to control program flow for that pass.
Unfortunately, this means I have a bunch of nested, or local,
variables and am trying to figure out how and whom should variables be
global, aliased, etc..
The trouble starts when an associative array's name is called as a
variable. I cannot find a way that perl is happy with. Now before anyone
shoots me, I have been going through all my books and the faq sites all
today to try and figure this out. Example(from above):
dbmopen (%SECT_${SECTION}_CHOICES,"sect_${SECTION}_choices.db",0600);
(translation would _ideally_ be(if $SECTION were 0002):
dbmopen (%SECT_0002_CHOICES,"sect_0002_choices.db",0600);)
I am trying desperately to get an associative array associated
with (in this case) an array and filename that are both determined by a
variable $SECTION. This variable is a 4 digit number (0000-9999) with
sprintf("%04d",$SECTION) applied. Therefore, when this code is parsed the
variable $SECTION determines/directs which section(database) to open and
read/write values & keys to/from.
Trouble starts when executed as:
##########################
Scalar found where operator expected at ./FAQ.pl line 125, near
"%SECT_${SECTION}"
(Missing operator before ${SECTION}?)
syntax error at ./FAQ.pl line 125, near "%SECT_${SECTION}"
Bare word found where operator expected at ./FAQ.pl line 125, near
"${SECTION}_CHOICES"
(Missing operator before _CHOICES?)
Scalar found where operator expected at ./FAQ.pl line 126, near
"%SECT_${SECTION}"
(Missing operator before ${SECTION}?)
[...]
#############################
Now, I have done my reading:
(page 186 purple Learning Perl)
dbmopen(%ARRAYNAME, "dbmfilename", $mode);
"Any legal associative array name may be used, although
uppercase-only array names are typical because of their functional
similarities to filehandles."
ok.. so what is a "legal" arrayname?
(page 73, same book)
"An associative array variable name is a percent sign (%) followed
by a letter, followed by 0 or more letters, digits, and underscores."
Well, that's fine.. But there are no examples of how to create the
associative array variable's name out of another variable, or even a part
of it (as in the above example code from the appy I'm doing).
I'm looking at type-globbing and aliasing (I'll assume glob is
short for global?) as a way to throw variables in that perl will be happy
to use as an associative array name, but these are merely ways
(apparently)
to have subroutines call generic local variables (with common, easy,
repeatable names) from "glob" or global (above the sub) values. Am I far
off?
Now this is my first perl program, and I've only been at perl
since
tuesday, so these questions may seem a little boring to the experts out
there. I do appologize. But trust me, I have put the hours in looking and
experimenting before I posted to the newsgroup. I see and learn so much
from just reading exchanges here, perhaps someone more shy than me can
learn from this post.
Thanks a million (already!) to Jeff and all the great folks who
have
replied to my petty hair-pulling questions in past! Please accept my most
sincere gratitude in advance for any leads on this one. I feel like the
guy
playing checkers, not seeing the tripple jump, with a guy behind me going
"ooh! ooh!".
Pat Trainor
hopelessly lost with the map right in front of him...
ptrainor@aura.title14.com
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Fri, 15 Aug 1997 22:34:58 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: ptrainor@aura.title14.com
Subject: Re: (try this:) Arraynames in associative arrays as local or global variables.
Message-Id: <Pine.GSO.3.96.970815222933.19145F-100000@julie.teleport.com>
On Fri, 15 Aug 1997 ptrainor@aura.title14.com wrote:
> foreach (sort keys %SECTION_${SECTION}_CHOICES ) {
You can't do that kind of thing. Interpolating a variable name works in
double-quotish strings, but it can't happen everywhere. It never happens
in just-plain code.
You can do the kind of thing that (I think) you want with references, to
make a hash of a hash. See the perlref, perllol, and perldsc manpages.
for (sort keys %{ $section_choices{$section} } ) { ... }
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 16 Aug 1997 04:20:00 GMT
From: "John W. Yates" <jwyates@netcom.com>
To: Doug MacEachern <dougm@osf.org>
Subject: Re: .htgroup files and HTTPD:GroupAdmin:Text.pm
Message-Id: <33F52A70.542C@netcom.com>
Doug MacEachern wrote:
>
> John W. Yates wrote:
> >
> > Hi,
> >
> > I'm coding some stuff using HTTPD::GroupAdmin and think it has
> > a bug, or at least and incompatability with in "Text" mode Apache:
> > It creates .htgroup files comma delimited. I believe Apache is
> > interpreting the comma as part of the logon name in the group list
> > and thus all but the last name in the list fail authentication when
> > I try to use group authentication.
<snip>
>
> That behavior dates back to when Apache and NCSA shared the same file
> format. To use the new Apache format, try this:
>
> my $group = HTTPD::GroupAdmin->new(
> DBType => "Text",
> Server => "apache",
> ...);
I was already doing this. Do you know a HTTPD version number associated
with the change (or a place to find out?). Perhaps the ISP has an old
version. . .
> See also, t/apache-groups.t
Sorry, I don't know what the above reference. . .
> -Doug
--
John W. Yates mailto:jwyates@netcom.com \
home page: ftp://ftp.netcom.com/pub/jw/jwyates/jwyates.html
------------------------------
Date: 16 Aug 1997 07:16:11 GMT
From: Jerald Jackson <delta@user1.inficad.com>
Subject: Formats from w/in a sub
Message-Id: <5t3k3r$l24$1@news.inficad.com>
I am attempting to pass info from a sub containing a format for a header.
this header will be written to a logfile along with data from the sub that
called the format sub. I have included a the first calling sub and the format
sub. I know this is embarassingly kludgy code, but if someone could clue me
in on how to get the header data into the logfile, I would appreciate it.
I have checked in both the Programming Perl (2d ed) and Learning Perl (2d ed)
and cannot find exactly what I need. Porbably just an amazing case of brainlock
on my part, but any assistance provided will be met with much gratitude.
chomp ($host = `uname -n`);
$logdir = ".";
#$logdir = "/backupimages/nodes/config";
$logfile = "$logdir/$host.config";
$mailto = "root";
$side = "|";
$oslev = `oslevel`;
$network_out = get_network_info();
$disk_out = get_disk_info();
$lv_out = get_lv_info();
$vg_out = get_vg_info();
$fs_out = get_fs_info();
$hw_out = get_hw_info();
open (LOG, "+>>$logfile");
print LOG "$oslev\n\n $network_out\n\n";
print LOG "End of info for $host";
sub header {
$category = "$var information for $host";
format HEADER_TOP =
-----------------------------------------------------------------
| |
| |
@< @||||||||||||||||||||||||||||||||||||||| @>
$side, $category, $side
.
format HEADER_BOTTOM =
| |
| |
-----------------------------------------------------------------
.
$~ = "HEADER_TOP";
$foo = print;
return ($foo);
}
sub get_network_info {
my $var = "Network";
my @net = `netstat -i`;
my @net2 = `netstat -rn`;
$get_network_info = header($var) ;
return ($get_network_info, @net, @net2);
}
------------------------------
Date: Fri, 15 Aug 1997 21:56:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: stormshield@hotmail.com
Subject: Re: How can I make traceroute CGI?
Message-Id: <Pine.GSO.3.96.970815214141.19145B-100000@julie.teleport.com>
On Fri, 15 Aug 1997 stormshield@hotmail.com wrote:
> Newsgroups: alt.html, comp.infosystems.www.authoring.html,
> comp.infosystems.www.servers.unix, comp.lang.javascript,
> comp.lang.java.programmer, comp.lang.perl.misc
When you post to many newsgroups, you should usually set followups to the
one that's most appropriate. Since this topic doesn't have anything
specifically to do with perl, java, javascript, or html, I'll set
followups to comp.infosystems.www.servers.unix.
> I want to add traceroute menu in my homepage so that Netizens from
> abroad can know how they're connected to my homepage.
It's a nice idea, I suppose, but if you initiate a traceroute from your
end, you may well get a different route than they're using. The net
_is_ dynamic, after all. Even if you get them to do a traceroute from
their end, they're not always going to get the same route twice, but at
least that would be more likely to be accurate and more useful for them.
But if you want to, there's no reason you can't make a CGI script which
runs traceroute and passes its output back to their browser. If they're
many hops away, and if you're going to get the names (and not just
numbers) of the intermediate sites, you should expect it to take perhaps a
minute or two to run, typically. So maybe you'll want to tell them to do
this only if they're very patient. :-) (Your webmaster or sysadmin
may be upset if your users get impatient and click again and again on the
traceroute choice. If you don't write your script with this possibility in
mind, it might be possible to have several dozen traceroutes running at
once. Eek!)
For less load on your system, you could probably make something
browser-side with Java, but of course it will only work on machines with
Java support turned on. For even greater ease, portability, and
flexibility, you could just tell them to run traceroute on their own
machine. :-)
In sum: It's probably useless, but if it's written with care it could be
fun. Good luck with it!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 16 Aug 1997 02:42:24 GMT
From: maxwell@natasha.jpl.nasa.gov (Scott Maxwell)
Subject: Re: I'm looking for a perl logo...
Message-Id: <MAXWELL.97Aug15194224@yoda.jpl.nasa.gov>
Duh, I should have looked a little more before posting on this topic
earlier. I ought to have visited
http://www.ora.com/info/perl/republic/usage.html
which has such a logo and sets terms for its use. Please note that
this site also says,
"The use of a camel image in conjunction with Perl is a
trademark of O'Reilly & Associates, Inc."
Since trademark infringement is nothing to take lightly, I suggest you
use this logo on your Web site and abide by their terms.
--
-------------------------+-----------------------------------------------------
// Scott Maxwell: | ``All labor that uplifts humanity has dignity and
\\// maxwell@ | importance and should be undertaken with painstaking
XX natasha.jpl.nasa.gov | excellence.'' -- Martin Luther King, Jr.
------------------------------
Date: Sat, 16 Aug 1997 02:42:06 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Re: Indexing search engine?
Message-Id: <19970816024206778327@rhrz-isdn3-p26.rhrz.uni-bonn.de>
Neil Edmondson <neiled@enteract.com> wrote:
> Try the following ... a crawler, which ain't fast - cos it's indexing EVERY
> word); then a searcher, which is fast cos the major work has already been
> done by crawler (via CGI - so you'd have to redo that, but the principles
> are prob. the same).
>
> I also recommend checking out that reference for Brian Slesinsky -
> http://www.webmonkey.com/code/97/16/index2a.html
Thanks! It works. I'll come back to the newsgroup with it after some
more adaptions.
Michael
--
Michael Schuerig Although condemned by moralist,
mailto:uzs90z@uni-bonn.de lying can have high survival-value.
http://www.uni-bonn.de/~uzs90z/ -Richard L. Gregory
------------------------------
Date: Fri, 15 Aug 1997 22:53:27 -0700
From: ray <raymond@sj.bigger.net>
Subject: newbie cgi question.
Message-Id: <33F54057.5A63@sj.bigger.net>
I am having problems in trying to use cgi.pm to get the selected list of
items from a list created in a form for html. The list was created as a
scrolling list with MULTIPLE added to its tag. However, when I call
$query = new CGI();
$x = $query->param($listName);
then $x only contains the first selected item from the list.
------------------------------
Date: 15 Aug 1997 22:16:33 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Perl 5.00[2 and 3] compile problems under SCO OSR 5.0.4
Message-Id: <5t3d3h$hhf$1@lennon.postino.com>
McKay (scmckay@ix.netcom.com) wrote:
: Has anyone attempted to compile Perl 5.003 with SCO Development
: package. I actually run into the same problem when compiling 5.002.
: This following are the last few lines before it fails:
: cc -o miniperl miniperlmain.o libperl.a -lintl -lsocket -lnsl
: -lndbm -
: ldbm -lld -lm -lc -lcrypt -lPW -lx
: ./miniperl configpm tmp
: sh mv-if-diff tmp lib/Config.pm
: File lib/Config.pm not changed.
: ./miniperl -Ilib pod/pod2html.PL
: *** Termination code 139 (bu21)
I have always built perl with gcc, and it builds flawlessly out of the box.
If you insist on using SCO's cc , check at ftp.sco.com in Skunk2 or Skunk96.
There is a package there built with SCO's dev kit, and you can get their
config.sh out of the package. This package also has the advantage of including
dynamic loading of modules.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: 15 Aug 1997 23:39:58 -0500
From: mlehmann@prismnet.com (Mark A. Lehmann)
Subject: Perl Performance FAQ?
Message-Id: <5b203un3kx.fsf@smokey.prismnet.com>
I see a lot of need to up my scripts performance. I own a perl application
that consists of about 100 perl files and perhaps 18,000 lines of Perl code.
I find that the code typically takes 15 to 20 seconds to compile and run each
time. Here are some of the things I have tried to make it faster:
- redesign the underlaying code so that the algorithms are looping only
where necessary (and several other Analysis of Algorithms techniques to
get algorithms into a decent order of magnitude)
- compile the code with the perl to C compiler. This typically core
dumped, but the litte that I could compile showed only a trival
performance improvement
- use mod_perl apache module for the parts of the application that can be
accessed from the Apache server
- implemented the options listed in the "Programming Perl" book which
pertain to Time Efficiency starting on page 537.
However, I would like to have a FAQ or common respository of hints, tips, and
testimonies on increasing perl performance. I know that Perl programmers
care mostly about the speed that they can produce quality code, but my
customers don't care how quick I can write the code, they want quick
application turnaround and quick implemtation.
I'll provide the website or maintain the FAQ, but I need to know if this
already exists and if there is interest in this topic.
--
Mark Lehmann.
------------------------------
Date: 16 Aug 1997 07:09:40 GMT
From: dalke@ks.uiuc.edu (Andrew Dalke)
Subject: Re: perl5 regexes slower than perl4?
Message-Id: <5t3jnk$12f$1@vixen.cso.uiuc.edu>
I said:
> [Long followup. The summary is that the major speed slowdowns in perl5
> over perl4 occur in the use of character classes and in //g ]
but I meant to say:
> over perl4 occur in the use of character classes and not in //g ]
^^^^
//g is actually faster in 5.004 than 4.036 .
Andrew
------------------------------
Date: 16 Aug 1997 07:04:47 GMT
From: dalke@ks.uiuc.edu (Andrew Dalke)
Subject: Re: perl5 regexes slower than perl4?
Message-Id: <5t3jef$129$1@vixen.cso.uiuc.edu>
[Long followup. The summary is that the major speed slowdowns in perl5
over perl4 occur in the use of character classes and in //g ]
>> [my handwaving proof of why this my regex search could be modeled
>> by a DE in linear time]
To which Ilya Zakharevich <ilya@math.ohio-state.edu> responded
> I'm afraid not. This is irrelevant, since Perl does not work this
> way.
Sure, but that wasn't what I was trying to say. I was explaining
that the speed problem I see could not caused by the regex compilation
step, which is what your previous post suggested was the main culprit.
Your earlier statement was:
> You problem is that you recompile your RE each time in the loop, and
> the compilation time *is* going to be slower and slower as new
> optimizations are enabled.
So I described a model based on the expected theoretical performance
and showed that perl fit that model pretty well. I wouldn't expect
any worse than the best from perl anyway. :)
> If you spend so much time on it, a reproducible test case (with $& and
> friends missing - there is a BIG known slowdown related to some bugs
> corrected) is the best thing you can do.
> Two reason for slowdown are known
> b) scalar context //g is horrible now: it copies the string *each
> time*;
I will be spending a lot of time on it. I thought of trying to
find the slowest regex in my set, but that looks like it will take
a while to implement and when I find it it will contain a large number
of terms, so I decided to do some simple testing.
I think I found the culprit - character classes. Here's the
description of the different things I tried. The general code
framework is at the end of this post.
What it does is generate a string of length 300,000 and 1,000
short strings of length between 2 and 6 which will be the regex
strings.
$big_string = 'WNQTXYSCKHTJRARLQSZP...';
@regex = ('WD', 'CAWQFF'. 'GYD', 'DDO', 'DDOM', 'XYBUX', ...); # (1)
I then do a loop like:
foreach $re (@regex) {
if ($big_string =~ /$re/) { # (2)
}
}
I'm using 'time' for these timings, which isn't too precise, so stick
a +/- 1 second after everything.
The time for perl 5.004 on this is about 5.3 sec (3 runs)
The time for perl 4.036 on this is about 4.7 sec (3 runs)
= = = = start of timings related to character classes = = = =
I then replaced the @regex strings with a character class equivalent,
so the line with the comment (1) would look like:
@regex = ('[W][D]', '[C][A][W][Q][F][F]'. '[G][Y][D]', '[D][D][O]', ... );
The time for perl 5.004 on this is about 78 seconds (3 runs)
The time for perl 4.036 on this is about 30 seconds (2 runs)
This is a factor of 2.6 slower, which would easily explain
the performance difference I am seeing since nearly all the
patterns I have in my regex set contain short character
classes. Here are three examples which are pretty typical:
PS00009; .G[RK][RK]
PS00889; [LIVMF]GE.[GAS][LIVM].{5,11}R[STAQ]A.[LIVMA].[STACV]
PS00983; [EQR]C[LIVMFYAH].C.{5,8}C.{3,8}[EDNQSTV]C[^C].{5}C.{12,24}C
Of course, my test examples are single character character classes
so I can replace them with just the bare letter. With multiple
character sets I can replace [ABCD...] with (A|B|C|D|...).
In this case, the regex list at (1) contains strings that are twice
as large. The line would look like:
@regex = ('[WQ][DA]', '[CR][AL][WT][QG][FM][FC]'. '[GI][YL][DZ]', ...);
Times for this are:
perl 5.004 is about 59 seconds (2 runs)
perl 4.036 is about 27 seconds (2 runs)
(No, I cannot explain why these times are faster than the single
character character classes.)
Replacing the [WQ] notation with (W|Q) makes line (1) look like:
@regex = ('(W|Q)(D|A)', '(C|R)(A|L)(W|T)(Q|G)(F|M)(F|C)', ...);
and gives times like:
perl 5.004 is about 410 seconds (! only did 1 run of this)
perl 4.036 is about 384 seconds
So that's a really bad substitution to make, but note that perl4
is still faster than perl5.
= = = end of timings related to character classes = = =
= = = start of timings related to //g = = =
You said that //g takes a speed hit to do a copy every time.
I replaced line (1) to its original form and changed line (2)
from the 'if' m// to:
while ($big_string =~ /$re/g) {
The original timings (copied from above) are:
perl 5.004 is about 5.3 sec (3 runs)
perl 4.036 is about 4.7 sec (3 runs)
With the while (//g) instead these jump to:
perl 5.004 is about 13.3 seconds (3 runs)
perl 4.036 is about 21.3 seconds (3 runs)
So perl5's use of //g was helping balance out the slowness of the
character class evaluation.
= = = = end of timings related to //g = = = =
After my sig is the code I used for the testings. Anyone is
free to use it for benchmarking things of their own.
Andrew Dalke
dalke@ks.uiuc.edu
==============================================================
#!/usr/local/bin/perl5 -w
#!/usr/local/bin/perl -w
# test a set of many small regex patterns against a long string
srand(1234); # some reproducible start
### Make a really big string
$size = 300000;
$big_string = '';
$letters = join('', 'A' .. 'Z');
while ($size--) {
$big_string .= substr($letters, rand(26), 1);
}
##### now generate a bunch of short regular expressions
$num_regex = 1000;
@regex = ();
while ($num_regex --) {
$re = '';
# how many terms will we have? Between 2 and 6
$terms = int(rand(5)) + 2;
# generate some letters
while ($terms--) {
$re .= substr($letters, rand(26), 1) # looks like 'THIS'
# $re .= '[' . substr($letters, rand(26), 1) . ']' # [T][H][I][S]
# $re .= '(' . substr($letters, rand(26), 1) . ')' # (T)(H)(I)(S)
### here are tests with two letters
# $re .= '[' . substr($letters, rand(26), 1) .
# substr($letters, rand(26), 1) . ']'; # [AB]
# $re .= '(' . substr($letters, rand(26), 1) . '|' .
# substr($letters, rand(26), 1) . ')'; # (A|B)
}
# print "$re\n";
push(@regex, $re);
}
# search the string with the list of regexes
$t1 = time;
foreach $re (@regex) {
if ($big_string =~ /$re/) {
# while ($big_string =~ /$re/g) { # test //g with this one instead
}
}
$t2 = time;
$dt = $t2 - $t1;
print "Elapsed time for $] = $dt\n";
------------------------------
Date: 16 Aug 1997 05:32:38 GMT
From: Xu Chu <xuchu@iscs.nus.edu.sg>
Subject: proxy problem in perl
Message-Id: <5t3e1m$fpu@nuscc.nus.sg>
i wanna extract html files from a certain url. thanks to R.L.Schwartz's web Techniques, i can do the job when the url is
an intra one. for example, i am studying in NUS and if I am fetching files from NUS server, then no problem; however, when
i try to fetch files from outside NUS, it fails. The university uses a proxy and everything has to pass thru it... i think
there must be a way in the CPAN LWP module to handle it but i cant find it out:( can anyone show me how to handle this proxy
problem?
thx a lot.
--
wings
------
You cannot learn anything unless you almost know it already.
------------------------------
Date: 16 Aug 1997 04:42:43 GMT
From: "Henry Wolff" <henrywolff@hatsoftnevada.lovelock.nv.us.nospam>
Subject: Question on SSI #exec
Message-Id: <01bca9fe$724bf860$b11de4cf@hatsoftnevada.lovelock.nv.us>
I have a question concerning the use of the <!--#exec cgi="..." -->
I have been trying to set up a perl script where you can send it a value
and it will perform differently based on that value. Like <!--#exec
cgi="cgi/dothis.cgi?value" --> but it gives me an error when it executes.
The script works just fine if I put in the <a href="..."></a> tags and
click on it, so I know it has something to do with the URI parsing but I
have not been able to find any faq's or references to passing variables on
the SSI #exec. I also tried to send it using the PATH_INFO as
"dothis.cgi/value" and got the same error (unable to process...).
Can anyone help please?
Thanks,
Henry Wolff
Star Trek Collectibles Trading Post
Free4All Classifieds, Clipart, Animations, Sounds, Fonts, Pictures and
more...
http://www.hatsoft.com/newtrek/index.html
------------------------------
Date: Sat, 16 Aug 1997 00:59:57 -0400
From: Patrick Aland <galin@sprynet.com>
Subject: Question
Message-Id: <33F533CD.650B8C1C@sprynet.com>
Is there a way to call a perl script from within a html file.... I want
to run the script on every page mainly to have it write information
about who is accessing it. But I don't want to have to write every page
in a script. Any help is appreciated
------------------------------
Date: Fri, 15 Aug 1997 22:42:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Patrick Aland <galin@sprynet.com>
Subject: Re: Question
Message-Id: <Pine.GSO.3.96.970815223515.19145G-100000@julie.teleport.com>
On Sat, 16 Aug 1997, Patrick Aland wrote:
> Subject: Question
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> Is there a way to call a perl script from within a html file....
No. HTML files are just text files (although they have particular text in
them). They never call anything, any more than an e-mail message or a
picture does.
Perhaps you want to have something in your HTML file which will cause a
server or browser to call a perl script when it sees your page. If so, you
should probably check out information about HTML, server-side includes,
CGI programming, servers, and browsers, to see how that might be done. (I
think in your case, server-side includes are the item you want.) If you
can't find the information you need in the docs and FAQs (which you should
be able to do) you could post a question in a newsgroup about the topic
you need, such as comp.infosystems.www.authoring.cgi. Once you have
something calling your script, if you need help with the Perl within it,
after you've read the Perl docs and FAQs, your Perl questions are welcome
here. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 16 Aug 1997 06:02:49 +0200
From: uzs90z@uni-bonn.de (Michael Schuerig)
Subject: Saving array in hash tied to dbm?
Message-Id: <199708160602491502770@rhrz-isdn3-p15.rhrz.uni-bonn.de>
I want to put an array into an element of hash tied to a dbm file.
Unfortunately Perl only puts a reference there. What do I have to do to
get around this?
Michael
--
Michael Schuerig Most people would rather die than think.
mailto:uzs90z@uni-bonn.de In fact, they do.
http://www.uni-bonn.de/~uzs90z/ -Bertrand Russell
------------------------------
Date: 16 Aug 1997 05:36:00 GMT
From: nocturne@iastate.edu ((classified))
Subject: sockets on IRIX?
Message-Id: <5t3e80$qu9$1@news.iastate.edu>
I am trying to write a perl program that uses sockets to query a web
server. The socket code comes almost straight from the camel book. It
works fine on ULTRIX and OSF/1, but on Irix it dies when creating the
socket. Anyone have any insights? the code is below...
Thanks,
Jason L. Kelly
nocturne@iastate.edu
$sockaddr = 'S n a4 x8';
chop($hostname = `hostname`);
($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port) = getservbyname($port,'tcp') unless #port =~ /^\d+S/;;
($name, $aliases, $type, $len, $thisaddr) = gethostbyname($hostname);
($name, $aliases, $type, $len, $remoteaddr) = gethostbyname($host);
$local = pack($sockaddr, 2, 0, $thisaddr);
$remote = pack($sockaddr, 2, $port, $remoteaddr);
socket(SOCK, 2, 1, $proto) || die "Could not create socket.";
--
Jason Kelly | Visit my homepage-http://pobox.com/~kellyj
Iowa State University | GCS/MC d- s+:+ a--- C++>$ UO++ P++ L++++ E
Ames, Iowa | W++ N++ K--? w-- O+++ !M-- V- PS+ PE++ Y+
kellyj@pobox.com | t+ !R tv- b++ DI !D G++ e>+++ h r++>+++ y+
------------------------------
Date: 16 Aug 1997 07:13:11 GMT
From: Dan Harkless <dan_aug97@unitech.com>
Subject: Re: The eternal question: Has anyone gotten DynaLoader to work on AIX 4.1?
Message-Id: <5t3ju7$ek5$1@speedx1.speed.net>
In article <5t0amh$9jk$1@speedx1.speed.net>, I wrote:
>In article <5se25g$8cc$1@speedx1.speed.net>, I wrote:
>>This is kinda frustrating -- has there ever been a solution to the perl
>>installation problem on AIX 4? Maybe a beta version of perl or something?
>
>I'll assume by the deafening silence that no one has succeeded in getting
>perl with dynamic loading to work on AIX 4.x? Pity...
I will follow up my own thread (again ;^> ) to say that I figured out what
the problem was. The default answer for what extension to use for
dynamically-loaded libraries is incorrect for AIX:
| On a few systems, the dynamically loaded modules that perl generates and uses
| will need a different extension then shared libs. The default will probably
| be appropriate.
|
| What is the extension of dynamically loaded modules [so] none
The hints file for AIX should be fixed so that .so isn't the default. I
guess I'll run the perlbug script to report this...
--
Dan Harkless Unitech Research, Inc. <dan_aug97@unitech.com>
NOTE: This is a monthly mail alias used to post to the USENET without
conSPAMinating my real address. If you are replying after August 1997,
your mail may bounce. If so, replace 'aug' with the current month's abbrev.
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 878
*************************************