[12674] in Perl-Users-Digest
Perl-Users Digest, Issue: 83 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 8 20:17:50 1999
Date: Thu, 8 Jul 1999 17:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 8 Jul 1999 Volume: 9 Number: 83
Today's topics:
$variable <technology@workmail.com>
$variable <technology@workmail.com>
Re: Assocative Arrays (Abigail)
Re: Assocative Arrays <dms@rtp-bosch.com>
Re: Floating Point Number With Time Function (Larry Rosler)
Re: HTTP Proxy programming (Martien Verbruggen)
Re: I need to hide the source (Todd Tolhurst)
Re: Newbie assoc array question (John Borwick)
Re: Newbie assoc array question (Abigail)
Re: Newbie assoc array question (Alastair)
Re: Newbie: Upgrade from 5.004_04 to 5.005_03 (Anno Siegel)
open+0 <janha@nntp.ifi.uio.no>
Re: Pattern match counting (Larry Rosler)
Re: Self-referencing hash? Ick? <rick.delaney@home.com>
single instance log file <sskinner@cloud9.net>
Timeout Slow Pokes wired2000@my-deja.com
Re: toturial (Alastair)
Re: URL re-direction question channels@my-deja.com
URL <technology@workmail.com>
Yikes, confusion for my newbie self <cayce@thurston.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 08 Jul 1999 15:57:42 -0700
From: Raj <technology@workmail.com>
Subject: $variable
Message-Id: <37852CE6.E4678B23@workmail.com>
--------------0E676ED5A557C4FDBA3F5C2E
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
If i click on a hyperlink on my CGI/Perl page, a flag value should be
written to flatfile.
I used a Hidden form field whose value i'd set in JavaScript function.
then I set this modified form field value to a $variable
and tried to write that $variable to a file.
The problem is the $variable is not getting updated after returned from
JavaScript fn. ? any help please.... TIA,
Raj
--------------0E676ED5A557C4FDBA3F5C2E
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<br>If i click on a <b>hyperlink </b>on my CGI/Perl page, a flag value
should be written to flatfile.
<p>I used a Hidden form field whose value i'd set in JavaScript function.
<br>then I set this modified form field value to a <b>$variable</b>
<br>and tried to write that $variable to a file.
<p>The problem is the $variable is not getting updated after returned from
JavaScript fn. ? any help please.... TIA,
<p>Raj</html>
--------------0E676ED5A557C4FDBA3F5C2E--
------------------------------
Date: Thu, 08 Jul 1999 16:00:24 -0700
From: Raj <technology@workmail.com>
Subject: $variable
Message-Id: <37852D88.56A66012@workmail.com>
Hi,
If i click on a hyperlink on my CGI/Perl page, a flag value should be
written to flatfile.
I used a Hidden form field whose value i'd set in JavaScript function.
then I set this modified form field value to a $variable
and tried to write that $variable to a file.
The problem is the $variable is not getting updated after returned from
JavaScript fn. ? any help please.... TIA,
Raj
------------------------------
Date: 8 Jul 1999 17:16:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Assocative Arrays
Message-Id: <slrn7oa8ot.vka.abigail@alexandra.delanet.com>
Victor Hannak (hannak@kodak.com) wrote on MMCXXXVII September MCMXCIII in
<URL:news:37851757.A2CD15E9@kodak.com>:
-- Does Perl support triply or quadruply nested associative arrays?
Yes.
-- How would you dereference something like this.
--
-- Eg.
--
-- $Level1_key{$level2_key{$level3_key{$level4_key}}}= value
--
-- What would my print statement look like?
print $Level1_key{$level2_key{$level3_key{$level4_key}}};
But is this really what you want? I think you want:
$hash {$key1} -> {$key2} -> {$key3} -> {$key4} = $value;
print $hash {$key1} -> {$key2} -> {$key3} -> {$key4};
-- Also, when creating a hash, can the value portion be an array of hashes?
No, but it can be an array of references to hashes.
@hash {qw /red blue fish dog/} =
({one => 'eins'}, {}, {guitar => 'paul'}, \%ENV);
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 08 Jul 1999 18:23:46 -0400
From: Doug Seay <dms@rtp-bosch.com>
Subject: Re: Assocative Arrays
Message-Id: <378524F2.14B84016@rtp-bosch.com>
Victor Hannak wrote:
>
> Does Perl support triply or quadruply nested associative arrays?
>
> How would you dereference something like this.
>
> Eg.
>
> $Level1_key{$level2_key{$level3_key{$level4_key}}}= value
Uhm, if you need to ask questions like this, maybe you want to play with
$key{$level1;$level2;$level3;$level4} = $value;
as you'd have to read fewer docs to get it to work correctly.
- doug
------------------------------
Date: Thu, 8 Jul 1999 15:42:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Floating Point Number With Time Function
Message-Id: <MPG.11eec92f5f1e8c7c989c78@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7m2r6t$1pc$1@slrn.eurobell.net> on Thu, 8 Jul 1999 19:40:54
+0100, Troy Knight <troyknight@troyknight.eurobell.co.uk> says...
...
> I seem to be going off the original subject though which was that there
> seems to be no faq question for getting the time more exact than just whole
> seconds, or is it just me?
Perhaps this will help:
perlfaq8: "How can I measure time under a second?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 08 Jul 1999 23:15:32 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: HTTP Proxy programming
Message-Id: <oiah3.66$J84.3837@nsw.nnrp.telstra.net>
In article <3783EC96.85027C9E@mediaone.net>,
"M. Brian Akins" <bakins@mediaone.net> writes:
> My question was indeed perl related. After digging a little deeper,
Your original question was _not_ perl related. It was a question about
routing packets and HTTP headers. Not perl.
A perl question would have been:
I am using the Blah module to do this task, but for some reason it
doesn't work, and this is what it doesn't do and what error message I
am getting. After looking at the documentation, and even the code I
cannot figure out why it is doing that. Here is a code snippet that
demonstrates the problem.
> I used the HTTP::Daemon module, and that enabled me to view the
> complete request from the browser. The only problem I have now is
> that when pulling images over this proxied connection, performance
> is hideous.
See, this actually mentions a perl module.
> Once again, to Martien Verbruggen, my day would not have been
> complete with out your rudeness.
If you think that was rude, you must be very naive.
*plonk*
Martien
--
Martien Verbruggen |
Interactive Media Division | Useful Statistic: 75% of the people
Commercial Dynamics Pty. Ltd. | make up 3/4 of the population.
NSW, Australia |
------------------------------
Date: Thu, 08 Jul 1999 22:35:32 GMT
From: toto@toto.com (Todd Tolhurst)
Subject: Re: I need to hide the source
Message-Id: <378526df.27530182@news-server>
On Wed, 07 Jul 1999 19:31:56 GMT, rdosser@my-deja.com wrote:
>I should have explained more: I'm trying to conceal a decryption
>algorithm for confidential data.
Yeeks. Security by obscurity.
You don't want to do this. Use a proven algorithm which
is difficult to break even when its method is well-known.
--
toto@toto.com
------------------------------
Date: Thu, 8 Jul 1999 21:38:50 GMT
From: John.Borwick@sas.com (John Borwick)
Subject: Re: Newbie assoc array question
Message-Id: <378b1a08.33921506@newshost.unx.sas.com>
On Thu, 08 Jul 1999 16:43:15 -0400, Heather Wiley
<heather.wiley@bentley.com> wrote:
>I am familiar with awk and I know that if you test for the existence of
>an element
>in an associative array incorrectly , you actually create that "element"
>in the array
>How do you test for the existence of a key in an array?
>
>Ex in awk
> Load array
> array[$1]=$2
> Test for existence
> if ( x in array) ....
if(defined FAQ{'existence_test'}) { print "It's In the FAQ!" };
------------------------------
Date: 8 Jul 1999 17:18:08 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Newbie assoc array question
Message-Id: <slrn7oa8s8.vka.abigail@alexandra.delanet.com>
Heather Wiley (heather.wiley@bentley.com) wrote on MMCXXXVII September
MCMXCIII in <URL:news:37850D63.7E4BDB5E@bentley.com>:
\\ I am familiar with awk and I know that if you test for the existence of
\\ an element
\\ in an associative array incorrectly , you actually create that "element"
\\ in the array
\\ How do you test for the existence of a key in an array?
Is this a Perl question? If it is, did you check the manual and the FAQ?
If it isn't, please ask in comp.lang.awk.
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 08 Jul 1999 22:18:54 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Newbie assoc array question
Message-Id: <slrn7oacjn.5n.alastair@calliope.demon.co.uk>
Heather Wiley <heather.wiley@bentley.com> wrote:
>How do you test for the existence of a key in an array?
perldoc -f exists
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: 8 Jul 1999 23:45:53 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbie: Upgrade from 5.004_04 to 5.005_03
Message-Id: <7m3d7h$6md$1@lublin.zrz.tu-berlin.de>
Jamie Kincaid <jamie@thale.nott.ac.uk> wrote in comp.lang.perl.misc:
>
>Hi,
>
>In the INSTALL notes for 5.005 it says about recompiling extensions:
>
>If you have dynamically loaded extensions
>that you built under perl 5.003 or 5.004, you can continue to use them
>with 5.004, but you will need to rebuild and reinstall those extensions
>to use them 5.005.
>
>Can I therefore just tar up and move all the stuff into the new site_perl
>directory ie /usr/local/lib/perl5/site_perl/5.005
Why take the trouble to do that? The standard build will compile
everything that's necessary and put it where it belongs.
>I don't understand what is meant by dynamically loaded extensions.
Those are extensions to the Perl language which can be loaded at
run time, so they don't bloat the perl binary when they're not
needed. Usually this also means that the contents of a library
is only loaded into memory once, even when many processes are
using it.
If you mean which are the dynamically loaded extensions, after
Configure these can be found in config.sh, variable dynamic_ext.
Anno
------------------------------
Date: 09 Jul 1999 00:24:33 +0200
From: Jan Egil Hagen <janha@nntp.ifi.uio.no>
Subject: open+0
Message-Id: <yaa673upyou.fsf@gjallarhorn.ifi.uio.no>
I was reading <URL:http://www.nyx.net/~gthompso/self_perl.txt>, and
came across this wonderfully incomprehensible program:
open+0;print<0>
Does anybody have any idea why it works, and what it is happening?
JEH
------------------------------
Date: Thu, 8 Jul 1999 15:26:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pattern match counting
Message-Id: <MPG.11eec56e17ca4873989c77@nntp.hpl.hp.com>
In article <7m34v0$qna$2@info2.uah.edu> on 8 Jul 1999 21:24:48 GMT, Greg
Bacon <gbacon@itsc.uah.edu> says...
...
> $count = () = split /:/, $_, -1;
>
> puts the count in $count as expected.
Gosh. That's *really* intuitive, isn't it?
I know it's documented:
"If LIMIT is negative, it is treated as if an arbitrarily large LIMIT
had been specified."
But
my $count = 1;
++$count while /:/g;
*must* be clearer. And we know it's faster. So why bother with '() ='
at all?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 08 Jul 1999 22:10:30 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Self-referencing hash? Ick?
Message-Id: <378521A0.E847F32C@home.com>
[posted & mailed]
Tom Christiansen wrote:
>
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc, lglenn <larry@ldis.com> writes:
> :My question is, is this undefined behavior, or is it OK?
>
> It would have been faster to test it than to post.
I think he did test it since he said:
> :%map = ( foo => \%map, bar => 'hi' );
> :
> :...which does work (i.e. $map{foo}->{bar} evaluates to 'hi'
> :- on my machine, anyway).
I believe the question was whether this behaviour is supported or not.
There is mention of it in "Two-Phased Garbage Collection" in perlobj,
among other places so the answer would be "yes".
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Thu, 08 Jul 1999 22:20:57 GMT
From: <sskinner@cloud9.net>
Subject: single instance log file
Message-Id: <931472457.171.24@news.remarQ.com>
Hi!
I'm writing a simple script that writes $ENV{'HTTP_USER_AGENT'} into a
text file. The thing is, I only want to write a unique instance of each
browser. I can't seem to figure out the boolean expression (???) that will
check all the elements of an array ($items) for an occurance (or rather
non-occurance) of $ENV{'HTTP_USER_AGENT'}. I tried using grep and index
and a few other functions. Is there a way I can do this without having to
loop through every line? Here's the script...
#!/usr/local/bin/perl
open (FILEHANDLE, "+>> $myPath"); # read/append mode
flock (FILEHANDLE, 2); # one thread at a time!
seek (FILEHANDLE, 0, 0); # start from the beginning
@items = <FILEHANDLE>; # read the entire file;
if (not ??? ) { # does the file contain an occurance of this
HTTP_USER_AGENT?
print FILEHANDLE "$ENV{'HTTP_USER_AGENT'}\n"; # no? then write
this new occurance
}
close FILEHANDLE; # tidy up
--
------------------------------
Date: Thu, 08 Jul 1999 22:18:42 GMT
From: wired2000@my-deja.com
Subject: Timeout Slow Pokes
Message-Id: <7m383o$oup$1@nnrp1.deja.com>
Hi, I got 3 small but quick questions.
Quick Timeout based question:
If you define a timeout for LWP:UserAgent based scripts, is there a way
to detect when the script timedout and customize the output (to conform
to my templates)? I don't see any way to catch when it timesout, only
how to define the timeout time.
Also, is there a way to timeout (and to define the time to timeout)
something using the LWP:Simple module?
And lastly, is there a way to define using LWP:UserAgent (or any other
LWP family member) to only download X bytes from a given URL (ie: in
case someone feeds my script nasty content like megs of data and it
takes forever to parse)
Thanks everyone!
Charles
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 08 Jul 1999 22:15:59 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: toturial
Message-Id: <slrn7oace8.5n.alastair@calliope.demon.co.uk>
Don Estes <djestes@bellsouth.net> wrote:
>I know this might seem a dumb question, but keep in mind we were all new
>at this once. Is there a web site that has every perl element or a site
>that teaches advanced perl?
This might offer some pointers ;
http://reference.perl.com/query.cgi?tutorials
HTH.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Thu, 08 Jul 1999 23:00:39 GMT
From: channels@my-deja.com
Subject: Re: URL re-direction question
Message-Id: <7m3aih$ptc$1@nnrp1.deja.com>
You can also try a redirection service.
http://www.interswitch.net
In article <slrn7nvel6.5kl.efflandt@efflandt.xnet.com>,
efflandt@xnet.com wrote:
> On Sat, 03 Jul 1999 15:57:49 -0700, R.E. Gladd
> <bgladd@wren-foundation.org> wrote:
> >Can anyone help me?
> >
> >We recently registered a 2nd domain name that we wish to point to our
> >main website IP address. My ISP tech support says they can only do a
> >re-direction to the top-level domain name, whereas the index.html
page
> >and associated files for this 2nd URL are in a sub-directory on our
> >site.
> >
> >What we prefer is to have any http requests made to the new address
to
> >point straight at this subdirectory (instead of having to split up
our
> >default home page with links to the primary site and the new one).
The
> >tech person who emailed me said that a Perl script might be capable
of
> >performing this task. Is this true?
> >
> >Basically just an 'if-else-endif' statement that intercepts,
evaluates,
> >and appropriately routes incoming IP calls?
>
> It would be easier if you got a web host that allowed virtual domains.
> For example my www.de-serv.com/ is really www.ccs-ols.com/de-srv/ and
can
> be accessed by either URL.
>
> In your case you cannot do that if you don't want files for both
domains
> in your top web directory. All files for your second domain will have
> to be in a subdirectory and that subdirectory will show up in the URL.
> You have to use a full url for the redirection or links may not work
> properly. If you can use an index.cgi as a default index in your main
> directory you could use that to redirect to a subdirectory based on
> $ENV{HTTP_HOST}.
>
> if ($ENV{HTTP_HOST} eq 'www.second.domain.com') {
> print "Location: http://$ENV{HTTP_HOST}/subdir/\n\n"
> } else {
> print "Location: home.html\n\n"; 1st domain
> }
>
> --
> David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
> http://www.de-srv.com/ http://cgi-help.virtualave.net/
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 08 Jul 1999 16:37:14 -0700
From: Raj <technology@workmail.com>
Subject: URL
Message-Id: <3785362A.E718994@workmail.com>
--------------C0E36E1425D6EFBFE7938869
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
How can we encode the parameters passed as querystring in the URL.
http://abc.xyz.com/Page2.pl?param1=xxx¶m2=xxx
instead of...
http://abc.xyz.com/Page2.pl?param1=val1¶m2=val2
Any clue please!!!!
Raj
--------------C0E36E1425D6EFBFE7938869
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
How can we encode the parameters passed as querystring in the URL.
<p><A HREF="http://abc.xyz.com/">http://abc.xyz.com/</A><b>Page2.pl?param1=xxx&param2=xxx</b>
<p>instead of...
<p><A HREF="http://abc.xyz.com/">http://abc.xyz.com/</A><b>Page2.pl?param1=val1&param2=val2</b><b></b>
<p><b>Any clue please!!!!</b><b></b>
<p><b>Raj</b>
<br>
<br> </html>
--------------C0E36E1425D6EFBFE7938869--
------------------------------
Date: Thu, 8 Jul 1999 16:17:52 -0700
From: "Cayce Collins" <cayce@thurston.com>
Subject: Yikes, confusion for my newbie self
Message-Id: <7m3bks$adr$1@quark.scn.rain.com>
Here's the code:
if(/^($input_for{'username'})(\s*)First:(\w*)(\s*)Last:(\w*)(\s*)Time:(\S*)(
\s*)Date:(\S*)(\s*)Problem:(\$
$test=1;
$username=$input_for{'username'};
$user=$3." ".$5;
$time=$7;
$thedate=$9;
$theproblem=$11;
}
Here's the line from the txt file:
jdoe First:John Last:Doe Time:8:51am Date:07/08/99 Problem:User Had to
Re-install.
How do I get the "Problem: ..." to display, it will only show up as "User"
on the web page, how do I get the whole sentance?
Cayce
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 83
************************************