[12201] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5801 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 27 09:07:21 1999

Date: Thu, 27 May 99 06:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 27 May 1999     Volume: 8 Number: 5801

Today's topics:
    Re: ...SOLVED, but questions (LONG) (M.J.T. Guy)
    Re: ? collecting data from URL, then save as text-file  (Randal L. Schwartz)
    Re: ActivePerl 516 install fails (Win32) <lsilver@ibm.net>
    Re: ANNOUNCE: perl5.005_57 released! <sb@sdm.de>
    Re: Embedding Perl in C <ole.saether@nospam.eunet.no>
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe (Sitaram Chamarty)
    Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Pe <tchrist@mox.perl.com>
    Re: Help needed! <hannibal59@hotmail.com>
    Re: How to write htaccess? (Bob Trieger)
        HTTP Upload using CGI.pm <nbarney@csd.sdl.usu.edu>
    Re: leeches, compilers, and perl, oh my (all mine?) (Sitaram Chamarty)
        missing dates in ascii files <j.b.bremnes@dnmi.no>
    Re: missing dates in ascii files (Jim Britain)
    Re: Perl, GUI and VAX VMS (Cameron Laird)
    Re: please test my new site.. <jtmilliken@rvjintl.com>
    Re: please test my new site.. <tpainterNOSPAM@mindspring.com>
        RE: Programming Web Graphics with Perl and GNU Software <dsaff@tvisions.com>
    Re: Reading text file (Scott McMahan)
        Strange hash/dbm behaviour.... (Brad Knowles)
    Re: Use of parenthesis : General question (Scott McMahan)
    Re: What's wrong with this hit counter? <felixtse@crosswinds.net>
    Re: What's wrong with this hit counter? (Randal L. Schwartz)
    Re: why doesn't my first program work?? (ok , third or  <matt-news@sergeant.org>
    Re: workarounds for prototypes <garethr@cre.canon.co.uk>
    Re: workarounds for prototypes (Randal L. Schwartz)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 27 May 1999 11:48:07 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: ...SOLVED, but questions (LONG)
Message-Id: <7ijbdn$nrq$1@pegasus.csx.cam.ac.uk>

Tom Christiansen  <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, 
>    danielp@best.com (Daniel Parish) writes:
>:Thanks for the pointer, this document illustrates the pitfalls very
>:clearly and is exactly what I was looking for! Also I can see your
>:point about program logic being easier to follow, but i think I will
>:need a little more experience before it really sinks in.
>
>Did you miss the FAQ entry?
>
>=head2 How can I use a variable as a variable name?

Sadly, there's a good reason why he might have missed it  -  it isn't
in any public release of Perl yet.

It's unfortunate that the recent good work you've done on the documentation
hasn't got into either of the maintenance releases (5.005_03 or 5.004_05).

But at least we'll have the benefit of it when perl5.006 comes out.


Mike Guy


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

Date: 27 May 1999 05:42:02 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: ? collecting data from URL, then save as text-file ?
Message-Id: <m1so8ilm5h.fsf@halfdome.holdit.com>

>>>>> "Paolo" == Paolo  <PrinsPaul@DELETETHIShotmail.com> writes:

Paolo> Thanks Randal, it worked.

Don't thank me, thank Gisle Aas!  he did all the hard work. :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 27 May 1999 06:50:31 -0400
From: Lee Silver <lsilver@ibm.net>
Subject: Re: ActivePerl 516 install fails (Win32)
Message-Id: <374D2377.E1D@ibm.net>

I installed ActivePerl build 516 to update the PRK with SP1 and had no
problem. I did this both on a Workstation and on a Server. 
 
-- 
// Lee Silver
// Information Concepts Inc.

   WE LISTEN.


> I am attempting to install ActivePerl build 516, to update my Perl
> Resource Kit, on a Windows NT workstation. No matter what I do, the
> upgrade always generates a Dr.Watson in _INS0432._MP.exe.
> 
> I have attempted to upgrade a plain PRK install, a PRK with Service
> Pack 1. The only time I was able to get AP 516 to install was in an
> empty directory, but this does not upgrade my PRK.
> 
> Has anyone else encountered this problem? Found a solution?


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

Date: 27 May 1999 11:53:25 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: ANNOUNCE: perl5.005_57 released!
Message-Id: <7ijbnl$6d8$1@solti3.sdm.de>

In article <374bea40@cs.colorado.edu>, Tom Christiansen <tchrist@mox.perl.com> wrote:

>     Incompatible Changes
>       Perl Source Incompatibilities

> 	None known at this time.

What a white lie! :-)

One example: the reference count of self-referential ties is not incremented
anymore since 5.005_03 (it did so with 5.005_02), the same applies to the
5.005_5* series.

My module Data::Locations (5.0) stumbled over it right away...
(It's fixed in version 5.1; the current version is 5.2)

So be careful, folks... :-)

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: Thu, 27 May 1999 12:13:22 +0200
From: "Ole Saether" <ole.saether@nospam.eunet.no>
Subject: Re: Embedding Perl in C
Message-Id: <7ij5uo$6qh$1@nntp.newmedia.no>

I have successfully embedded ActivePerl into a Windows GUI program. Maybe I
can help you if you describe your case more clearly. Have you successfully
compiled and executed the example program in the ActivePerl FAQ (under the
heading "How do I embed the Perl interpreter into my C/C++ program?")?

Best Regards,

Ole Saether


Jason Hagerty <hagerty@fidnet.com> wrote in message
news:374C309D.FBE9D928@fidnet.com...
> Does anyone know how to embed perl into C?  I am using ActiveState 516,
> and DevStudio5 for WinNT(sp5).
>
> I can get it to compile, but when it goes to link I get "unresolved
> external symbol".
>
> Anyone got any ideas?
> Thanks
> Jason




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

Date: Thu, 27 May 1999 10:39:44 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <slrn7ko97k.odc.sitaram@diac.com>

On 24 May 1999 18:44:55 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>[A complimentary Cc of this posting was sent to John Klassa
><klassa@aur.alcatel.com>],
>who wrote in article <7ic2eu$scq$1@aurwww.aur.alcatel.com>:
>>   > understandable: *all* the existing versions of Perl have the result of
>>   > 
>>   >    $a = $b + $c;
>>   > 
>>   > *undefined*!  You need one of my latest jumbo patches to make $a
>>   > depend on *values* of $b and $c (and, of course, active pragmas) only,
>>   > and not on the *history of access* to the values of $b and $c.
>> 
>> Would you mind explaining this a bit further...?
>
>> perl -wle '$a=shift; $b = shift; $d = substr $a,$a if shift;  $c = $a  + $b; print $c' 5555555555 1
>Name "main::d" used only once: possible typo at -e line 1.
>5555555556
>
>> perl -wle '$a=shift; $b = shift; $d = substr $a,$a if shift; $c = $a + $b; print $c' 5555555555 1 1
>Name "main::d" used only once: possible typo at -e line 1.
>substr outside of string at -e line 1.
>1260588260
>
>(differ only by the third ARGV term)

Wow!  I'm still reeling.  Anyway, wouldnt you call that a bug?  or
is this caused by the "same variable holding different types of
values simultaneously" thing...?


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

Date: 27 May 1999 06:52:56 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQ 4.16: Does Perl have a year 2000 problem? Is Perl Y2K compliant?
Message-Id: <374d4028@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, finsol@ts.co.nz writes:
:The fact is that CGI shares the same Y2K
:booby-trap problem as Perl. 

It's clever statements like this one that obliterate any shred of
credibility you pretend to have.  There is no programming language called
"CGI".  You're making this all up, and you look ridiculous.  Have you
ever bothered to read the *real* CGI spec?  You should.  This is even
worse than guessing what localtime() does without reading its spec.
Now you posit a complete language that isn't even there.

Now, go away, kid, and learn something before you embarrass yourself
again.  Lately you can't even open your mouth but to change feet.

--tom
-- 
"My mom's been pretty busy lately.  Why don't you call my dad?"
				- Chelsea Clinton to her School Nurse


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

Date: Thu, 27 May 1999 02:18:21 -0800
From: hannibal josh <hannibal59@hotmail.com>
Subject: Re: Help needed!
Message-Id: <927800302.17648@www2.remarq.com>

I learned one thing today...i have to read more,
learn perl better,because one answer leads to more
questions,now i tried script with
use strict;
use diagnostics;
and it found error allmost every line,
so now i checking it line by line,and trying to understand
problem...but i have a time and i will..so some day maybe
i can help somebody here,in this wonderfull perl-community!
There is great peoples out there,
Thank you!




**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****


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

Date: Thu, 27 May 1999 10:34:05 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How to write htaccess?
Message-Id: <7ij5gm$6k$1@holly.prod.itd.earthlink.net>

[ courtesy cc sent by mail if address not munged ]
     
austin95002887@yahoo.com (Austin Ming) wrote:
>
>How to write htaccess?

first press the h key,
then the t,
then acces,
and finally an s.


Good luck



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

Date: Wed, 26 May 1999 16:59:53 -0600
From: Neal Barney <nbarney@csd.sdl.usu.edu>
Subject: HTTP Upload using CGI.pm
Message-Id: <374C7CE9.1CEEA742@csd.sdl.usu.edu>

	I have written a CGI script in Perl that uses CGI.pm.  So far I am very
pleased with the results.  However, there are still a couple of things
that are lacking.
	When my script is run, an upload file field is created along with a
browse button.  Upon clicking the browse button, the files on the local
machine are displayed.  However, the default browse filter is '*.html'. 
Which leads me to the following questions:

1.  Does CGI.pm have the capability to change the default filter from
'*.html' to '*'?

2.  Is there anyway using CGI.pm (or any other perl module) to create a
file upload progress box, similar to the browser download progress box? 
Or must I use JavaScript to accomplish this?

I have read the perldoc for CGI.pm and haven't really found anything
related to this.

P.S.  I am using version 2.49 of CGI.pm though I believe the docs are
from version 2.36.

Any help would be appreciated.


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

Date: Thu, 27 May 1999 10:39:46 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: leeches, compilers, and perl, oh my (all mine?)
Message-Id: <slrn7koain.odc.sitaram@diac.com>

On 25 May 1999 14:53:49 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:

>Which reminds me: I cannot see what copyright has to with source hoarding.
>You copyright a book, but you don't source hoard it.

The "source" to a book - AFAIK - is some kind of SGML or (La)?TeX
or similar.

Do you mean that this is available for - say - the Camel?  Or the
cookbook?  I dont think so <grin>

I'm only half kidding - the other half I'm trying to understand
what you meant or where I mis-understood...


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

Date: Thu, 27 May 1999 10:27:58 +0000
From: John Bjornar Bremnes <j.b.bremnes@dnmi.no>
Subject: missing dates in ascii files
Message-Id: <374D1E2E.1920AFB4@dnmi.no>

Hi,

I have a lot of ascii files with columns: year month day hour x1 x2 x3
 .... The problem is that some dates might be missing and I would like to
add these to the file. An example:

Original file:
1998 12 31 00  -1  -1  -1
1998 12 31 12  -1  -1  -1
1999 01 02 00  -1  -1  -1
1999 01 02 06  -1  -1  -1

New file:
1998 12 31 00  -1  -1  -1
1998 12 31 06  NA  NA  NA
1998 12 31 12  -1  -1  -1
1999 01 01 00  NA  NA  NA
1999 01 01 06  NA  NA  NA
1999 01 01 12  NA  NA  NA
1999 01 02 00  -1  -1  -1
1999 01 02 06  -1  -1  -1
1999 01 02 12  NA  NA  NA

Any suggestions? Useful modules? 


thanks
John Bjornar Bremnes


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

Date: Thu, 27 May 1999 11:14:35 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: missing dates in ascii files
Message-Id: <374d27dd.93440635@news>

On Thu, 27 May 1999 10:27:58 +0000, John Bjornar Bremnes
<j.b.bremnes@dnmi.no> wrote:

>Hi,
>
>I have a lot of ascii files with columns: year month day hour x1 x2 x3
>.... The problem is that some dates might be missing and I would like to
>add these to the file. An example:
>
>Original file:
>1998 12 31 00  -1  -1  -1
>1998 12 31 12  -1  -1  -1
>1999 01 02 00  -1  -1  -1
>1999 01 02 06  -1  -1  -1
>
>New file:
>1998 12 31 00  -1  -1  -1
>1998 12 31 06  NA  NA  NA
>1998 12 31 12  -1  -1  -1
>1999 01 01 00  NA  NA  NA
>1999 01 01 06  NA  NA  NA
>1999 01 01 12  NA  NA  NA
>1999 01 02 00  -1  -1  -1
>1999 01 02 06  -1  -1  -1
>1999 01 02 12  NA  NA  NA

Distribution    STBEY/Date-Calc-4.2.tar.gz
Distribution    SBECK/DateManip-5.34.tar.gz

DateManip probably goes quite a bit overboard for what you want (with
horrendous overhead, too).
ftp://ftp.digital.com/pub/plan/perl/CPAN//SITES.html

for the sites nearest you..



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

Date: 27 May 1999 06:23:39 -0500
From: claird@Starbase.NeoSoft.COM (Cameron Laird)
Subject: Re: Perl, GUI and VAX VMS
Message-Id: <7ij9vr$8v1$1@Starbase.NeoSoft.COM>

In article <7ifk9n$2tv$1@news.NERO.NET>,
Dan Sugalski  <sugalskd@netserve.ous.edu> wrote:
>msutfin@my-dejanews.com wrote:
>: Can I use PERL for GUI development from Open VMS 3GL programs? I'd like
>: to execute PERL to display GUI's from VAX BASIC,C and send and receive
>: data to and from the GUI forms and the 3GL programs.  Any input to this
>: will be much helpful.
>
>Umm.... Those statements don't make all that much sense when taken
>together. Are you looking to have perl on the Vax do GUI directly? If so,
>you're sort of out of luck, as Tk doesn't (quite) work on VMS yet.
Tk works under OpenVMS <URL:http://
starbase.neosoft.com/~claird/comp.lang.tcl/tcl_vms.html>.
I know of no one who has made TkPerl work under OpenVMS.
			.
		[appropriate
		speculation about
		original poster's
		true intent]
			.
			.
-- 

Cameron Laird           http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com      +1 281 996 8546 FAX


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

Date: Thu, 27 May 1999 08:12:53 -0400
From: Tait Milliken <jtmilliken@rvjintl.com>
To: Dan Foley <djfst34@pitt.edu>
Subject: Re: please test my new site..
Message-Id: <374D36C5.12337A0A@rvjintl.com>

Works just fine except that the link "For all you Nerds out there wondering
how this works click here." is broken.

Dan Foley wrote:

> Made with javascript/html/perl
>
> (that is why i am posting on these 3 newsgroups)
>
> it's a simple survey.. to figure out who says soda and who says pop. can
> everyone please take a few seconds to answer this one question survey and
> also to let me know if u find any bugs along the way.
>
> Currently i am just gathering data.. soon i wish to display the results
> graphically on a map of the us.. (i guess demographically).. if u might be
> able to help out with that. let me know..
>
> to take the survey and test my site go to
>
> www.pitt.edu/~djfst34/surveys/sodapop.html
>
> --
> ------------------------------------------------------------
> - Dan Foley                                         -
> - music, resume, more on me              -
> - www.pitt.edu/~djfst34                      -
> ------------------------------------------------------------



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

Date: Thu, 27 May 1999 08:31:39 -0400
From: "Tim Painter" <tpainterNOSPAM@mindspring.com>
Subject: Re: please test my new site..
Message-Id: <7ijduj$sma$1@nntp3.atl.mindspring.net>

Dan,
     Nice -- I'm curious what the final results will be.  There are only 2
suggestions that I would make --
I was unsure how to submit the answer (Until I read the instructions at the
bottom :)  It might be easier to understand to have a radio button next to
the 3 choices and a single submit button.  (Just my .02)

I could not read all of the results in the pop up window -- the "Other"
category was off the screen and the only way to see it was to view source or
try to highlight it all.  Just thought you would know.

When you get all done,  I'm curious to see what people put in as "Other"
Down here in good ol Georgia, everything here is called a Coke, no matter
what it is.  ("Hey Vern, what kinda Coke you want?")

Good Luck!

Tim P.

Dan Foley <djfst34@pitt.edu> wrote in message
news:7iimor$g8t$1@usenet01.srv.cis.pitt.edu...
> Made with javascript/html/perl
>
> (that is why i am posting on these 3 newsgroups)
>
> it's a simple survey.. to figure out who says soda and who says pop. can
> everyone please take a few seconds to answer this one question survey and
> also to let me know if u find any bugs along the way.
>
> Currently i am just gathering data.. soon i wish to display the results
> graphically on a map of the us.. (i guess demographically).. if u might be
> able to help out with that. let me know..
>
> to take the survey and test my site go to
>
> www.pitt.edu/~djfst34/surveys/sodapop.html
>
>
>
> --
> ------------------------------------------------------------
> - Dan Foley                                         -
> - music, resume, more on me              -
> - www.pitt.edu/~djfst34                      -
> ------------------------------------------------------------
>
>




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

Date: Thu, 27 May 1999 12:30:50 +0100 (Eas)
From: David Saff <dsaff@tvisions.com>
Subject: RE: Programming Web Graphics with Perl and GNU Software
Message-Id: <14157.11498.483000.380395@gargle.gargle.HOWL>

Chris Davies writes:
 > 3. Change the test for a referer (lines 51 et seq) to be this,
 > 
 >         unless ($referer eq '' or $referer =~ /http:\/\/($users)(.*)/) {
 >             exit $error->black_box('You do not have privileges' .
 >                         ' to access this counter.');
 >         }

Forgive me, but what are we accomplishing here?  Admittedly, a referer
can be easily fudged, but why make it easy on the fudger by accepting
a null referer?  I'm just not clear on the goal here.  Thanks,

  David Saff


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

Date: 27 May 1999 12:48:57 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Reading text file
Message-Id: <374d3f39.0@news.new-era.net>

Tim Herzog (therzog@knotech.com) wrote:
> In article <374ca81d@carrera.intergate.ca>, "Robert"
> <ducott@geocities.com> wrote:

> >Iam trying to write code that will read a text file and print it's contents
> >to an html file. I have this code working however, it prints all the text on
> >a single line rather than reading the paragraphs and printing the data on
> >separate line as it's written in the text file. sample code below. Does
> >anyone know how I can tell the code to read the text file and print it's
> >contents in the same format as it's written in the text file.

> Wrap the file in <PRE> tags ...

One gotcha here is that <pre> tags don't stop screwball characters, so
if you have a < in the text file, it will cause problems.  Every HTML
engine I've seen will eat everything from < to the next > it encounters,
and not display the text.  You really need to replace all < an > with
their HTML names.

Scott



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

Date: Thu, 27 May 1999 13:43:23 +0200
From: brad@shub-internet.org (Brad Knowles)
Subject: Strange hash/dbm behaviour....
Message-Id: <brad-2705991343230001@brad.techos.skynet.be>

Folks,

    I've got a little script I've been putting together to try to help me
do some data reduction on syslog entries (as returned by logcheck).  The
program that I've got now finally seems to work fine when using in-memory
hashes (I even managed to bludgeon multi-dimensional hashes to the point
where I can get them sorted the way I want ;-), but it returns radically
different results when I tie the hash to a dbm database.

    Here's the code (mind you, I need to do further clean up before I
consider this to be releasable):

#!/usr/local/bin/perl
#
# syslog-count  Effectively do a `sort | uniq -c | sort -nr` on lines in the
#               format of a syslog file, taking into account the potential
#               pid information that is logged and the first and last times
#               we see this exact line logged.
#
#               Note: This tool is designed to help further reduce the amount
#               of noise you see if you're running something like logcheck.
#               Of course, since this destroys information, you want to keep
#               the original log files around until you've had a chance to
#               take the information reduced by this program and returned by
#               logcheck and ensure that everything is as you expect.
#
#=====================================================================
#
#               Author: Brad Knowles <blk@skynet.be>
#                 Date: Thu May 27 11:57:30 CEST 1999
#
#=====================================================================
#
# Copyright 1999 by Belgacom Skynet SA/NV, all rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
# OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Except as contained in this notice, the name of Belgacom Skynet SA/NV
# shall not be used in advertising or otherwise to promote the sale, use
# or other dealings in this Software without prior written authorization
# from Belgacom Skynet SA/NV.
#
#=====================================================================

require HTTP::Date;
require Getopt::Std;

use HTTP::Date;
use Getopt::Std;

$prog = $0;

$prog =~ s|^.*/||;

$Usage = "Usage: $prog [-dh]\n\nWhere:\n\t-h\tPrint this help\n\t-d\tUse
dbm file for temporary storage instead of in-memory hash\n";

getopts('dh');

if ($opt_h)
{
    print $Usage;
    exit;
}

if ($opt_d)
{
    use DB_File;
    $dbmfile = "/var/tmp/$prog.$$";
    dbmopen(%LogLine, $dbmfile, 0600) || die "Can't open dbm file $dbmfile.";
}

$WeekDays = (Sun,Mon,Tue,Wed,Thu,Fri,Sat);
$Months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec);

while ($Line = <>)
{
    next unless ($Line =~ /^(... .. \d\d:\d\d:\d\d) (\w+
\w+)\[?\d*\]?(.*)\s$/o);
    $LogTime = str2time($1);
    $LogEntry = $2 . $3;
    if ($LogEntry =~ /last message repeated (\d+) times/io)
    {
        $Count = $1;
        if ($OldEntry ne "")
        {
            $LogLine{$OldEntry}{count} += $Count;
            if ((!exists $LogLine{$OldEntry}{begin}) ||
($LogLine{$OldEntry}{begin} > $LogTime))
            {
                $LogLine{$OldEntry}{begin} = $LogTime;
            }
            if ((!exists $LogLine{$OldEntry}{end}) ||
($LogLine{$OldEntry}{end} < $LogTime))
            {
                $LogLine{$OldEntry}{end} = $LogTime;
            }
        }
    }
    else
    {
        $LogLine{$LogEntry}{entry}=$LogEntry;
        $LogLine{$LogEntry}{count}++;
        if ((!exists $LogLine{$LogEntry}{begin}) ||
($LogLine{$LogEntry}{begin} > $LogTime))
        {
            $LogLine{$LogEntry}{begin} = $LogTime;
        }
        if ((!exists $LogLine{$LogEntry}{end}) ||
($LogLine{$LogEntry}{end} < $LogTime))
        {
            $LogLine{$LogEntry}{end} = $LogTime;
        }
        $OldEntry = $LogEntry;
    }
}

foreach $i (sort Complex keys %LogLine)
{
    @Start = localtime($LogLine{$i}{begin});
    @Stop  = localtime($LogLine{$i}{end});
    $Begin = sprintf "%04d/%02d/%02d %02d:%02d:%02d", $Start[5]+1900,
$Start[4]+1, $Start[3], $Start[2], $Start[1], $Start[0];
    $End   = sprintf "%04d/%02d/%02d %02d:%02d:%02d", $Stop[5]+1900,
$Stop[4]+1, $Stop[3], $Stop[2], $Stop[1], $Stop[0];
    write;
}

if ($opt_d)
{
    dbmclose %LogLine;
    unlink $dmbfile;
}

format STDOUT =
@>>>>>  @<<<<<<<<<<<<<<<<<<  @<<<<<<<<<<<<<<<<<<  @*
$LogLine{$i}{count}, $Begin, $End, $LogLine{$i}{entry}
 .

sub Complex
{
    $LogLine{$b}{count} <=> $LogLine{$a}{count}
        ||
    $LogLine{$a}{begin} <=> $LogLine{$b}{begin}
        ||
    $LogLine{$a}{end}   <=> $LogLine{$b}{end}
        ||
    $LogLine{$a}{entry} cmp $LogLine{$b}{entry}
}


    When run on a sample syslog file, I get:

% /usr/local/bin/syslog-count < /var/log/messages | head
    47  1999/05/06 18:22:25  1999/05/26 14:33:12  mercury syslogd 1.3-3:
restart.
    45  1999/05/06 18:22:26  1999/05/18 18:31:12  mercury kernel: klogd
1.3-3, log source = /proc/kmsg started.
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: (scsi0)
<Adaptec AIC-7890/1 Ultra2 SCSI host adapter> found at PCI 11/0
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: (scsi0)
Downloading sequencer code... 407 instructions downloaded
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: (scsi0)
Wide Channel, SCSI ID=7, 32/255 SCBs
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: FDC 0 is
a National Semiconductor PC87306
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: Floppy
drive(s): fd0 is 1.44M
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: No
module symbols loaded.

    But, when I pass it the "-d" argument to tie to a dbm file, I get:

% /usr/local/bin/syslog-count -d < /var/log/messages | head
    80  1999/05/06 18:22:27  1999/05/18 18:31:14  mercury sendmail:
starting daemon (8.9.0): queueing@00:15:00
    80  1999/05/06 18:22:27  1999/05/18 18:31:14  mercury sendmail:
starting daemon (8.9.0): queueing@00:15:00
    61  1999/05/12 11:05:50  1999/05/18 18:31:12  mercury kernel:  
Primary interface chip i82555 PHY #1.
    61  1999/05/12 11:05:50  1999/05/18 18:31:12  mercury kernel:  
Primary interface chip i82555 PHY #1.
    47  1999/05/06 18:22:25  1999/05/26 14:33:12  mercury syslogd 1.3-3:
restart.
    45  1999/05/06 18:22:26  1999/05/18 18:31:12  mercury kernel: klogd
1.3-3, log source = /proc/kmsg started.
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: (scsi0)
<Adaptec AIC-7890/1 Ultra2 SCSI host adapter> found at PCI 11/0
    45  1999/05/06 18:22:27  1999/05/18 18:31:12  mercury kernel: (scsi0)
Downloading sequencer code... 407 instructions downloaded


    More importantly, I get some radically different numbers from wc:

% /usr/local/bin/syslog-count < /var/log/messages | wc   
    346    5748   63385
% /usr/local/bin/syslog-count -d < /var/log/messages | wc
    346    2498   22758


    Finally, that "unlink" call at the end of the main program doesn't
seem to be seen at all.  The dbm file remains, even though I've already
closed it.


    Any ideas?  If you have any, please respond by e-mail as well as
posting in this newsgroup.  The traffic here is pretty high, and I can't
ensure that I will always be able to keep fully up-to-date here.

    TIAFAHYMBATP!!!



P.S.  I'm sure that this could use some improvement for space, speed,
etc....  Any pointers there would be appreciated, as would any pointers
that could be provided for profiling tools that would help me better
understand these issues for myself.

-- 
Brad Knowles <brad@shub-internet.org> <http://www.shub-internet.org/brad/>
    <http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=0xE38CCEF1>

Are you looking for a news feed from a site in the Freenix Top 130?
If so, contact me via private e-mail for details.


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

Date: 27 May 1999 12:46:44 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Use of parenthesis : General question
Message-Id: <374d3eb4.0@news.new-era.net>

Thierry METOUDI (thierry.metoudi@francemel.com) wrote:
> it's noticeable that Perl let us make up our own programming style, but
> I would like to know if there were specific reasons when it comes to the
> use of parenthesis, they seem so optionnal.

Well, Perl is a language where you can program idiomatically based on
where you're coming from. If you program in both C and Perl, you probably
make everything look like C by fully parening the function calls you
make. If you use Perl exclusively, or come from a relaxed background
like Visual Basic, you probably omit them.

Scott


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

Date: Thu, 27 May 1999 17:11:19 +0800
From: Felix <felixtse@crosswinds.net>
Subject: Re: What's wrong with this hit counter?
Message-Id: <374D0C37.E7394AAD@crosswinds.net>

Then how to improve it?

Matthew Bafford wrote:
> 
> On 26 May 1999 03:52:17 -0700, Randal L. Schwartz <merlyn@stonehenge.com>
> held some poor sysadmin at gun point while typing in the following:
> : Doesn't work when there's more than one user hitting at the same time.
> :
> : Of course, if your page is so boring that you can guarantee that... :)
> 
> Nah, Murphy claims that those two hits of the year will happen at the
> same time.
> 
> Either that, or your gonna go hit your own page to bump the counter just
> as someone else visits it...
> 
> :-)
> 
> --Matthew


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

Date: 27 May 1999 05:38:27 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: What's wrong with this hit counter?
Message-Id: <m11zg2n0vw.fsf@halfdome.holdit.com>

>>>>> "Felix" == Felix  <felixtse@crosswinds.net> writes:

Felix> Then how to improve it?

You improve it by starting with canned solutions.
File::CounterFile from the CPAN, for example.

You also improve it by realizing that you can't be the ONLY ONE OUT
THERE wanting a "hit counter", so this questioned MUST HAVE BEEN ASKED
BEFORE.

And in fact, it has.

www.deja.com can show you.

Please use the existing tools before asking the question for the 52nd
time this year.

Not only that, perhaps this is a CGI question, and belongs MUCH BETTER
in the CGI group... comp.infosystems.www.authoring.cgi.  Of course,
they'll probably flame you for asking as well.

You can also read my WebTechniques columns online, where I cover this
very issue in one of my first rants about how stupid visitor counters
are, and even describe the parody I have on my homepage (the
"non-visitor" counter).  Those are at:

	http://www.stonehenge.com/merlyn/WebTechniques/

<sigh> :)

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 27 May 1999 10:38:48 +0100
From: Matt Sergeant <matt-news@sergeant.org>
Subject: Re: why doesn't my first program work?? (ok , third or something)
Message-Id: <374D12A8.7CAB84EE@sergeant.org>

Tom Christiansen wrote:
> 
> :PS: What's "obvious" about using ".pl" instead of some other suffix to
> :represent a perl library?
> 
>     +---------------------------------------------------------------+
>     |   p l     perl      p l    perl      p l    perl      p l     |
>     |   e i    library    e i   library    e i   library    e i     |
[snip]

Nah - you forgot - it's the last two letters in BCPL... :)

Matt.


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

Date: Thu, 27 May 1999 09:59:47 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: workarounds for prototypes
Message-Id: <sibtf6bzor.fsf@cre.canon.co.uk>

Tom Christiansen <tchrist@mox.perl.com> wrote:
>     a function that takes a Foo object and a Bar object as
>     its two arguments

    use Class::Multimethods;
    multimethod foo => qw(Foo Bar) => sub { ... }

-- 
Gareth Rees


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

Date: 27 May 1999 05:32:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: workarounds for prototypes
Message-Id: <m14skyn15c.fsf@halfdome.holdit.com>

>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:

Tom> Oh good.  Please write me prototypes for the following:

Tom>     a function that expects a single scalar argument, and 
Tom>     raises a compiler error if passed an array instead

That one was actually doable Tom.  You're slipping. :)

    sub marine (\$);

    marine $foo;
    marine @bar;

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

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

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