[12237] in Perl-Users-Digest
Perl-Users Digest, Issue: 5837 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 30 21:07:14 1999
Date: Sun, 30 May 99 18: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 Sun, 30 May 1999 Volume: 8 Number: 5837
Today's topics:
Re: $^O and all types? <sugalskd@netserve.ous.edu>
Re: /usr/bin/perl vs /usr/local/bin/perl (Matthew Bafford)
Re: Add Unix User function (David Efflandt)
Re: Anyone know where to get (buy) custom made pearl sc <uri@sysarch.com>
Re: backspace in file output question (Kai Henningsen)
Re: best way to database stuff using Perl? (Kai Henningsen)
Can I execute a string? <ng@thehat.free-online.co.uk>
Re: CSV to DBF Format <jwiest@mb.sympatico.ca>
HTML Tag Parsing Across Line Breaks themuppet@my-deja.com
Re: Im not asking for much <tchrist@mox.perl.com>
ODBC to PostgreSQL/MS-SQL <jwiest@mb.sympatico.ca>
parsing problem (Raul R Ramirez)
Re: PB writing an uploaded file in perl (size changes!) (Kai Henningsen)
Re: perl -w, "uninitialized" variables, and the Perl la (Kai Henningsen)
Problem with IO::Socket lamj@softhome.net
Problems w/ Perl 5.005_03 & tying hashes to dbm databas (Brad Knowles)
Shorter solution ? tvn007@my-deja.com
Text::Query::Advanced - I need a simple example :) (Fabien Penso)
Re: Uploading image files.. (David Efflandt)
Re: Writing a Form Validation Script (David Efflandt)
Re: Y2K infected Perl code <kristina@greatbasin.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 May 1999 23:35:03 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: $^O and all types?
Message-Id: <7ishv7$gcp$1@news.NERO.NET>
David Cassell <cassell@mail.cor.epa.gov> wrote:
: Dan Sugalski wrote:
:>
:> $Richy Rich$ <rich_guy@hotmail.com> wrote:
:> : i'm trying to make my scripts more portable, and also make it easier for
:> : people that use them and set them up. this of course, would involve
:> : knowing what OS they are using. i need to check it to know if (depending
:> : on the OS) i can use flock, do forking, etc. and what will and will not
:> : work with windows that will work with unix, and what will and will not
:> : work with certain versions of certain OS's. is the $^O the only thing i
:> : can check this with?
:> : [more stuff snipped...]
:>
:> The Config module is your friend here. perldoc Config and be enlightened.
: But you'll need to do some additional checking in a few cases.
: Since ActiveState Perl is pre-built, you can't tell from its
: %Config whether you're on NT or not. You'll want to look up
: the Win32::IsWinNT() function.. among others.
Ah, I'd forgotten about that. They really ought to have their installer
generate a proper Config.pm on install. (Of course, you still have the
problem of installing the binary on a network device someplace and running
it ondifferent versions of Win32)
Pity "Except for windows, but that's a degenerate and marginal case
anyway" doesn't cut it anymore. Guess it's time to hassle ActiveState to
get their binary auto-detecting the windows version and switching $^O and
library paths on the fly...
Dan
------------------------------
Date: Sun, 30 May 1999 23:07:03 GMT
From: dragons@dragons.duesouth.net (Matthew Bafford)
Subject: Re: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <slrn7l3f3r.5q3.dragons@dragons.duesouth.net>
On 30 May 1999 18:28:00 +0200, Kai Henningsen <kaih=7Hpl17-Xw-B@khms.westfalen.de>
held some poor sysadmin at gun point while typing in the following:
: What backslashing? You *do* know that sed doesn't insist on using /,
: right?
No, I don't.
Correction.
Yes, I do.
: Kai
--Matthew
------------------------------
Date: 31 May 1999 00:09:56 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Add Unix User function
Message-Id: <slrn7l3kn0.189.efflandt@efflandt.xnet.com>
On Fri, 28 May 1999 19:03:02 -0500, Chilly
<zsoris@IHATESPAM.post.uwstout.edu> wrote:
>
>Here's the scenario:
>At the University I go to, we'll soon be giving all students and faculty web
>accounts automatically upon enrollment/hire. I have pursuaded my boss to
>switch to Unix for the student web server, and one is already being used for
>the primary server. What I need to be able to do is add a user in Unix from
>a Perl or shell script (I know this isn't a forum for shell scripting, but
>since I only know Perl as of now, this would be a good place to start). I
>know I can add a user to the passwd file and have it set the password to
>NULL automatically, but for security purposes, we're going to need to set
>their first password for them (to their ss#). I tried using crypt on their
>number and saving that into the file, but it didn't seem to work. Should
>crypt be working? If not, any ideas on how I can set their password?
What about crypt is not working? You use 2 random alpha-numeric
characters for salt. To test it, crypt the original plain text password
using the crypted password for salt, and that should equal the originally
crypted password.
Of course if the system is using shadow passwords (or PAM?), there may be
something else you need to do before they could loggon.
>A quick Unix question (cause it's somewhat related): To delete a user, can I
>simply delete their entry in the passwd file and rmdir their home directory?
If they have a mail account you should probably also remove their mailbox
(in something like /var/spool/mail)
>--
>Scott Allen Zsori
>------------------------------------------------------
>zsoris@post.uwstout.NOeduSPAM
>Assistant Webmaster
>University of Wisconsin- Stout
>------------------------------------------------------
>SCOTT.A.ZSORI@a1wi.ameritech.NOcomSPAM
>Intern Webmaster and Developer
>Ameritech Reliability Center (Networking)
>------------------------------------------------------
>"Just try explaining the value of statistical summaries to the widow of
>the man who drowned crossing a stream with an average depth of four feet."
>
>
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 30 May 1999 19:49:38 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Anyone know where to get (buy) custom made pearl scripts?
Message-Id: <x7n1ymf78t.fsf@home.sysarch.com>
you can buy new or used pearl scripts on the black market in the hidden
corners of asian cities where they also sell the powdered rhino horns,
bears' feet, and tiger bile. pearl scripts are so rare and valuable
that fortunes and been made and lost over them. they get handed down
from father to son, generation by generation. in fact each major coding
house in hong kong has its private pearl dialect which it uses to write
scripts for in-house use. that way even if the scripts are stolen,
without the source code of the dialect, they are useless for their
competitors. and if you are very lucky and hang out in the right bars in
the wee hours, you might run across the great wall of pearl, and be awed
by its majestic aura. ask the great wall and you might get an answer,
and you might not. but either way you will get something you can put
into qq{} or a .sig.
or if you want Perl scripts, you could just hire a contractor like me
and pay them money.
your choice.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 30 May 1999 22:58:00 +0200
From: kaih=7HpllAB1w-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: backspace in file output question
Message-Id: <7HpllAB1w-B@khms.westfalen.de>
ebohlman@netcom.com (Eric Bohlman) wrote on 19.05.99 in <ebohlmanFByGtF.7rC@netcom.com>:
> Fuzzy Warm Moogles <tgy@chocobo.org> wrote:
> : 1 while s/[^\010]\010//g; # not "\008"
>
> Partially inertia (I had already typed a predecessor of the regex before
> I realized that not only did the loop need to be repeated, but that it
> was necessary to check for duplicate backspaces) and partially because I
> try to avoid octal as much as possible out of a purely personal dislike
> (probably acquired 18 years ago when I was revising some embedded Z80
> code that used octal notation for packed BCD).
Use "\x08" then.
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: 31 May 1999 01:43:00 +0200
From: kaih=7HtllWEXw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: best way to database stuff using Perl?
Message-Id: <7HtllWEXw-B@khms.westfalen.de>
gellyfish@gellyfish.com (Jonathan Stowe) wrote on 20.05.99 in <3743e079@newsread3.dircon.co.uk>:
> Except of course that MySQL *is* free to all intents and purposes :
> check out:
>
> <http://www.tcx.se/Manual_chapter/manual_Licensing_and_Support.html>
Looked at both MySQL and - what's the other one - MSQL? - and walked away
in disgust, because to all intents and purposes, they were *not* free. I
don't remember the details, it's been a while; but essentially, for
anything I could think of that I might want to do, *except* using it in
the privacy of my own home, it was no-go.
There's PostgreSQL, but it's not *quite* SQL yet, and it's rather slow.
Somehow, SQL databases don't seem to attract the same enthusiasm as
operating systems, compilers, or editors.
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: Mon, 31 May 1999 01:41:59 +0100
From: "TheHat" <ng@thehat.free-online.co.uk>
Subject: Can I execute a string?
Message-Id: <YZk43.9916$%x.8257@wards>
I'm just learning PERL and have a question.
I want to store the name of a variable in a string, and then later set that
variable to a value.
Is there a way to do this?
I know in some languages you can put a line of code in a string and then
execute the string. Can you do this in PERL?
TIA
Phil.
------------------------------
Date: Sun, 30 May 1999 20:16:11 -0500
From: "Jon Wiest" <jwiest@mb.sympatico.ca>
Subject: Re: CSV to DBF Format
Message-Id: <8_k43.138$z5.19162@news1.mts.net>
The programming docs for FoxPro have documentation on the header structure.
You'll have to pick a flavour: dBase is slightly different from FoxPro 3+
Jon
Richard Webber wrote in message <7i1bof$dai$1@aspen.sucs.soton.ac.uk>...
>Hello,
>
>I'm trying to create a perl program which will take csv files up to 500MB
in
>size, and convert them to DBF format. I've looked at the DBI:XBase module,
>however, I don't have a database server to connect to, and simply want to
>output the dbf format files.
>
>Does anyone have any perl code which will do this job, or failing that,
does
>anyone know the format for dbf files so that I can write perl code myself?
>
>Any help would be greatly appreciated.
------------------------------
Date: Sun, 30 May 1999 23:00:25 GMT
From: themuppet@my-deja.com
Subject: HTML Tag Parsing Across Line Breaks
Message-Id: <7isfu9$ee8$1@nnrp1.deja.com>
Hello,
I'm trying to grab the text between two specific HTML tags. I can get
it to work for one line, but when I try to read a file where the two
tags are on different lines, my regexp test fails. Here's the code I
have:
#!/usr/bin/perl
while (<>) {
print $_, "\n\n";
($n) = ( $_ =~ /<td bgcolor=#eeeeee>(.*)<\/td>/ );
print "Result: ", $n, "\n\n";
}
How can I get the text if the "<td bgcolor=#eeeeee>" and "</td>" tags
are on different lines in the file?
Thanks in advance!
~themuppet
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 30 May 1999 17:29:44 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Im not asking for much
Message-Id: <3751c9e8@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
Cursed to access Usenet using Mozilla 4.5 [en] (Win98; U), poor Eric
Weiss <eweiss@winchendon.com> writes in comp.lang.perl.misc:
:Perl is a great language, but I would not want to teach it to someone
:who [YOUR BROKEN NEWSREADER MISWRAPPED THIS]
:did not already know another language such as C/C++ or Java. It breaks
:all [YOUR BROKEN NEWSREADER MISWRAPPED THIS]
:the current rules, but it works.
If they don't know any other language, then they're especially fortunate,
because now they won't be bothered by any of these current rules that
Perl breaks. :-)
It seems to me that while some rules were meant to be broken, possibly
others were not. It's not always clear whether you've got the one kind
of rule or the other sort. Which rules in particular were thinking about?
--tom
--
"... to go off earlier than the end of the requested sleep() time, or
premature arousal due to another ..."
- from UNIX V sleep(3V) manpage
------------------------------
Date: Sun, 30 May 1999 20:29:57 -0500
From: "Jon Wiest" <jwiest@mb.sympatico.ca>
Subject: ODBC to PostgreSQL/MS-SQL
Message-Id: <1bl43.139$z5.19248@news1.mts.net>
Hello,
I'm new to modules and databases in Perl, but not in other languages. I'm
taking on a project where I'll eventually need to connect to MS-SQL from
SCO. However, I'm prototyping the app on my home system using Linux and
PostgreSQL. I've seen that Perl has an ODBC module, so I'm hoping I can
simply change the initialization code when I finally migrate platforms, and
use the ODBC module for development and testing. The SQL code itself will
be pretty basic.
The first question is: am I off my rocker? Seems too easy there's probably
a catch.
The second question is: which modules do I need exactly and where do I get
them?
Thanks in advance!
Jon Wiest
jwiest@mb.sympatico.ca
------------------------------
Date: 30 May 1999 17:42:04 -0700
From: raulr@CS.Arizona.EDU (Raul R Ramirez)
Subject: parsing problem
Message-Id: <7islss$t2f@lectura.CS.Arizona.EDU>
If I have a (string) variable $foo that is composed of
multiple "sentences" (i.e multiple substrings terminated by \n),
how can I reliably extract each sentence line????
For example, if $foo has the following assignment :
$foo = "Hi, Sentence1.\n
Sentence2.\n
\n # blank sentence
Sentence3.";
It would be nice if I could transfer each sentence into
a new array, like so :
@mylines = ("Hi, Sentence1.",
"Sentence2.",
"",
"Sentence3.");
I'd appreciate any feedback. Thanks!
--------
raulr@lectura.cs.arizona.edu
------------------------------
Date: 31 May 1999 01:09:00 +0200
From: kaih=7HtllOkHw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: PB writing an uploaded file in perl (size changes!)
Message-Id: <7HtllOkHw-B@khms.westfalen.de>
lr@hpl.hp.com (Larry Rosler) wrote on 28.05.99 in <MPG.11b8a90199eb5ca7989b28@nntp.hpl.hp.com>:
> In article <x7wvxtgcdc.fsf@home.sysarch.com> on 28 May 1999 16:36:47 -
> 0400, Uri Guttman <uri@sysarch.com> says...
> > >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> >
> > LR> But TomC has made it clear that he, at least, will not adopt my
> > LR> suggestion on how to eliminate this question being asked ad nauseam:
> >
> > LR> 'binmode' binary files on every implementation of perl!
> >
> > do you mean have perl do it? or the code call binmode on binary files
> > regardless of the OS?
>
> No. That is impossible. The programmer must do it.
>
> The heuristic for the '-B' test (which we discussed recently) on input
> files is far too unreliable. And what about output files?
>
> > if the latter, then i still have a bone to pick as i am not writing to
> > be platform independent in some cases. so i can skip it if i know the
> > program is destined to always run on unix.
>
> My point is -- why bother to skip it? The documentation and the books
> and the teachers should say that This Is THE Way To Do It. Where it is
> not needed, it costs NOTHING (modulo the time to read and parse one Perl
> statement during compilation). Where it is needed, it is essential.
Because it may not be clear to you if, were you to port your program to a
binmode-challenged system (which you have no intention to do), the file
you're working with would need binmode, because that would depend on
system properties you don't know about?
Or, to put it another way, sometimes the programmer is in the exact same
situation the perl binary is in.
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: 30 May 1999 21:53:00 +0200
From: kaih=7HplkbcXw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: perl -w, "uninitialized" variables, and the Perl language spec
Message-Id: <7HplkbcXw-B@khms.westfalen.de>
rjk@linguist.dartmouth.edu (Ronald J Kimball) wrote on 26.05.99 in <1dsfnai.z1amx7x0tsxsN@p65.tc2.metro.ma.tiac.com>:
> John Siracusa <macintsh@cs.bu.edu> wrote:
>
> > It's my understanding that all newly-created perl variables are
> > guaranteed to to evaluate to be "empty" (i.e. evaluate to "false").
> > Notice I didn't call them "uninitialized" variables, because, IMO,
> > they *are* initialized--with undef or "emptiness" or whatever. A
> > truly uninitialized variable would contain random garbage, as in
> > lower-level languages like C (in most circumstances). This is one
> > of the reasons many people use Perl: it's a higher-level language
> > that isolates the programmer from many tedious tasks.
>
> Notice that the warning reads "uninitialized value", not "uninitialized
> variable". The uninitialized value in Perl is called undef.
>
> Even with $foo = undef, which might be called an initialization, the
> value of $foo is still uninitialized.
Well, it *might* be helpful if the message read "undefined", not
"uninitialized".
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: Sun, 30 May 1999 22:27:16 GMT
From: lamj@softhome.net
Subject: Problem with IO::Socket
Message-Id: <7ise04$d20$1@nnrp1.deja.com>
I am having a problem with IO::Socket, it seems that no perl script that
I wrote can work with IO::Socket. It just freeze there.
I was trying with some of my scripts and one at Linux Journal issue 60
which looks like this.
#!/usr/bin/perl -w
# clientIO.pl - a simple client using
# IO::Socket
use strict;
use IO::Socket;
my $host = shift || 'server.onsight.com';
my $port = shift || 7890;
my $sock = new IO::Socket::INET(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp');
$sock or die "no socket :$!";
foreach my $i (1..10) {
print $sock "hello, world: $i\n";
}
close $sock;
The program run and then freeze there waiting for something.
Anyone have ideas on how to fix this? Does perl comes with that module
by default? I didn't install any special module for it....
Jason Lam
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 31 May 1999 01:34:00 +0200
From: brad@shub-internet.org (Brad Knowles)
Subject: Problems w/ Perl 5.005_03 & tying hashes to dbm databases...
Message-Id: <brad-3105990134000001@dialup583.brussels2.skynet.be>
Folks,
I've got a script that I've put together to try to help reduce the
amount of noise you might see if you were running a program like
logcheck. The idea is that instead of seeing each individual log entry
with a separate date/time stamp, you instead see something akin to a `sort
| uniq -c | sort -nr` list of log entries (sans optional pid), and then an
indication of when the first and last log entries were made with that
exact string.
Anyway, the program seems to work okay with hashes, but when I run the
exact same program but have it tie the hash to a dbm file, the output is
different. I'm really *very* curious as to what could be going on, but I
haven't the faintest clue.
The OS is Slackware 3.5.0 running Linux kernel 2.2.9. The version of
Perl is 5.005_03, and the program is included below. I really would
appreciate any comments you may have on this program, even if they aren't
related to the problems I'm having with tying hashes to dbm files.
TIAFAHYMBATP!
#!/usr/local/bin/perl -T
#
# 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.";
}
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;
$numfiles = unlink $dbmfile;
printf STDERR "Deleted %d files.\n", $numfiles;
}
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}
}
--
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: Sun, 30 May 1999 23:17:52 GMT
From: tvn007@my-deja.com
Subject: Shorter solution ?
Message-Id: <7isgv1$esn$1@nnrp1.deja.com>
Hi,
I came up with a solution to solve the problem. However,
the solution does looks very long and not very elegant.
Would someone give me a better solution or more elegant solution ?
Below is the code:
Thanks in advance for your help,
######################################
if ($in_file_name =~ /X4/)
{
while ( <DATA> )
{
chomp;
print OUTFILE ("$_\n");
}
close DATA;
}
elsif ($in_file_name =~ /XY/)
{
while ( <DATA_XY> )
{
chomp;
print OUTFILE ("$_\n");
}
close DAYA_XY;
}
elsif ($in_file_name =~ /UP/)
{
while ( <XY_Y> )
{
chomp;
print OUTFILE ("$_\n");
}
close XY_Z;
}
elsif ($in_file_name =~ /DOWN/)
{
while ( <F2_DATA> )
{
chomp;
print OUTFILE ("$_\n");
}
close F2_DATA;
}
elsif ($in_file_name =~ /MP/)
{
while ( <LS> )
{
chomp;
print OUTFILE ("$_\n");
}
close LS;
}
elsif ($in_file_name =~ /C4/) {
while ( <XYZ> ) {
print OUTFILE ("$_\n");
}
close XYZ;
}
####################################
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 30 May 1999 22:56:29 GMT
From: penso@linuxfr.org (Fabien Penso)
Subject: Text::Query::Advanced - I need a simple example :)
Message-Id: <7isfmt$mq5$1@gloup.linuxfr.org>
Hi,
I am making a search engine for a local server, then to handle boolean
I found Text::Query::Advanced on deja.com but now I would need a very
simple example because I must say I don't get how it works.
So if someone could send me that by mail, would be cool :)
Fabien Penso <penso@linuxfr.org>
------------------------------
Date: 31 May 1999 00:49:38 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Uploading image files..
Message-Id: <slrn7l3n1h.189.efflandt@efflandt.xnet.com>
On Thu, 27 May 1999 13:16:55 -0300, Terra Landry <terral@cyberplex.com> wrote:
>I want to upload images in perl... I have it uploading, but it saves an
>empty file, so I'm not sure what I'm doing wrong... can anyone help me by
>giving me an example of a file upload??
>
>Thank you,
>Terra
perldoc CGI
This module works for me for generating the form and handling binary file
upload (if you use the proper 'binary' example). I originally needed
this to upload and e-mail (MIME::Lite) attached images and it works great.
That should work as well for text unless the line endings need to be
modified for a different OS. There is a CGI.pm variable that will tell
you the file type.
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: 31 May 1999 01:04:02 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Writing a Form Validation Script
Message-Id: <slrn7l3nse.189.efflandt@efflandt.xnet.com>
On Thu, 27 May 1999 15:16:00 GMT, simchadov@my-deja.com
<simchadov@my-deja.com> wrote:
>
>
>Hi,
>
>I need to write a script that does generic CGI form validation. Are
>there modules written to support this sort of thing or has anyone seen
>scripts out there that do this already?
>
>Thanks, Scott
>
>PS- If you could email me a reply to scott@newfangled.com that would be
>great.
Quite simple (CGI.pm function method example):
@reqd = ('name','e-mail','password');
foreach $key (@reqd) { &missing_field($key) unless param($key); }
sub missing_field {
($_) = @_;
print header, start_html('Missing Field'),h1('Missing Field'),hr,p,
"The required field '$_' has no value. Please go back and do it.\n";
}
--
David Efflandt efflandt@xnet.com
http://www.xnet.com/~efflandt/
------------------------------
Date: Sun, 30 May 1999 17:34:30 -0700
From: Kristina <kristina@greatbasin.net>
To: finsol@ts.co.nz
Subject: Re: Y2K infected Perl code
Message-Id: <Pine.BSI.4.05L.9905301724370.26546-100000@web0.greatbasin.net>
On Fri, 28 May 1999 finsol@ts.co.nz wrote:
> http://www.linguistic-funland.com/scripts/RemindMe/remindmecgi.txt
> if($data{'Year'} eq "Not Selected"){
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
> if($year !~ /0/){
> $form_year = "19$year";
> }
> else{$year = "20$year";}
Oogh. Three things: One, that was written a loooong time ago, and after I
*did* rtfm, I fixed it in new stuff and several old scripts. Two, it
would be nice if people who found obvious bugs like these would mail the
authors (or cc the author on the Usenet post) so that we could fix them.
Sometimes, you have stuff lying around that works and as you learn more,
you forget that you might have old stuff that's broken.
Three: actually the code in question wasn't intended to go past,
say, the year 2001 or 2002, since I figured that by then, Perl & CGI
either wouldn't be used, or there would be a much better free alternative
to my script available. I wonder if that's what happened with the whole
2-digit date thing in the first place: people just didn't think their
code would be used this long...
I could also mention that some of us who post scripts are not (as you can
see from my code) programmers, and thus could probably really benefit
from someone saying, "Hey, look, your stuff is broken. Look at the damn
man page for thus-and-so!" :)
Kristina
(Author of the above mentioned and later mentioned buggy scripts. Hmmm...
I wonder if "buggyscripts.org" is taken...)
------------------------------
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 5837
**************************************