[15726] in Perl-Users-Digest
Perl-Users Digest, Issue: 3139 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 23 18:10:56 2000
Date: Tue, 23 May 2000 15:10:26 -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: <959119826-v9-i3139@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 May 2000 Volume: 9 Number: 3139
Today's topics:
Re: How to enable SSI ? <rootbeer@redcat.com>
Re: How to enable SSI ? <dwilgaREMOVE@mtholyoke.edu>
Re: How to enable SSI ? <jilles@psaxeme.com>
Re: How to enable SSI ? <fairbairn_97@yahoo.com>
Re: How to enable SSI ? <rob13@rock13.com>
Re: How to enable SSI ? <rootbeer@redcat.com>
Re: How to enable SSI ? <rootbeer@redcat.com>
How to run a perl program as Win32 Service? <ndye@wallace.com>
Re: How to run a perl program as Win32 Service? <makarand_kulkarni@My-Deja.com>
http accept <ppi@searchy.net>
Re: http accept <flavell@mail.cern.ch>
Installing ActiveState perl w/o internet connection <andersen+@rchland.ibm.com>
Re: Installing ActiveState perl w/o internet connection <jeff@vpservices.com>
Installing Modules [was Re: Modules - Newbie question] <Jonathan.L.Ericson@jpl.nasa.gov>
Re: Installing Modules [was Re: Modules - Newbie questi <jeff@vpservices.com>
Re: Installing Modules [was Re: Modules - Newbie questi <rootbeer@redcat.com>
Re: join " ", do {$x++}, do {$x++}, do {$x++}; <lr@hpl.hp.com>
Re: join " ", do {$x++}, do {$x++}, do {$x++}; (Gwyn Judd)
Re: Measuring excecution times in milliseconds <tim.blair.nospam@ntli.net>
Re: Measuring excecution times in milliseconds <sariq@texas.net>
Re: Measuring excecution times in milliseconds <rootbeer@redcat.com>
Re: Measuring excecution times in milliseconds <tim.blair.nospam@ntli.net>
Re: Measuring excecution times in milliseconds <jeff@vpservices.com>
Re: Measuring excecution times in milliseconds (Bart Lateur)
Re: Modules - Newbie question <makarand_kulkarni@My-Deja.com>
Re: my algorythms suck <mjcarman@home.com>
Re: Norton identifies Perl as a worm <aqumsieh@hyperchip.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 May 2000 11:17:46 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to enable SSI ?
Message-Id: <Pine.GSO.4.10.10005231110590.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Jilles F. wrote:
> Newsgroups: comp.lang.perl.misc
> Subject: How to enable SSI ?
Did you post this twice? Don't do that. If you're not sure that your news
software is working, use a 'test' newsgroup.
> I would like to know what are the procedures to enable SSI in order
> for a script to be runned from a .shtml page.
We aren't going to answer this because it depends upon what webserver
you're using, and we don't know that.
But if we knew which webserver, we still aren't going to answer this
because it depends upon how it's configured, and we don't know that.
But if we knew which webserver, and if we knew how it were configured, we
still aren't going to answer this because it's not on-topic for this
newsgroup. :-)
You should probably check with your webmaster, system administrator, or
other local expert.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 18:24:33 GMT
From: Dan Wilga <dwilgaREMOVE@mtholyoke.edu>
Subject: Re: How to enable SSI ?
Message-Id: <dwilgaREMOVE-04DABB.14243423052000@news.mtholyoke.edu>
In article <2EzW4.119890$r37.1545156@news20.bellglobal.com>, "Jilles F."
<jilles@psaxeme.com> wrote:
> Hello,
>
> I would like to know what are the procedures to enable SSI in order for a
> script to be runned from a .shtml page.
>
> All I have to do is to enable SSI execute and SSI include, but how?
That's part of your web server's configuration, and not part of Perl. Try
asking in a newsgroup related to web servers, like
comp.infosystems.www.servers.unix
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: Tue, 23 May 2000 20:48:11 GMT
From: "Jilles F." <jilles@psaxeme.com>
Subject: Re: How to enable SSI ?
Message-Id: <f8CW4.121473$r37.1559185@news20.bellglobal.com>
> Did you post this twice? Don't do that.
This is strange. I posted this twice, it didn't appear the first time on
this NG. And the strange part is that the first post, STILL doesn't show. I
still can't see it. But the second post - this one - appeared. So this makes
me to beleive that Outlook Express doesn't show me all the messages.
> But if we knew which webserver, and if we knew how it were configured, we
> still aren't going to answer this because it's not on-topic for this
> newsgroup. :-)
Thanks anyways. I thaught that because the script that I'm trying to run is
in perl, and this NG deals with perl, this was the appropriate. Anyways,
wich NG is the one that deals with my situation?
------------------------------
Date: Tue, 23 May 2000 19:23:22 +1000
From: "Stuart Low" <fairbairn_97@yahoo.com>
Subject: Re: How to enable SSI ?
Message-Id: <392a67c6@dnews.tpgi.com.au>
you would really need to have access to the srm.conf
If you do have access to this you can uncomment the lines;
AddType text/html .shtml
AddHandler server-parsed .shtml
There are also SSI emulators for Perl at cgi.resourceindex.com if you do not
own your server.
See ya
Stuart
--
----------------------------------------------------------------------------
--------
Programmers don't DIE. They sub Prog { without Return.
----------------------------------------------------------------------------
--------
"Jilles F." <jilles@psaxeme.com> wrote in message
news:2EzW4.119890$r37.1545156@news20.bellglobal.com...
> Hello,
>
> I would like to know what are the procedures to enable SSI in order for a
> script to be runned from a .shtml page.
>
> All I have to do is to enable SSI execute and SSI include, but how?
>
>
------------------------------
Date: Tue, 23 May 2000 17:20:22 -0400
From: Rob <rob13@rock13.com>
Subject: Re: How to enable SSI ?
Message-Id: <392AF616.CC6BDD58@rock13.com>
"Jilles F." wrote:
>
>How to enable SSI?
Read this article:
<http://www.artsackett.com/grey_papers/ssi/rest_of_us.html>
Doesn't have anything to do with Perl.
--
Rob
http://rock13.com/webhelp/
Fight Spam - http://www.cauce.org/
------------------------------
Date: Tue, 23 May 2000 14:32:37 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to enable SSI ?
Message-Id: <Pine.GSO.4.10.10005231431200.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Stuart Low wrote:
> you would really need to have access to the srm.conf
If, of course, the webserver in this case uses src.conf for configuration.
That's not going to be every webserver!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 14:43:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to enable SSI ?
Message-Id: <Pine.GSO.4.10.10005231432480.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Jilles F. wrote:
> This is strange. I posted this twice, it didn't appear the first time
> on this NG. And the strange part is that the first post, STILL doesn't
> show. I still can't see it. But the second post - this one - appeared.
> So this makes me to beleive that Outlook Express doesn't show me all
> the messages.
Many newsreaders will suppress already-read messages; maybe yours thinks
that you've already read your first posting. You may need to ask your
local expert to help you with this.
> I thaught that because the script that I'm trying to run is
> in perl, and this NG deals with perl, this was the appropriate.
You're not the first to make that mistake. It's analogous to asking
questions about airplanes in a newsgroup about Hawaii, because nearly
everyone who goes to Hawaii goes on an airplane. But most people who use
an airplane aren't going to Hawaii! And most people who are experts about
Hawaii aren't experts about airplanes.
> wich NG is the one that deals with my situation?
Maybe you want comp.infosystems.www.authoring.cgi, for CGI (and SSI)
programming discussion. Or maybe you want one of the pages listed on Yahoo
as being about web servers:
http://dir.yahoo.com/Computers_and_Internet/Software/Internet/World_Wide_Web/Servers/Usenet/
For more help in finding newsgroups, there should be some good advice in
news.announce.newusers. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 22 May 2000 10:13:14 -0500
From: "Nathan Dye" <ndye@wallace.com>
Subject: How to run a perl program as Win32 Service?
Message-Id: <39294eb3@netcomm.wallace.com>
Want to install a Service (daemon?) on WinNT 4.0 (SP3 or SP5). We've
installed ActiveState Perl 5.22.
Anyone know of a skeleton or example?
TIA,
Nathan
------------------------------
Date: Tue, 23 May 2000 12:28:45 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: How to run a perl program as Win32 Service?
Message-Id: <392ADBED.96BA0467@My-Deja.com>
Nathan Dye wrote:
> Want to install a Service (daemon?) on WinNT 4.0 (SP3 or SP5). We've
> installed ActiveState Perl 5.22.
>
> Anyone know of a skeleton or example?
http://www.activestate.com/ActivePerl/docs/faq/Windows/ActivePerl-Winfaq4.html
--
------------------------------
Date: Tue, 23 May 2000 23:25:31 +0200
From: Penpal International <ppi@searchy.net>
Subject: http accept
Message-Id: <392AF74B.5BDB78F3@searchy.net>
Hi,
Is the $ENV{'http accept'} send by the clients browser or the server?
Thanks,
Frank de Bot
--
Penpal International
http://ppi.searchy.net/
ppi@searchy.net
------------------------------
Date: Tue, 23 May 2000 23:42:06 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: http accept
Message-Id: <Pine.GHP.4.21.0005232340440.27299-100000@hpplus01.cern.ch>
On Tue, 23 May 2000, Penpal International wrote:
> Is the $ENV{'http accept'} send by the clients browser or the server?
Is there a CGI specification at http://hoohoo.ncsa.uiuc.edu/cgi/
and a usenet group comp.infosystems.www.authoring.cgi?
--
Partake of distilled wisdom of Usenet - read the FAQs.
Before you ask.
------------------------------
Date: Tue, 23 May 2000 15:41:30 -0500
From: "Paul R. Andersen" <andersen+@rchland.ibm.com>
Subject: Installing ActiveState perl w/o internet connection
Message-Id: <392AECFA.7A04CB4F@rchland.ibm.com>
I have a PC that does not have an internet connection (but does have a
ZIP drive). The previous release of perl from ActiveState could be
copied to a zip disk (on a system with internet capability) and
transfered to the unconnected system where installation worked like a
charm. It appears I can still do the same with the base but modules
seem to be another matter. PPM really wants the internet connection and
while it is supposed to allow pointing to a local directory, I can't
figure out what to put in that local directory or where to get it from.
Can someone provide some instruction on how I can accomplish this task?
Thanks
--
Paul Andersen
-- I can please only ONE person per day.
-- Today is NOT your day.
-- Tomorrow isn't looking good either.
------------------------------
Date: Tue, 23 May 2000 13:52:54 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Installing ActiveState perl w/o internet connection
Message-Id: <392AEFA6.CE4611BC@vpservices.com>
"Paul R. Andersen" wrote:
>
> I have a PC that does not have an internet connection (but does have a
> ZIP drive). The previous release of perl from ActiveState could be
> copied to a zip disk (on a system with internet capability) and
> transfered to the unconnected system where installation worked like a
> charm. It appears I can still do the same with the base but modules
> seem to be another matter. PPM really wants the internet connection and
> while it is supposed to allow pointing to a local directory, I can't
> figure out what to put in that local directory or where to get it from.
Download module-foo.zip from http://www.activestate.com/packages/zips.
Copy that onto your non-networked machine and unzip it and cd to the
directory where module-foo.ppd is unzipped to, then run ppm locally
there.
--
Jeff
------------------------------
Date: Tue, 23 May 2000 11:38:23 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Installing Modules [was Re: Modules - Newbie question]
Message-Id: <392AD01F.16197533@jpl.nasa.gov>
Simon McGregor wrote:
> Jeff Zucker <jeff@vpservices.com> wrote in message
> news:3929D94B.66FF6513@vpservices.com...
> > Again, bazically, not having root priveledges is not a bar to fooling
> > around with modules. If you can install scripts on those sites, there
> > is probably no reason you can't also install modules there as well.
>
> We "install" our scripts by simply FTP'ing them into the cgi-bin directory.
> Can the same be done with a module, or does installation do critical things
> which can't be reproduced by simply copying a file?
For many modules, just putting the *.pm file in the right place is
enough. Some modules (specifically those that use XSUBs) need to be
compiled on the platform that they are intended to run on. For these
modules, you would need to get access to the system to build the module
(perhaps through telnet). It doesn't really sound as if you are doing
anything so complex, however. Read 'perldoc -q module' for more
information.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Tue, 23 May 2000 12:25:19 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Installing Modules [was Re: Modules - Newbie question]
Message-Id: <392ADB1F.E0F859D7@vpservices.com>
Jon Ericson wrote:
>
> Simon McGregor wrote:
> >
> > We "install" our scripts by simply FTP'ing them into the cgi-bin directory.
> > Can the same be done with a module, or does installation do critical things
> > which can't be reproduced by simply copying a file?
>
> Some modules (specifically those that use XSUBs) need to be
> compiled on the platform that they are intended to run on. For these
> modules, you would need to get access to the system to build the module
> (perhaps through telnet).
Jon is quite correct that those kinds of modules need to be compiled on
the same *platform* as they will eventually run on. This does not mean
that they need to be compiled on the same *computer* that they will
eventually run on. You can build them on a platform identical to the
one you want them installed on, take careful note of where all the
various parts of the moudle are installed (see the .packlist) and then
FTP all those parts to equivalent places on the server. It's much
easier with telnet access, but still doable without it.
Another thing that no one has mentioned so far is that there are many
modules which come standard with Perl (e.g. CGI.pm). For those modules
you can safely count on using them without needing to do *any*
installation as long as the host has a reasonably recent version of
perl.
--
Jeff
------------------------------
Date: Tue, 23 May 2000 13:02:42 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Installing Modules [was Re: Modules - Newbie question]
Message-Id: <Pine.GSO.4.10.10005231258210.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Jeff Zucker wrote:
> Jon is quite correct that those kinds of modules need to be compiled
> on the same *platform* as they will eventually run on. This does not
> mean that they need to be compiled on the same *computer* that they
> will eventually run on. You can build them on a platform identical to
> the one you want them installed on,
In general, but not always. A module may need to learn (at compile time)
something about the particular machine it's running on. For example, it
may need to be configured with some of that machine's networking
information; I think the libnet bundle does this.
http://search.cpan.org/search?dist=libnet
Fortunately for those who wish to install modules in the way you describe,
this is rare.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 13:01:19 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <MPG.1394836d56dc03dc98aabd@nntp.hpl.hp.com>
In article <slrn8ikdou.ead.vek@pharmnl.ohout.pharmapartners.nl> on 23
May 2000 07:45:35 GMT, Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl>
says...
> On Mon, 22 May 2000 23:59:12 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>
> >A firm semantics for Perl would require introducing and elaborating the
> >'sequence point' concept of ANSI/ISO C.
>
> C does have the same problem/feature. What would the following program
> prduce? and would it produce the same on every system?
>
> #include <stdio.h>
> #include <stdlib.h>
> int main ()
> {
> int i = 0;
> printf ("%d %d %d %d\n", i++, i++, i++, i++);
> return 0;
> }
The C Standard is very clear about this. This is what I meant by 'firm
semantics'.
The order of evaluation of the function designator, the arguments,
and subexpressions within the arguments is unspecified, but there
is a sequence point before the actual call.
In C, arguments are passed by value, but the arguments may be evaluated
left-to-right, right-to-left, inside-out, or at random. In this example
(modified from that above to be more similar to the quoted Perl code):
int i = 0;
printf ("%d %d %d %d\n", i, i++, i++, i++);
the first value printed might be 0, or 3, or in fact 1 or 2 for
particularly perverse hypothetical compilers. Similarly for the other
values.
The Perl situation is murky, because the problem I pointed out isn't a
consequence of incomplete or unordered evaluation, but of call-by-
reference semantics for lvalue-able arguments. I *believe* that the
elements of a list are evaluated completely, left-to-right, and I have
read and written code that relies on that, but I don't find an explicit
statement of it.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 May 2000 21:37:22 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: join " ", do {$x++}, do {$x++}, do {$x++};
Message-Id: <slrn8ioj0l.9qs.tjla@thislove.dyndns.org>
I was shocked! How could Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
say such a terrible thing:
>tjla@guvfybir.qlaqaf.bet writes:
>>Probably not...In C (and presumably perl) they have
>>this rule that goes something like (paraphrased) "don't chang the value of
>>a variable more than once in an expression" or something (I forget exactly).
<snip>
>The long and short of it seems to be that "sequential execution" is not
>guaranteed by the language in the examples above (and possibly not even
>well-defined without extra machinery). However, neither of the examples
>really pertains to the comma operator, IMO.
>
>The case of Perl is different since the distinction between "argument
>list" to a function and a list is blurry.
True...I realised afterwards I'd been talking about the wrong thing
probably.
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
I can't think about that. It doesn't go with HEDGES in the shape of
LITTLE LULU -- or ROBOTS making BRICKS ...
------------------------------
Date: Tue, 23 May 2000 18:33:28 +0100
From: "Tim Blair" <tim.blair.nospam@ntli.net>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <TQzW4.630$uN.12854@news2-win.server.ntlworld.com>
Tom Briles <sariq@texas.net> wrote in message
news:392AA260.A10F342D@texas.net...
> Tim Blair wrote:
> >
> > Hi there,
> >
> > Is there any nice and easy way to measure how long a section of code
takes
> > in milliseconds?
>
> Please check the FAQ *before* posting.
>
> perldoc -q profile
>
> - Tom
Yes, thank you for your help.
I *did* check the FAQ, looked at various time() functions, the Benchmark
module, and the profiling stuff. However, there's nothing in there that I
can measure times in *milli* seconds (or even micro - just more accurate
than seconds).
What I would like is a function that simply returns the current system time
in milli seconds. Therefore, I can call it twice (once at the beginning of
the code, and once at the end) an work out how long it took to run. I can't
use something like DProf, because I need the time for use in the script.
Can anyone help?
Tim.
------------------------------
Date: Tue, 23 May 2000 13:29:04 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <392ACDF0.95A76664@texas.net>
Tim Blair wrote:
>
> What I would like is a function that simply returns the current system time
> in milli seconds.
Please check the FAQ *before* posting.
perldoc -q second
- Tom
------------------------------
Date: Tue, 23 May 2000 11:30:58 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <Pine.GSO.4.10.10005231128400.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Tim Blair wrote:
> I *did* check the FAQ, looked at various time() functions, the Benchmark
> module, and the profiling stuff. However, there's nothing in there that I
> can measure times in *milli* seconds (or even micro - just more accurate
> than seconds).
perlfaq8 says:
=head2 How can I measure time under a second?
In general, you may not be able to. The Time::HiRes module (available
from CPAN) provides this functionality for some systems.
If your system supports both the syscall() function in Perl as well as
a system call like gettimeofday(2), then you may be able to do
something like this:
...and then it has some example code.
> What I would like is a function that simply returns the current system
> time in milli seconds.
Ah, there's the problem. The FAQ's answer returns time in Milli Vanillis.
:-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 19:35:56 +0100
From: "Tim Blair" <tim.blair.nospam@ntli.net>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <taAW4.692$uN.13668@news2-win.server.ntlworld.com>
OK, apologise are required here.
I look at the FAQ again and found a nice little section entitled 'How can I
measure time under a second?'.
Sorry for getting a bit moody...
Tim.
Tim Blair <tim.blair.nospam@ntli.net> wrote in message
news:TQzW4.630$uN.12854@news2-win.server.ntlworld.com...
> Tom Briles <sariq@texas.net> wrote in message
> news:392AA260.A10F342D@texas.net...
> > Tim Blair wrote:
> > >
> > > Hi there,
> > >
> > > Is there any nice and easy way to measure how long a section of code
> takes
> > > in milliseconds?
> >
> > Please check the FAQ *before* posting.
> >
> > perldoc -q profile
> >
> > - Tom
>
> Yes, thank you for your help.
>
> I *did* check the FAQ, looked at various time() functions, the Benchmark
> module, and the profiling stuff. However, there's nothing in there that I
> can measure times in *milli* seconds (or even micro - just more accurate
> than seconds).
>
> What I would like is a function that simply returns the current system
time
> in milli seconds. Therefore, I can call it twice (once at the beginning
of
> the code, and once at the end) an work out how long it took to run. I
can't
> use something like DProf, because I need the time for use in the script.
>
> Can anyone help?
>
> Tim.
>
>
>
>
------------------------------
Date: Tue, 23 May 2000 11:36:59 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <392ACFCB.D734F2DF@vpservices.com>
Tom Phoenix wrote:
>
> Ah, there's the problem. The FAQ's answer returns time in Milli Vanillis.
Yes, and I heard a rumor that although they do their own Tics, they only
lip-synch the Tocs.
--
Jeff
------------------------------
Date: Tue, 23 May 2000 19:38:00 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Measuring excecution times in milliseconds
Message-Id: <392ad1b2.6141383@news.skynet.be>
Tim Blair wrote:
>Is there any nice and easy way to measure how long a section of code takes
>in milliseconds? I can find plenty of way do get the time in seconds, but
>none in milliseconds.
You might use the Benchmark module, which is part ofthe standard Perl
distribution. In order to get reliable results, it is common to run code
hunderds, or thousands of times in a loop. Benchmark provides ways for
that.
>Even getting the system time in ms would be useful (once at the beginning,
>once at the end, minus to find the difference), but I can't find any way to
>do this...
You don't mention a platform. First of all, you could take a look at the
implementation for Bnchmark.pm. That should give you some thoughts.
Furthermore, there are modules available which allow you to get reliable
time values with millisecond precision. For example, there's the
Time-HiRes module available for Activestate (Win32) perl.
And finally, if on Windows, you can use the GetTickCount() API call
through the Win32::API module. But that only has a resulution of aroundd
55ms...
--
Bart.
------------------------------
Date: Tue, 23 May 2000 12:06:30 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Modules - Newbie question
Message-Id: <392AD6B6.BE4A23E7@My-Deja.com>
> What happens when you install a Perl module?
(1)Read the makefile that does the install.
(2) Check the .packlist files on your installation to see what got installed.
--
------------------------------
Date: Tue, 23 May 2000 13:33:16 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: my algorythms suck
Message-Id: <392ACEEC.D6205723@home.com>
Title: "my algorythms suck"
Well, your title certainly does. :) Your question concerns threading, so
that should be in your subject. (A good subject will help you to get
better responses.) Your post contains no algorithm, either. What have
you tried?
klidge wrote:
>
> so i have an index file for a forum i want to create on the web
>
> [...]
>
> i want an algorythm which using the above data can create this output:
>
> subject 3
> |->subject 3-1
> |->subject 3-1-1
> |->subject 3-1-2
> |->subject 3-2
> |->subject 3-2-1
>
> of course i don't have any problem with the html code.i just can't find
> how can i make perl to do it.i 'm open to ANY suggestions :)
This question came up a few months ago. Oddly, I couldn't find it on
deja, but it turns out I haven't cleaned up old sent messages in a
while, so I still have my response and am including it here.
NOTE: The question I responsed to had slightly different source data,
but as you are after an algorithm, this should get you going in the
right direction. Cheers!
========= Posted to comp.lang.perl.misc on February 15, 2000 ========
Makau Divangamene wrote:
> I have been searching the algorithm that allows to build wwwthreads.
>
> I have the following database :
>
> id | parent_id | name
> ---------------------
> 1 | 0 | msg1
> 2 | 0 | msg3
> 3 | 0 | msg7
> 4 | 0 | msg8
> 5 | 1 | msg2
> 6 | 2 | msg4
> 7 | 6 | msg5
> 8 | 2 | msg6
> [etc...]
>
> That must build the following threads :
>
> . msg1
> . msg2
> . msg3
> . msg4
> . msg5
> . msg6
> . msg7
> . msg8
> [etc...]
>
> ======================
>
> I have tried nearly everything : foreach of foreaches, hash of hashes,
> while loops, etc... but nothing worked! :¨(
I'd wager that you haven't tried a recursive algorithm, and that's what
you need here.
> I spent DAYS looking for the algorithm so if anyone could help by
> either redirecting me to a URL that offers help about this, or,
> better, write down the solution, that'd be great!
I won't tell you how long it took me to do this, but it's not as hard as
you're making it. :)
-------------------------------------------------------
#!/usr/local/bin/perl -w
use strict;
my (%msgs, %children);
while (<DATA>) {
next unless /^\d/; # Skip comment line
my ($id, $pid, $name) = split(/\s+/, $_);
$msgs{$id}{parent} = $pid;
$msgs{$id}{name} = $name;
push(@{$children{$pid}}, $id);
}
foreach (@{$children{0}}) {
Thread($_, 0);
}
sub Thread {
my $id = shift;
my $depth = shift;
print " " x $depth . "* $msgs{$id}{name}\n";
if (exists $children{$id}) {
foreach (@{$children{$id}}) {
Thread($_, $depth + 1);
}
}
}
__DATA__
# ID Parent ID Name
1 0 msg1
2 0 msg3
3 0 msg7
4 0 msg8
5 1 msg2
6 2 msg4
7 6 msg5
8 2 msg6
-------------------------------------------------------
For my sample I put the data in the the script itself and changed the
format a bit to suit me. You can easily change the while() loop to read
your source file and parse the input appropriately. You may also want to
incorporate some type of sorting at each thread level.
Hmm. Looking back, I didn't ever need $msgs{$id}{parent}. It isn't
necessary for the threading, but might be useful if you want to allow
messages to refer to their parents, so I left it in. Also, I could have
used an arrays instead of hashes for %msgs and %children, but since perl
doesn't allow sparse arrays, I suspect a hash is better. (And necessary
if your keys are not purely numeric.)
-mjc
------------------------------
Date: Tue, 23 May 2000 19:09:44 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Norton identifies Perl as a worm
Message-Id: <7abt1xxeva.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
If Perl is a worm, I wonder what Python is?
--Ala, ducking (no pun intended)
------------------------------
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 3139
**************************************