[13110] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 520 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 14 02:07:17 1999

Date: Fri, 13 Aug 1999 23:05:09 -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           Fri, 13 Aug 1999     Volume: 9 Number: 520

Today's topics:
    Re: CGI.pm persistent data: Security risk? <jeff@vpservices.com>
    Re: HARASSMENT -- Monthly Autoemail <Bill@fuckyou.co.uk>
        iis4 now invokes ASP+PerlScripts *and* runs CGI+Perl (w (Wrtl Brmpft)
    Re: Import text file into body of Mail <purchase9@hotmail.com>
    Re: Japanese Girl Needs Help. <erict@cc.wwu.edu>
    Re: Looking for a solution to the problem localtime and (Iain Chalmers)
    Re: Pedagogical  Exercise w/ Symbol Table (K)
    Re: Perl Programmers' Web Design "Difficulties" <tristar@direct.ca>
    Re: perl script for changing all upper case letters to  <wedeking@msa.attmil.ne.jp>
    Re: Perl/TK issues (Donovan Rebbechi)
    Re: pricing a perl job (Ronald J Kimball)
    Re: printf vs. sprintf: inconsistent? (elephant)
    Re: Problem reading forms with perl genelong@my-deja.com
    Re: Problem reading forms with perl genelong@my-deja.com
    Re: Sesssion ID (Ronald J Kimball)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 14 Aug 1999 03:29:14 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: CGI.pm persistent data: Security risk?
Message-Id: <37B4E1B6.B005BA0A@vpservices.com>

Phil Goetz wrote:
>
> From Perl in a Nutshell:
> "When a CGI.pm script is called multiple times,
> the input fields are given default values from the previous invocation."
>
> Is there a possibility that someone executing my Perl CGI script
> will be given the values preserved from the previous invocation
> of the script by another user?

Not unless both users are using the same web browser on the same
computer and user number two is able to retrieve the form used by user
number one before it is erased from the computer's cache.  The values
are preserved in the form, not in the script.

>
> looking over the security section of the CGI FAQ to answer this,
> and it says:
> 
>   http://bigidiot.abuse-me.com/cgi-bin/perl.exe?-e+'format:%20c'
> 
> Um... what will happen?  There is no explanation of what the problem is.

Let's look at that line a piece at a time:

http://bigidiot.abuse-me.com  ON THE MACHINE BIGIDIOT.ABUSE-ME.COM
/cgi-bin/perl.exe?-e+         USE PERL TO EVAL (RUN) 
`format:%20c`                 THE SYSTEM COMMAND "FORMAT DRIVE C"
 
Get it?  Since perl.exe is in the cgi-bin directory and the web server
has given users permission to execute programs found in the cgi-bin
directory, any user can run perl.  And they can tell perl to do things
like erasing all files or formating the hard drive.  Whose files?  Whose
hard drive?  The files and hard drives that are on the same computer
where perl.exe is located, i.e. the webserver bigidiot.abuse-me.com.  So
any webserver that keeps a copy of the perl executable in the cgi-bin
directory is open to having any user anwhere do almost anything they
want to the files and drives on that webserver just by sending a command
in the url location field of a form or web browser.

-- 
Jeff


------------------------------

Date: Sat, 14 Aug 1999 06:30:09 -0700
From: William Pettrey <Bill@fuckyou.co.uk>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <37B56F61.5D60@fuckyou.co.uk>

Marc Haber wrote:
> 
> William Pettrey <Bill@fuckyou.co.uk> wrote:
> >Ya, I think everyone has received one of these messages from the local
> >asshole Tom Christenson. Just block his address, I did.
> 
> Why are you still participating in the perl groups when you don't read
> what one of the most knowledgeable persons around here?
> 
> Tom _can_ be a pain, but I am willing to tolerate that from one of the
> authors of two of my most used books that almost never go back to
> their shelf place.
> 
> Greetings
> Marc

I'm not participating in the perl group, I didn't pay attention to the
cross posting when I clicked reply


------------------------------

Date: Sat, 14 Aug 1999 05:43:33 +0200
From: Wrtl.Brmpft@t-online.de (Wrtl Brmpft)
Subject: iis4 now invokes ASP+PerlScripts *and* runs CGI+Perl (was: Re: ASP_ActiveState_PerlScript under WinNT_iis3 is being "ignored" !!! ???)
Message-Id: <008d01bee60d$e0a007a0$01010101@oldp133>

Ref: news:microsoft.public.inetserver.asp.general

Hi all, and thanks for everybody's help  :-(

Well, after banging my head for too long,
I'm happy to say that it works.

The solution(s) in short was:
  Already installed:
    * WinNT + SP3 + MSiE5
    * ActivePerl, version 5.005_03 built for MSWin32-x86-object
      Binary build 517 (21:29:03 May 26 1999) provided by
      ActiveState Tool Corp. http://www.ActiveState.com
* Run ServicePack5 Setup
* Install WinNT OptionPack, and add
    * InternetInformationServer4
    * MicrosoftManagementConsole
    * MicrosoftScriptDebugger     ???
    * WindowsNT OptionPack Files
    * WindowsScriptingHost
* Run ServicePack5 Setup
(no guaranty, but worked fine for me)

    BTW - FYI:
         A tested/approved order of installation
        (don't know if he want's to be named, but
         is from the main person who helped me get
         out of my misery)   :-)
    > * Install NT 4.0 with IIS 2.0
    > * Install NT Service Pack 5
    > * Install Microsoft Internet Explorer 5.0
    > * Install NT Service Pack 5
    > * Install Microsoft IIS 4.0 ("Upgrade plus" from Option Pack)
    > * Install NT Service Pack 5
    > * Install Outlook Web Access
    > * Install Office 2000 Server-Extensions
    > * Install NT Service Pack 5
    > * Install MDAC 2.1.2.4202.3
    > * Install NT Service Pack 5

After this CGI/Perl will not work because the following
registry entry was deleted, and the new (unfindable?)
entries are incorrect because "%s" is changed to "%S".

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Script Map]
    ".pl"="F:\\Perl\\bin\\perl.exe %s"
    ".cgi"="F:\\Perl\\bin\\perl.exe %s"

The Management for all scripting-engines is now integrated
into the "Microsoft-Management-Console" (which replaces/
integrates the "Internet-Service-Manager"). Sorry if some
terms aren't quite correct, but I have to translate some/most
of them from the German language ;-(
One now has to setup the "Script Map" under Properties for
every (virtual) directory containing scripts separately.
I found very useful help on how to  this under
http://www.whitecrow.demon.co.uk/steve/perlfaq/runperl.html#scriptmap
The most important thing is to change the "%S" to "%s"
    <YourPath>\perl.exe %s %s
In my case I've only got one "%s", so who knows which is correct(er)?
    <Path>\perl.exe %s %s
    <Path>\perl.exe %s
Strangely "<Path>\perl.exe %s" can no longer be found in the registry,
or where's my misunderstanding?

Being very new to all this, I still feel very uncertain
about the quality of the above, but fact is that it got
ASP/PerlScripts running. Seems one can even mix VBScript,
JScript and PerlScript within the same "*.asp" file!?

Wrtl.Brmpft@t-online.de

=================================================================================
=================================================================================

Peter Torr (MS) <ptorr@microsoft.com> wrote:
| Wrtl Brmpft <wrtl.brmpft@t-online.de> wrote in message
| news:37AD8D77.9492800A@t-online.de...
| > The following ASP-PerlScript behaves as if there was
| > no PerlScript in it when accessed with a Browser via
| > Intranet.
| 
 ..
| * You can't run ASP pages in WSH - it doesn't understand any of the HTML
| inside the file.

Hmm, I'm very uncertain about WSH's role/part in all of this.
 
| * You can't run ASP pages in WSH - it doesn't understand any of the HTML
| inside the file.

What's making "*.asp" PerlScript work now?

|
| Peter

=================================================================================
=================================================================================

Flipper <flipper2000@mindspring.com> wrote:
| First I'm not sure why you would want to use perl in this way. Second I'm
| not sure about any of this as I haven't used perl in this way but I have a
| couple of ideas about the problem. So keep in mind that these are only ideas
| not answers.

Well, I'm not quite sure why I wanted to use PerlScripts for ASP either,
as (while banging my head) it soon became quite apparent that everything
would be much simpler using VBScript. Probably because I know nothing
of VB/VBScript yet, and have very recently started doing CGI/Perl.
Before then my horizon ended with HTML under W95 (not NT or NT-Server).
Somehow I like the idea of being/becoming somewhat able to develop
platform independant CGI-Apps. Endless uncertainties of a newcommer ...

| 1. As I understand it the scripting host is meant for VBScript and
| JavaScript and I have only ever seen examples of these. Your registry
| settings are pointing perl script to the scripting host (this may be ok but
| I don't think so.)

Again, I'm very uncertain about WSH's role/part in all of this.

| 2. I dont see where you have ASP mapped in your registery settings to be
| executed by anything. Thus the .asp error returned. (second to last entry)

Right, that was with iis3 + sp3.
The "iis4 + OptionPack + sp5" installation seem to have solved all of that.
 
| 3. I think that what you are looking for in the way of ASP is the asp.dll
| not the scripting host which is what you have. With the scripting host (and
| no one needs to correct me on the fact that  you map it how you want) the
| default extensions are .vbs and .js
| 
| Hope these might be helpful
| 

Well, step by step, in endless complexity,
I often wonder why: *anything* works, and
I'm not a bus/truck/taxi driver???    ;-)

Wrtl.Brmpft@t-online.de
--







------------------------------

Date: Sat, 14 Aug 1999 01:00:26 -0400
From: "SH" <purchase9@hotmail.com>
Subject: Re: Import text file into body of Mail
Message-Id: <37b4f661@news1.us.ibm.net>


Jon Hollcraft <webmaster@mendonet.com> wrote in message
news:37B4DA37.57BB@mendonet.com...
> I am trying to import a text file into the body of an email.
> I have tried using formail prior to sendmail, but Perl gets
> very upset with the formail syntax.  It works great to cat in
> a text file for mailing under procmail.  There must be a simple
> way to get this done in Perl that I haven't tried yet.
>
> open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";
> print MAIL "From: $ownermail\n";
> print MAIL "To: $in{'address'}\n";
> print MAIL "Subject: You are unsubscribed!\n\n";
> print MAIL "$goodbye\n\n";
before you print $goodbye put the following in your code:
------------------------
open(FILE, "data/goodbye.txt") || die "Cannot Open: $!\n\n";
undef $/;
$goodbye = <FILE>;
close(FILE) || die "Cannot Close: $!\n";
---------------------------
This assigns the contents of the file to goodbye, now when you print
$goodbye out it should work.

>
> This gives me the $goodbye (data/goodbye.txt) file id very
> nicely printed out.  Suggestions?
>
> TIA  Jon




------------------------------

Date: Fri, 13 Aug 1999 21:48:54 -0700
From: Eric Turner <erict@cc.wwu.edu>
Subject: Re: Japanese Girl Needs Help.
Message-Id: <37B4F536.5D32216B@cc.wwu.edu>

QuestionExchange wrote:
>
> As a database you can use all you want:
> Postgres, MySQL, Access, SQL-server ...

Is it really possible to access a SQL-server database from a Linux box
via perl? Can you point me to some info/examples?

Thanks,
Eric Turner

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
You can send something to me securely by encrypting it using PGP.
My public PGP key is available from hkp://keys.pgp.com/erict@cc.wwu.edu
Free PGP software is available from http://bs.mit.edu:8001/pgp-form.html
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


------------------------------

Date: Sat, 14 Aug 1999 15:09:26 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <bigiain-1408991509260001@bigman.mighty.aust.com>

In article <slrn7r8ch4.f3h.abigail@alexandra.delanet.com>,
abigail@delanet.com wrote:

> Tom Christiansen (tchrist@mox.perl.com) wrote on MMCLXXIII September
> MCMXCIII in <URL:news:37b40ba9@cs.colorado.edu>:

<-snip->

> $$ Funny, I always thought we were in the 20th century already,
> $$ and that in a few years, we'd be in the 21st century. :-)
> 
> 
> I know that, and you know that, but the chap asking that question
> wanted 19 or 20 returned. ;-)

return(19||20);

heh heh


------------------------------

Date: Sat, 14 Aug 1999 04:48:15 GMT
From: kcounts1@helios.acomp.usf.edu (K)
Subject: Re: Pedagogical  Exercise w/ Symbol Table
Message-Id: <37b4f5a2.172624625@news-server>

Kevin Counts posted:

>> I've tried out the eample on page 281 of Perl and tried to
>> take it one step further. I wanted to print out the key values
<SNIP>

David Posted:

>
>Now try this piece of kruft, modeled on your own:
>#!/usr/bin/perl -w
>use strict;
>
<SNIP>

>Notice any differences?  

>  It does lexical 
>scoping, and it does *not* put those my()'ed variables up
>in the package's symbol table.

Aha. Yes, that makes sense. 
Thanks David.

Kevin Counts


------------------------------

Date: Sat, 14 Aug 1999 04:06:54 GMT
From: "Shawn Grant" <tristar@direct.ca>
Subject: Re: Perl Programmers' Web Design "Difficulties"
Message-Id: <yX5t3.62915$U42.88837@news1.rdc1.bc.home.com>

My sincere APOLOGIES to all who read my post and especially
to the owners/creators of the web sites I listed. My goal was
to create lively discussion, not offend. Please forgive this
post.

Respectfully,
Shawn Grant




------------------------------

Date: Sat, 14 Aug 1999 14:54:00 +0900
From: "Dan and/or Shelly" <wedeking@msa.attmil.ne.jp>
Subject: Re: perl script for changing all upper case letters to lower case with first word of sentence capitolized
Message-Id: <7p30a0$hma$1@news.misawa.attmil.ne.jp>

I wrote the below script to try to do what the subject of this post says.
Does anyone have any better ideas?  The one below isn't the greatest because
if there is a sentence
that ends in anything other than a period, the script won't work right.
Also it doesn't work if there are more than two sentences on the same line.
But otherwise it does capitolize the first word of a sentence while leaving
the other letters lower cased.

while (<>) {
$words = $_;
$words = lc $words;
($sentence1, $sentence2) = split /[.]\s+ /, $words;
 print ucfirst $sentence1, ". ";
 print ucfirst $sentence2, ". ";
}
Dan and/or Shelly wrote in message
<7p25kl$n36$1@news.misawa.attmil.ne.jp>...
>Does anyone have a perl script that will convert text that is in all
>uppercase to lowercase but still leave the first word of a sentence in
upper
>case?
>
>Dan
>
>




------------------------------

Date: 14 Aug 1999 00:22:16 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: Re: Perl/TK issues
Message-Id: <slrn7r9rnl.ppj.elflord@panix3.panix.com>

On 14 Aug 1999 03:19:05 GMT, lt lindley wrote:
>In comp.lang.perl.misc Donovan Rebbechi <elflord@news.newsguy.com> wrote:

>:>the widget heirarchy, in perl you don't. )
>
>Umm.  You can if you want.

Yeah, you can ( say $top_bf_quit instead of $top.bf.quit , but 
it's uglier, and it doesn't get passed to a sub with $top ) 

>Perhaps you can read more about closures and lexical scoping.

OK, I am familiar with scoping. How do closures help ? I know what 
closures are, but don't really understand how to use them or why 
they're important.

>You may not need to keep track of your widgets the way you
>think you do.  

Good point. Childless widgets don't need to be kept track of.

-- 
Donovan


------------------------------

Date: Sat, 14 Aug 1999 01:25:04 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: pricing a perl job
Message-Id: <1dwi17t.pkjqqfd35houN@p97.tc2.state.ma.tiac.com>

David H. Adler <dha@panix7.panix.com> wrote:

> It seems to me that brian was giving you *more* than you asked for,
> rather than less.  You are, by your own admission, new at this.  The
> amount a seasoned programmer would charge for a service (not to
> mention how it would break down timewise) really doesn't have any
> relation to what it would be "fair" (I believe I'm using your own term
> here..) for you to charge.

I disagree.  The amount a seasoned programmer would charge for a service
would undoubtedly be _more_ than what it would be fair for Max to
charge.  That's a relation right there - one value is greater than the
other.

I do agree that brian's advice was useful, but his attitude got
noticeably more abrasive with each post, and I don't see the harm in
providing actual numbers for comparison, as Max requested.

-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Thu, 12 Aug 1999 10:15:47 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: printf vs. sprintf: inconsistent?
Message-Id: <MPG.121cbd3ad0d55c5b989c11@news-server>

Michael B. Klein writes ..
>I've discovered what I'll call an "understandable but inconsistent" behavior
>in Perl, involving the printf and sprintf functions.  Take the following
>code:
>
>--snip--
>@array = ("%2.2f", 1);
>
>printf @array;
>print "\n";
>print sprintf @array;
>print "\n";
>print sprintf $array[0], @array[1..$#array];
>print "\n";
>--snip--

this does appear to be an inconsistency .. I'll be interested to hear 
what any gurus have to say about this

I did notice that in the printf documentation it explicitly says that 
"The first argument of the list will be interpreted as the printf() 
format." (perldoc -f printf) .. whereas there's no such assertion in the 
sprintf documentation

-- 
 jason - elephant@squirrelgroup.com -


------------------------------

Date: Sat, 14 Aug 1999 04:49:08 GMT
From: genelong@my-deja.com
Subject: Re: Problem reading forms with perl
Message-Id: <7p2sg2$2ah$1@nnrp1.deja.com>

In article <37B21248.89DD8510@connect.org.uk>,
  ijg@connect.org.uk wrote:
> genelong@my-deja.com wrote:
>
> > You misunderstand, Trond - I don't want to manipulate, I want to
retain
> > it.  Right now all text inside of angle brackets gets dropped.  If I
> > enter "Joe <joe@domain.com>" on the form, by the time the text gets
to
> > the program, all I have is "Joe ".  I lose the rest.  That's the
whole
> > problem.
>
> Are you sure?How can you tell?
> Do you just print it to the browser to check it? I am betting you do.
>
> If so I would hot foot it over to comp.infosystems.www.authoring.cgi
quick
> and ask them why you can't see the "<joe@domain.com>" part in the HTML
> page.
>
> If your really brave though you could fly by the seat of your pants
and do
> something radical and check the source with your browser to see just
what is
>
> being "printed".

Hi, Ian - I have done a view source to be sure it was not getting sent
to the page.  I have also written the variable to a file so I can
examine the file and see what is there.  I also tried various search
strings on the variable to assure myself that the angle bracket is not
in there.  I think I covered all my bases, and that it is really not
there.  But I could have missed something.

Gene


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Sat, 14 Aug 1999 05:24:20 GMT
From: genelong@my-deja.com
Subject: Re: Problem reading forms with perl
Message-Id: <7p2uhu$3ep$1@nnrp1.deja.com>

In article <37B21071.8921D919@mail.cor.epa.gov>,
  David Cassell <cassell@mail.cor.epa.gov> wrote:
> genelong@my-deja.com wrote:
> [snip of Abigail's reply]
>
> > Maybe it's clear to you, Abigail, but not to me.  There is a PDK, a
> > PerlDirect, a Perl Development Kit, a Perl Resource Kit, and other
> > things.  I tried PerlEx for Win32, but that turned out to be for a
> > server, not for a workstation.  I will try downloading other things,
> > but I am still shooting in the dark.
>
> Try http://www.activestate.com/ActivePerl/
>
> On the main webpage, it is listed as 'build 518'.

Many thanks, David, I will eagerly devour it, and hopefully be able to
speak your language here better next time.
>
> [more snips]
> > Give me a break, Abigail.  I DON'T HAVE A MANUAL.  I'm trying to get
> > one.  I never heard of the "standard distribution" until a few days
ago
> > on this list.
>
> Okay, that's one area we can fix.  Once you get the file from
> the above URL, click on it, answer a couple simple questions,
> and let it put a shortcut on your Start Menu.  Now you have
> a button on your Start Menu that you can click to get all the
> Perl docs [the FAQ, the ActivePerl FAQ, ...] including what is
> labeled as the Core Perl Docs.  These are the manual.  Read
> the intro first to get an idea of how to proceed through
> them, since they are in alphabetical rather than logical order.
>
> [more snippage]
> > I already use Perl.  I edit it with a text editor and ftp it out to
my
> > web site in the cgi-bin directory, and it runs fine when I access my
> > web page.  I don't need command lines to run perl.
>
> But you could if you wanted to.  Perl is good for a lot of
> things besides web programming.
>
> > I don't know about your windows, but mine *does* consist of icons
and
> > screens.  Where do you enter line commands?  In DOS?
>
> No, Abigail uses linux and other unices.  Abigail has windows
> which are analogous to your Command Prompt window - the DOS box.
> But in unix these windows give one access to a great deal of
> power, due to the proliferation of tool programs.
>
> > Gee, you're in a bad mood today.  Of course I need perl (the
language)
> > or I wouldn't be here.  I'm not sure I need perl (the compiler)
since I
> > have run fine without it up to now.
>
> Abigail is gruff, but fair.  Just let us help you, and don't
> get into _ad_hominem_ comments.. even if they come your way.
> Please.
>
Sorry, I was just getting very frustrated.  I have tried very hard to
learn, and obviously I have floundered a good deal trying to get the
right resources.  I really appreciate the patience of you and others
helping me get started.

> Now then, you're getting into a jargon problem.  Perl
> [the language] runs through an interpreter and compiler of
> a sort to get executed.  There is also a Perl Compiler which
> does something different.  So it is easy to get confused by
> the technical discussions if you don't know just how Perl
> works.
>
> [more snips]
> > > --                        I see forms all the time that let users
> > enter
> > > -- addresses such as "joe <joe@domain.com>".  How do those forms
get
> > the
> > > -- input into some place where it can be manipulated?
> > >
> > > That's a question that has nothing to do with Perl. Unless you
write
> > > a browser in Perl.
> >
> > I don't understand your comment at all.
>
> You're being told in a terse way that this is a browser issue,
> not a Perl issue.  But that doesn't answer your question.  The
> best way to handle form data if you're new to Perl is via the
> CGI.pm module.  It comes with a wealth of examples showing how
> to do a lot of the web tasks you no doubt want to do.

Okay, I'm convinced the cgi.pm module will solve all my problems, and I
am anxious to see it and understand it.  Maybe it will all become clear
then.  I'll stop asking questions until I can master it.

>
> [more snips]
> > Give me a break.  I said I'm a newbie.  I'm a windows programmer,
not a
> > unix guru.  I think I've done damn good building a web site from
> > scratch when all I knew was C++ to start with.  I'm humbly asking
for
> > help, cause it's a big world out there, and I've only started to
> > scratch the surface.  If you don't want to help, Abigale, just
ignore
> > my messages.
>
> I sense a lot of cross-connections due to techspeak.
>
> Well, get build 518, let it install itself, and then you'll be
> able to get a lot of your questions answered without having
> to put up with us as much.  :-)
>
> David

Thanks, David - you all have put up with a lot from me, also.
Hopefully my next post will be more from a place of knowledge.

Gene


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


------------------------------

Date: Sat, 14 Aug 1999 01:25:09 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Sesssion ID
Message-Id: <1dwi2p5.6tcknz1arbpczN@p97.tc2.state.ma.tiac.com>

Benjamin Franz <snowhare@long-lake.nihongo.org> wrote:

> Benchmark: timing 100000 iterations of benjamin2, fl_aggie, original,
>            tomc, uri1, uri2...
>  benjamin2: 10 wallclock secs ( 8.20 usr +  0.00 sys =  8.20 CPU)
>   fl_aggie: 11 wallclock secs (10.45 usr +  0.03 sys = 10.48 CPU)
>   original: 11 wallclock secs ( 9.64 usr +  0.00 sys =  9.64 CPU)
>       tomc: 13 wallclock secs (12.25 usr +  0.00 sys = 12.25 CPU)
>       uri1: 14 wallclock secs (13.48 usr +  0.00 sys = 13.48 CPU)
>       uri2: 14 wallclock secs (12.36 usr +  0.01 sys = 12.37 CPU)
> 
> As you can see, none of (Tom, Aggie and Uri's) proposals are faster than the
> _original_ code. I (of course ;) ) was able to improve on it slightly.

It looks to me like you improved it partly by cheating.  :)  Why is it that
every function except yours takes four lines to get to gmtime(), including
extra variables and a shift, while your function only uses one line, hmm?


Additionally, you have so much junk in each function that the code you
intended to benchmark -- simply padding some numbers -- is swamped by code
that should have been factored out -- declaring variables, calling gmtime,
and creating and indexing constant lists.


And, finally, your function does not do the same thing as the other
functions; the other functions pad four variables, whereas yours just
creates a string.  In this case, the string is all that's needed, but I
believe the other Perlers were operating under the assumption that each of
the four variables must be padded in place, so it's no surprise your
function, operating under a different assumption, is faster.



sub date_cookie {
    my ($self) = shift;

    my ($tick) = @_;

    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,
        $month,$wkday);

    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime($tick);

    [...]


and likewise for fl_aggie, tomc, uri1, and uri2, but:


sub benjamin2 {
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(pop);

    [...]


-- 
 _ / '  _      /       - aka -
( /)//)//)(//)/(   Ronald J Kimball      rjk@linguist.dartmouth.edu
    /                                http://www.tiac.net/users/chipmunk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 520
*************************************


home help back first fref pref prev next nref lref last post