[11547] in Perl-Users-Digest
Perl-Users Digest, Issue: 5147 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 16 11:07:20 1999
Date: Tue, 16 Mar 99 08:00:20 -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, 16 Mar 1999 Volume: 8 Number: 5147
Today's topics:
Re: any perl4 hackers want to try their hand at this? <newsgroups@kidkaboom.frogspace.net>
Re: any perl4 hackers want to try their hand at this? <newsgroups@kidkaboom.frogspace.net>
Bad arg length for Socket .... joachim_hoernle@hp.com
Doc in HtmlHelp Format (Ralf Schlueter)
Re: Help: Conditional use of packages in Perl (M.J.T. Guy)
Re: IDE for Perl lvirden@cas.org
Re: Incrementing several values in a hash (Sean McAfee)
ip addresses sweep@freestamp.com
localtime, timelocal nouksopha@hotmail.com
Re: Modules, how to build in local directory? <illume@gmx.net>
Re: Modules, how to build in local directory? (Randy Kobes)
Re: Modules, how to build in local directory? (Kjetil Skotheim)
Re: Modules, how to build in local directory? (Sean McAfee)
Re: MSIE Does Not Undestand "IMGSIZE" tatabu@my-dejanews.com
Re: need better way to print external file withen perl (Bart Lateur)
Newby Question <mojo@trianglenet.net>
Re: Pushing current line back onto <FILE> (Kjetil Skotheim)
Real Funny Browser/CGI Behavior tatabu@my-dejanews.com
Re: Sorting Problem (Kjetil Skotheim)
Re: UNIQUE variable... (Bart Lateur)
Re: Web Programming <fty@utk.edu>
Re: Where is Perl 5.004 ? <newsgroups@kidkaboom.frogspace.net>
Re: Where to start with Perl <rick@rpacorp.com>
Why does not this work...? (Kjetil Skotheim)
Re: Why does not this work...? (Andrew Johnson)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 16 Mar 1999 15:14:41 GMT
From: Kid Kaboom <newsgroups@kidkaboom.frogspace.net>
Subject: Re: any perl4 hackers want to try their hand at this?
Message-Id: <36EE74D4.43B9E169@kidkaboom.frogspace.net>
> in article <36ED1E19.2E7E443D@kidkaboom.frogspace.net>,
> Kid Kaboom <kidkaboom@techplus.com> wrote:
> > Hi, I'm a beginning perl (v5.004) programmer and I found this totally
> > awesome access statistic script. You may be familiar with it. Its Matt
> > Kruse's POV Ray access stat one
> > <http://mkruse.netexpress.net/www/scripts/access3/> but it it written
> > for perl 4.036 and my server doesn't have that version of perl, and my
> > sysadmin doesn't want to install perl 4.036. I have also found (I;m a
> > win32 user) that when I downloaded perl 4.036 for dos it can't handle 9
> > meg files, but perl 5 can, so I would like to port (I believe this is
> > teh right word) this script to the latest version of perl.
> >
> > If anyone here is knowledgeable in perl 4.036 and would like to help me,
> > I would be very grateful.
>
> Have you tried running the script under your latest version of Perl? Many
> older Perl scripts will run unchanged under newer version of Perl. If you
> need pointers as to the sorts of things that might cause problems, look at
> perldoc perltrap.
Yep, tried running it under perl 5.005_02 and it has a division by 0 error if
I follow what the other guy posted (which helped I might add, but now i have
this division by 0 error) I also looked at perldoc perltrap but I'm not
really sure what I'm looking for.
>From Theodore
> hth,
>
> Dave...
>
> --
> Dave Cross
> Magnum Solutions Ltd: <http://www.mag-sol.com/>
> London Perl M[ou]ngers: <http://london.pm.org/>
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 16 Mar 1999 15:20:42 GMT
From: Kid Kaboom <newsgroups@kidkaboom.frogspace.net>
Subject: Re: any perl4 hackers want to try their hand at this?
Message-Id: <36EE7652.8B918BD6@kidkaboom.frogspace.net>
Matthew Bafford wrote:
> Mon, 15 Mar 1999 14:51:08 GMT -- Kid Kaboom <kidkaboom@techplus.com>:
> -> Hi, I'm a beginning perl (v5.004) programmer and I found this totally
> -> awesome access statistic script. You may be familiar with it. Its Matt
> -> Kruse's POV Ray access stat one
> -> <http://mkruse.netexpress.net/www/scripts/access3/> but it it written
> -> for perl 4.036 and my server doesn't have that version of perl, and my
> -> sysadmin doesn't want to install perl 4.036. I have also found (I;m a
>
> Congradulations! You have a smart SysAdmin! Perl 4 is full of bugs and
> security holes.
Yep, he rules. I don't want to use Perl 4 anyway, because it seems to be
limited in the files it cna open (like bigger than 250k and it crashes) whereas
Perl v 5 seems to be able to handle bigger files (I can do things with my 10
meg log file)
> -> win32 user) that when I downloaded perl 4.036 for dos it can't handle 9
> -> meg files, but perl 5 can, so I would like to port (I believe this is
> -> teh right word) this script to the latest version of perl.
> -> If anyone here is knowledgeable in perl 4.036 and would like to help me,
> -> I would be very grateful.
>
> For the most part, Perl4 scripts should run in Perl5. I haven't actually
> ran the program, but a 'perl -c' passes if you change line 67 from:
>
> eval("$" . "$day{$hour}++");
>
> to
>
> eval("\$" . "$day{$hour}++");
>
> or even better:
>
> ${$day{$hour}}++;
I tried this, and now i get a division by zero error (I supose thats another
step farther) at line, umm,
Illegal division by zero at pov98.pl line 134.
That is the line that has this:
foreach (0..23) {
$height= ($Sun{$_}/$highest)*50;
if ($height!=0) {
print OUTPUT "object {BOX translate z*60 translate x*5*$_ \n";
print OUTPUT " scale y*$height texture{TEX} }\n";
}
}
but that in turn relates back to where $highest is defined, and ++'ed
$highest=0;
foreach (0..23) {
if ($Sun{$_} > $highest) { $highest=$Sun{$_}; }
if ($Mon{$_} > $highest) { $highest=$Mon{$_}; }
if ($Tue{$_} > $highest) { $highest=$Tue{$_}; }
if ($Wed{$_} > $highest) { $highest=$Wed{$_}; }
if ($Thu{$_} > $highest) { $highest=$Thu{$_}; }
if ($Fri{$_} > $highest) { $highest=$Fri{$_}; }
if ($Sat{$_} > $highest) { $highest=$Sat{$_}; }
}
Now obviously if it were to be run and not have this foreach loop, then I would
have a division by 0, but it does this nice little loop thing, so there should
be some day where there is more than one hit (there has to be with a 9 meg log
file)
I hope someone can make more sense of this than I can, if you want the script
with the few modifiecations I have made, email me.
>From Theodore
> Good Luck!
>
> -> From Theodore
>
> --Matthew
------------------------------
Date: Tue, 16 Mar 1999 15:03:04 GMT
From: joachim_hoernle@hp.com
Subject: Bad arg length for Socket ....
Message-Id: <7clrr0$7g1$1@nnrp1.dejanews.com>
I have written a multiplexing tcp socket server in perl. After 4 to 6
successfull connections the server script aborts with "Bad arg length for
Socket ...". Any ideas or hints are appreciated!!!
JoacHim.
joachim_hoernle@hp.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 16 Mar 1999 15:20:26 GMT
From: schlueter@dialogs.de (Ralf Schlueter)
Subject: Doc in HtmlHelp Format
Message-Id: <36ee77b6.2710476@eunetnews.germany.eu.net>
Hi,
I'm looking for perl documentation in HtmlHelp format.
Does anybody know where I can download it?
------------------------------
Date: 16 Mar 1999 15:42:07 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Help: Conditional use of packages in Perl
Message-Id: <7clu4f$9l4$1@pegasus.csx.cam.ac.uk>
Tad McClellan <tadmc@metronet.com> wrote:
>edward@echarge.com wrote:
>
>: I've got a strange problem that I hope somebody can help me with. I'm trying
>: to find some way to conditionally include particular packages in Perl. I
>: tried something like the following but it didn't work.
>
>: if (condition is true)
>: use package1;
>: else
>: use package2;
>
> Put the whole thing in a BEGIN block.
That won't work. The 'use' will still be done at the time the
conditional is compiled, not when it is obeyed.
> Or, do require/import like perlfunc says in the description for use.
You *have* to do this to ensure the loading is done when the condition
is executed rather than when it is compiled:
BEGIN {
if ($condition) {
require package1;
package1->import; # if needed
} else {
require package2;
package2->import; # if needed
}
}
Mike Guy
------------------------------
Date: 16 Mar 1999 15:31:28 GMT
From: lvirden@cas.org
Subject: Re: IDE for Perl
Message-Id: <7cltgg$dn3$1@srv38s4u.cas.org>
According to Jim Orona III <JimOrona@ElegantSolutionsInc.com>:
:There are a few IDEs for Perl development, but they run on MS Windows
:platforms. They are:
Is anyone building an authoritative list of these? I notice for instance
that CodeMagic wasn't in the list in the previous posting - there's likely
to be others as well. Some kind of comparison giving pros and cons of
each might be a useful reference.
--
<URL: mailto:lvirden@cas.org> Quote: Saving the world before bedtime.
<*> O- <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
------------------------------
Date: Tue, 16 Mar 1999 15:44:28 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Incrementing several values in a hash
Message-Id: <w%uH2.11825$Ge3.46473337@news.itd.umich.edu>
In article <36EE5A86.8BD89F75@datenrevision.de>,
Philip Newton <Philip.Newton@datenrevision.de> wrote:
>I tried to increase several values in a hash using a slice and ++.
>Here's what I was trying to do:
> my %hash = (one => 1, two => 2, three => 3);
> my @keys = qw(one two three);
> #here's the crunch
> @hash{@keys}++;
[doesn't work; snip]
>How can I increment all the values in a slice? Must I do something like
> foreach my $key (@keys) { $hash{$key}++; }
>, or is there a better way?
In versions of Perl before 5.005 you'd have to do that (or something
similar), but now you can say:
$hash{$_}++ foreach @keys;
I'm of the opinion that the "foreach" statement modifier is the best new
feature of 5.005.
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Tue, 16 Mar 1999 15:16:45 GMT
From: sweep@freestamp.com
Subject: ip addresses
Message-Id: <7clskh$8d3$1@nnrp1.dejanews.com>
Hi,
I have written a short Perl script that will update the IP address for my site
when the user goes to a specific web addy - everytime i go online and load
netscape, it automatically updates the IP address.
My question:
Is there a way in Perl to "bounce off" my connection to let a visitor know
whether or not i am still on line and the IP address they see is still active
or not.... For example, they go to the site, and the perl does it's
thing..shows the latest IP address, check to see if I am still active with
that address and posts a note that i am still online?
Help please!
Thanks
Dean
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 16 Mar 1999 15:20:55 GMT
From: nouksopha@hotmail.com
Subject: localtime, timelocal
Message-Id: <7clssb$8ic$1@nnrp1.dejanews.com>
#!/usr/bin/perl -w
#!/usr/local/bin/perl -w
#!/usr/local/perf/bin/perl -w
use Time::Local;
print localtime, "\n";
print $mytime = timelocal(00,01,02,01,03,99,0,0,0), "\n";
print localtime($mytime), "\n";
print $mytime = timelocal(00,01,02,29,02,99,0,0,0), "\n";
print localtime($mytime), "\n";
__END__
this is the result i got. (on AIX 4)
11479162992740
922953660
01213994900
922694460
012292991870
What is wrong with the code above? should the result be the same since there
is no 2/29/99 date? Is this a bug in perl? I coded this in C using C
library mktime() and localtime() and it works just fine.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 16 Mar 1999 15:50:06 +0100
From: Paul Kunysch <illume@gmx.net>
Subject: Re: Modules, how to build in local directory?
Message-Id: <87bthttroh.fsf@illusion.tui-net>
packer@shell.clark.net (Charles Packer) writes:
> I would like to know how to build a module in my own
> directory when it depends on other modules that I also
> have to build locally, rather than install at the root level.
Some time ago I found out that I can "use blib;" in order to use
modules from the "./blib/" directory. This way you don't have to
install a module after compiling it. The problem might be to compile
the second module if it depends on the first one at compile time.
Bye
------------------------------
Date: 16 Mar 1999 15:08:19 GMT
From: randy@theory.uwinnipeg.ca (Randy Kobes)
Subject: Re: Modules, how to build in local directory?
Message-Id: <slrn7estid.pug.randy@theory.uwinnipeg.ca>
On 16 Mar 1999 12:45:12 GMT, Charles Packer <packer@shell.clark.net> wrote:
>I would like to know how to build a module in my own
>directory when it depends on other modules that I also
>have to build locally, rather than install at the root level.
>By executing "perl Makefile.PL PREFIX=mypath" I understand
>that I can create a makefile that will build the module in the
>directory specified by mypath. But I've discovered that if module
>A assumes the existence of module B, it doesn't do any good to
>build module B in mypath first, because when I then build module A
>I still get a warning that module B can't be found.
Hi,
Try setting the PERL5LIB environment variable to include
your personal perl library before building module A.
--
Best regards,
Randy Kobes
Physics Department Phone: (204) 786-9399
University of Winnipeg Fax: (204) 774-4134
Winnipeg, Manitoba R3B 2E9 e-mail: randy@theory.uwinnipeg.ca
Canada http://theory.uwinnipeg.ca/
------------------------------
Date: 16 Mar 1999 15:22:05 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: Modules, how to build in local directory?
Message-Id: <7clsut$enb$2@readme.uio.no>
In article <slrn7eskio.svo.packer@shell.clark.net>, packer@shell.clark.net
says...
>
>I would like to know how to build a module in my own
>directory when it depends on other modules that I also
>have to build locally, rather than install at the root level.
>
>By executing "perl Makefile.PL PREFIX=mypath" I understand
>that I can create a makefile that will build the module in the
>directory specified by mypath. But I've discovered that if module
>A assumes the existence of module B, it doesn't do any good to
>build module B in mypath first, because when I then build module A
>I still get a warning that module B can't be found.
Dont know if this helps but....:
Have you tried to set the PERLLIB env-var in unix?
setenv PERLLIB /what/ever/directory/B.pm/is/in:$PERLLIB
>
>
>
>--
>packer@clark.net
>http://www.clark.net/pub/whatnews/whatnews.html
--
KS
------------------------------
Date: Tue, 16 Mar 1999 15:27:59 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: Modules, how to build in local directory?
Message-Id: <3MuH2.11823$Ge3.46465508@news.itd.umich.edu>
In article <slrn7eskio.svo.packer@shell.clark.net>,
Charles Packer <packer@shell.clark.net> wrote:
>I would like to know how to build a module in my own
>directory when it depends on other modules that I also
>have to build locally, rather than install at the root level.
>By executing "perl Makefile.PL PREFIX=mypath" I understand
>that I can create a makefile that will build the module in the
>directory specified by mypath. But I've discovered that if module
>A assumes the existence of module B, it doesn't do any good to
>build module B in mypath first, because when I then build module A
>I still get a warning that module B can't be found.
>Could somebody pull me out?
Look at the perlrun man page; search for "PERL5LIB".
--
Sean McAfee mcafee@umich.edu
print eval eval eval eval eval eval eval eval eval eval eval eval eval eval
q!q@q#q$q%q^q&q*q-q=q+q|q~q:q? Just Another Perl Hacker ?:~|+=-*&^%$#@!
------------------------------
Date: Tue, 16 Mar 1999 15:34:56 GMT
From: tatabu@my-dejanews.com
Subject: Re: MSIE Does Not Undestand "IMGSIZE"
Message-Id: <7cltmv$976$1@nnrp1.dejanews.com>
Sam,
What I meant by this is that the CGI script file executes
perfectly when called from Opera or Netscape. I always get
an error when I execute it from MSIE 4.0. I still have this
problem: The CGI script program creates an HTML file. I want
to WRITE the size of the picture inside the HTML file. How
do I insert this line of code in th CGI script file so that
all three browsers execute the CGI file properly? The line
is
($width,$heights) = imgsize("friend.jpg");
When I insert it outside a JavaScript module I get an error
from all three browsers!
How should I change it?
Thanks!
@@-->>> Soulis
friends@soulis.com
In article <slrn7es3d6.sfl.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Tue, 16 Mar 1999 07:31:40 GMT, Laertis <lerna@terna.com> wrote:
> >Opera and Netscape understand the following instruction:
>
> No they don't...
>
> >
> >($width,$heights) = imgsize("friend.jpg");
> >
> >But MSIE does not. Any ideas why?
>
> Because it is a Perl statement, and none of the browsers you mentioned are
> Perl interpreters as far as I know.
>
> --
> Sam
>
> Fifty years of programming language research, and we end up with C++ ???
> --Richard A. O'Keefe
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 16 Mar 1999 15:11:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: need better way to print external file withen perl file
Message-Id: <36f4731f.12392892@news.skynet.be>
Sami Rosenblad wrote:
>I don't understand the use of eval() here...
It's a trick to enforce interpolation. Actually, it needs double quotes
around it, and internal quotes need to be backslashed.
Something like:
{
local $/;
open(FILE,"usr/path/of/file/nameoffile.txt");
$file = <FILE>;
close FILE;
}
$file =~ s/(["@])/\\$1/g;
print eval '"'.$file.'"';
But actuall, personally, I prefer using a hash of my own, and do the
interpolation in a sub.
sub interpolate {
# typed from memory; untested.
my($string,$hash) = @_
$string =~ s/\$(\w+)/$hash->{$1}/g;
$string;
}
print interpolate($contents, { blah => 'ttt' });
p.s. what if you want to enclose a literal "$"?
Bart.
------------------------------
Date: Tue, 16 Mar 1999 09:49:14 -0500
From: Ramona <mojo@trianglenet.net>
Subject: Newby Question
Message-Id: <36EE6F4A.960646A8@trianglenet.net>
Hello,
I have been trying
to learn perl/cgi
here in the last
month. I have been
attempting to create
and run simple
programs from the
"CGI Developer's
Guide" by Eugene
Eric Kim.
My web host is a NT
server. Here is an
example of the
program that I am
working with.
******************************************************************
#!/cgi-bin/nameage.cgi
#nameage.cgi
require 'cgi-lib.pl'
&ReadParse(*input);
print
"<Content-Type: text/html\r\n\r\n";
print "<html>\n";
print "<head>\n";
print "<title>Name
and Age</title>\n";
print "</head>\n";
print "<body>\n";
print "Hello, " .
$input{'name'} . ".
You are\n";
print $input{'age'}
. " years old.<p>\n";
print "</body> \n";
print "</html>\n";
********************************************************************
After submiting my
name and age from
the form I receive
the following error message:
The specified CGI
application
misbehaved by not
returning a complete
set of HTTP headers.
The headers it did
return are:
Can't exec
/cgi-bin/nameage.cgi
at
D:\inetpub\wwwroot\219067\s8e8hnjl\cgi-bin\nameage.cgi
line 1.
I know that this is
not a difficult
problem, but for
some reason I am
having difficulty
understanding why I
am getting this error.
Any suggestions or
comments would be
greatly appreciated.
Ramona
------------------------------
Date: 16 Mar 1999 15:41:18 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: Pushing current line back onto <FILE>
Message-Id: <7clu2u$enb$3@readme.uio.no>
In article <7cjvtp$lvu@dgs.dgsys.com>, jete@dgs.dgsys.com says...
>
>I need to push the current line back onto the <FILE> file handle
>
>open(FILE, "/tmp/junk") || die "Can't open /tmp/junk";
>
>while <<FILE>) {
>
> if (something) {
> push $_ back onto <FILE>;
> last;
> }
>}
>
>I need to learn to write this down, because I have figured this out 3 or 4
times
>in the last year, but I keep forgetting the solution and waste lots of time
trying
>to work it out. Then when I see how simple the solution is, I get pissed at
myself.
>
>Also I don't want nor need to do the following:
>
> @lines = <FILE>;
>
>Although it is a workaround.
I understand why you do not want to use @lines=<FILE> for big files.
I've used something like this with luck before:
open FILE, 'input' or die;
while( $_ = shift(@redobuf) || <FILE> ){
if (...something...){
push @redobuf, $_;
next;
}
}
>
>-- Norman
--
KS
------------------------------
Date: Tue, 16 Mar 1999 15:25:57 GMT
From: tatabu@my-dejanews.com
Subject: Real Funny Browser/CGI Behavior
Message-Id: <7clt5n$8uh$1@nnrp1.dejanews.com>
I am trying to use the line of code
$sizes=imgsize("friend.jpg");
in a CGI script file. When I call that cgi file with any one of the
three browsers (Netscape, MSIE, Opera), I get an error.
When I use this line of code in a JavaScript module, inside
the CGI script file, Opera and Netscape call the CGI file
without error. I get an error though from MSIE.
Now, here is the funniest thing. The CGI file is used to
create an HTML file. Within the module that writes the
HTML file, I put the following line of code (To be written in
the HTML file):
<IMG SRC=$PICTUREURL/$fields{'friend.jpg'} imgsize("friend.jpg") BORDER=0>
All 3 browsers abide perfectly. What exactly is happening? And how
to I place the first line of code above somewhere in the CGI script
file so that all browsers behave?
Thank you!
@@-->>> Soulis
friends@soulis.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 16 Mar 1999 15:54:21 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Re: Sorting Problem
Message-Id: <7clurd$enb$4@readme.uio.no>
In article <36ED68D0.8D14D81D@xs4all.nl>, debot@xs4all.nl says...
>
>I have an array:
>
>$ar[0] = "14 || Some Text here";
>$ar[1] = "4 || Lalalala";
>$ar[2] = "7 || Hello World";
>
>How can I sort that the array is this:
>
>$ar[0] = "4 || Lalalala";
>$ar[1] = "7 || Hello World";
>$ar[2] = "14 || Some Text here";
>
>I've tried everything, but nothing worked.
>
@ar = sort { getnumber($a) <=> getnumber($b) } @ar;
sub getnumber {
shift=~/([\d\.]+)/;
return $1;
}
Or if @ar is big (several houndreds or thousands) it may run quicker to:
@ar = map {$$_[1]}
sort {$$a_[0]<=>$$b_[0]}
map {[getnumber($_),$_]}
@ar;
...that way the getnumber() dont get called so often. (n times,
vs n*log(n) above, or something like that)
--
KS
------------------------------
Date: Tue, 16 Mar 1999 15:03:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: UNIQUE variable...
Message-Id: <36f26cdf.10802374@news.skynet.be>
Steve Wells wrote:
>Good points Bart, by making sure that the process takes at least
>a second to run it will make sure that time is unique compared to
>the PID.
At least, I hope the system is smart enough not to reuse a PID that is
still in use when it wraps to that point.
>Rather than sleep though would you recommend simply
>using the benchmark routines to manage the time? This way you
>don't 'waste' a second trying to get a unique number.
>From the sleep() docs:
On some older systems, it may sleep up to a full second
less than what you requested, depending on how it counts
seconds. Most modern systems always sleep the full
amount.
It looks like the "old" behaviour would be what is desired here: sleep
until time() has reached the next second value.
But, anyway: why not postpone the sleep() to the very end of what this
script is supposed to do? If this is a CGI script, you could the
standard handles (STDIN, STDOUT, STDERR) to notify the server that the
useful stuff is finished, if necessary. I think I saw this trick first
in Randal's WebTechniques columns. See his website
(http://www.stonehenge.com/merlyn/WebTechniques/) for these; in
particular, columns 23 through 25 seem to be using this trick.
>The cookies part comes in when trying to save state, build counters or
>track users going through the site. Though I don't know who they are
>(nor do I care) I can build statistics such as the fact that most people
>click on a certain link or go to a certain page. It helps with site
>design or so they say...
Ah. Not everybody has cookies enabled.
You can generate a unique ID, and redirect people from the home page to
a new URL with this unique ID appended (using a "Location:" line). Like:
http://www.somewhere.com/contents/cgi-bin/script.cgi/ABCDEFGHIJKL
Everything up to the "script.cgi" is the URL of the script itself. This
script will be called, and "ABCDEFGHIJKL" is the "unique" ID, which will
be available in the script through the $ENV{EXTRA_PATH} environment
variable. Details depend on the server, so experiment.
Keep track of the age of these unique ID's. If you see one that is too
old (could be a bookmark), create a new unique ID , and redirect.
Bart.
------------------------------
Date: Mon, 15 Mar 1999 22:02:39 -0500
From: Jay Flaherty <fty@utk.edu>
Subject: Re: Web Programming
Message-Id: <36EDC9CF.314C00A0@utk.edu>
Travis Leuthauser wrote:
>
> I am trying to write a perl script which will display a dislaimer, have
> the web user agree to the terms of the agreement, then call itself again and
> bring up a simple form for the user to fill out. The reason I would like
> everything in the same script is to force every user to read the disclaimer
> first. If there is a better way, I am certainly open to suggestions. This
> is being written for an Apache web server. Any help would be greatly
> appreciated.
Good idea. You will need to track the user somehow to see if he read the
disclaimer page. Using the environment variable $ENV{'HTTP_REFERER'} can
work but only if you don't have other pages to go to from the form page.
You can use hidden fields but this can easily be gotten around. Your
best bet is to use cookies. Use path information to determine what page
to display. Rewrite the cookie when you access the disclaimer page. Good
luck.
Jay
------------------------------
Date: Tue, 16 Mar 1999 15:25:17 GMT
From: Kid Kaboom <newsgroups@kidkaboom.frogspace.net>
Subject: Re: Where is Perl 5.004 ?
Message-Id: <36EE7715.FBF878EC@kidkaboom.frogspace.net>
I had the same problem yesterday, I went to activestate and got the version
(their version) 509 it's perl 5.005_02 so its more than new enough. it also
includes perlscript (its kinda neet)
>From Theodore
Jens Engelbrecht wrote:
> Hello,
> I'm running Perl (v5.003_07) under win98. My Problem is to use the modul
> LWP::UserAgent. The modul requires version 5.004. I've tried to get the
> latest version of Perl under www.activestate.com but I couldnt find it
> there.
> Where can I get Version 5.004?
>
> Thanks for your answer !
>
> Jens Engelbrecht
------------------------------
Date: Tue, 16 Mar 1999 15:09:14 GMT
From: Rick Poleshuck <rick@rpacorp.com>
Subject: Re: Where to start with Perl
Message-Id: <7cls6h$7st$1@nnrp1.dejanews.com>
For an experienced programmer, learning the philosophy of a new language
should be primary and for that I recommend _Learning Perl_. It is short and
concentrates on how to use Perl without being bogged down in syntax. There is
plenty of reference material online and I would suggest holding off on the
purchase of reference material. If you have the time, _Teach Yourself Perl 5
in 21 Days_ from Sams is an unlikely, but excellent book. I have used this
book to teach Perl in training seminars.
TTFN
In article <36ED1673.29D50D@ccrsDotnrcandOtgc.ca>,
Tom Kralidis <tom.kralidis@ccrsDotnrcandOtgc.ca> wrote:
> Hi,
>
> At the risk of getting smart-alec replies, does anyone have any good
> starting points for someone wanting to learn Perl. I have a good handle
> of UNIX (awk, grep, sed), some C/C++ and have heard nothing but good
> things about Perl. I would like to enhance my data manipulation
> capabilities and productivity among other things.
>
> Thanks in advance,
>
> ..Tom
>
--------------------------------------------------------------------------------------------
> Tom Kralidis Canada Centre for Remote Sensing
> Geo-Spatial Technologist 588 Booth Street , Room 241
> User Systems Development Section Ottawa , Ontario K1A 0Y7
> Data Acquisition Division Tel: (613) 947-1828
> mailto:tom.kralidis@ccrs.nrcan.gc.ca Fax: (613) 947-1408
>
> http://www.ccrs.nrcan.gc.ca
>
--------------------------------------------------------------------------------------------
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 16 Mar 1999 15:04:51 GMT
From: kjetil.skotheim@usit.uio.no (Kjetil Skotheim)
Subject: Why does not this work...?
Message-Id: <7clruj$enb$1@readme.uio.no>
(In danger of asking "RTFM"-questions)
PROBLEM 1 WHY IS THIS NOT POSSIBLE:
my $outside=2;
my $program=<<'END';
my($o)=(#outside);
print "$o\n";
END
$program =~ s/#(\w+)/$$1/gm;
open(F,'>prog.pl'); print F $program; close F;
The =~s is supposed to chage #outside to 2. But instead it is changed
to 70571 or some other strange number which varys every time.
This works however, but isnt as general as I want:
=~s/#outside/$outside/gm;
I've also tried
=~/#(\w+)/${$1}/gm;
=~/#(\w+)/${"$1"}/gm;
=~/#(\w+)/"$$1"/egm;
...with no luck.
PROBLEM 2 WHY CANT I...:
mysub( \%ENV );
sub mysub {
my %hash=%{$_[0]}; #Works!
my %hash=%{shift}; #Does not work! But should it not?
.
.
.
}
My version is "5.004_04 built for PA-RISC1.1" for 1 and 2
and Activestate for problem 1.
--
ks
------------------------------
Date: Tue, 16 Mar 1999 15:18:27 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Why does not this work...?
Message-Id: <7DuH2.1117$uw1.2137@news1.rdc1.on.wave.home.com>
In article <7clruj$enb$1@readme.uio.no>,
Kjetil Skotheim <kjetil.skotheim@usit.uio.no> wrote:
!
! (In danger of asking "RTFM"-questions)
!
! PROBLEM 1 WHY IS THIS NOT POSSIBLE:
!
! my $outside=2;
! my $program=<<'END';
! my($o)=(#outside);
! print "$o\n";
! END
! $program =~ s/#(\w+)/$$1/gm;
! open(F,'>prog.pl'); print F $program; close F;
!
! The =~s is supposed to chage #outside to 2. But instead it is changed
! to 70571 or some other strange number which varys every time.
!
! This works however, but isnt as general as I want:
! =~s/#outside/$outside/gm;
!
! I've also tried
! =~/#(\w+)/${$1}/gm;
! =~/#(\w+)/${"$1"}/gm;
! =~/#(\w+)/"$$1"/egm;
! ...with no luck.
!
try this:
my $outside=2;
my $program=<<'END';
my($o)=(#outside);
print "$o\n";
END
$program =~ s/#(\w+)/'$'.$1/eegm;
print $program;
! PROBLEM 2 WHY CANT I...:
!
!
! mysub( \%ENV );
! sub mysub {
! my %hash=%{$_[0]}; #Works!
! my %hash=%{shift}; #Does not work! But should it not?
ambiguous use of shift: use %{shift()} so perl knows you
mean the shift() function and not a string 'shift'
using -w would have told about this.
regards
andrew
------------------------------
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 5147
**************************************