[9527] in Perl-Users-Digest
Perl-Users Digest, Issue: 3120 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 10 15:07:48 1998
Date: Fri, 10 Jul 98 12:00:27 -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 Fri, 10 Jul 1998 Volume: 8 Number: 3120
Today's topics:
Re: -- Abigail, my sink is clogged (Hugh Dunne)
ADVICE NEEDED: Login Summary Stats (VK2COT)
Re: Arrays - here's the code (Mark-Jason Dominus)
BUG in "tell"? (perl 5.004_1/Linux 5.0) <NOSPAMkEynOn@panix.comNOSPAM>
Re: BUG in "tell"? (perl 5.004_1/Linux 5.0) <tchrist@mox.perl.com>
Re: Bug in Date::Format? (week number) <jschell@uswest.net>
Re: Calling DLLs from within PERL <JKRY3025@comenius.ms.mff.cuni.cz>
capture system() STDERR to filehandle <user@cisco.com>
Re: capture system() STDERR to filehandle <tchrist@mox.perl.com>
Date utility functions in perl sravanthi@my-dejanews.com
Re: Dejanews/closed lists/moderated groups/lists [Was: (Nicholas Carey)
difference between two dates using perl. sravanthi@my-dejanews.com
Re: difference between two dates using perl. <tchrist@mox.perl.com>
Re: Directory Names with Perl for NT <JKRY3025@comenius.ms.mff.cuni.cz>
Re: Help installing DBD-DBI modules (John D Groenveld)
Re: HELP: Internet Database Design questions... (Nicholas Carey)
Re: I am an "antispam spammer"? (WD Baseley)
Re: I am an "antispam spammer"? (The Wildman)
memory usage of constants versus vars <falkenl@hotmail.com>
Re: need to code a delete function <info@aactionmortgage.net>
Re: new charter and moderator for comp.lang.perl.announ <dgris@rand.dimensional.com>
Re: new charter and moderator for comp.lang.perl.announ (John D Groenveld)
New User <dalavon@mindspring.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Jul 1998 16:57:36 -0000
From: Hugh_Dunne@nospam.com (Hugh Dunne)
Subject: Re: -- Abigail, my sink is clogged
Message-Id: <35a64800@SpamAssassin.com>
Then go to CPAN and download module DRANO.
After all, perl is the ultimate 'kitchen sink' language!
------>>> TO EMAIL ME: Replace "nospam" by "hotmail" <<<------
Hugh Dunne, Chandler, Arizona Standard disclaimer applies
Those who are fond of software and sausages should not enquire
too closely into the making of either.
------------------------------
Date: Tue, 7 Jul 1998 11:01:50 GMT
From: dusan@NOSPAM-NOSPAM.com.au (VK2COT)
Subject: ADVICE NEEDED: Login Summary Stats
Message-Id: <Evq1B2.KpB@matra.com.au>
Warm greetings to the Perl community from "down-under",
Firstly, I would like to take this opportunity to say TAHNK YOU to
numerous Perl contributors who have made my job (and no doubt: of
many other people) easier.
I started using Perl back in 1990 and have never regretted it :).
I have an interesting problem which probably has hit someone else in Unix
world before.
Before sending this posting, I have searched the New, Usenet newsgroups
and old archives, hoping to find a solution.
As a matter of fact, it is quite possible that my solution is so easy but I
cannot see it at the moment (which is not surprising - I have about 70
days of unused holidays :)).
Here is the problem: I have results of standard Unix command last(1):
Login name Date Log In Log Out Total
--------------------------------------------
blabla Tue Jun 30 13:43 - 13:44 (00:01)
blabla Tue Jun 30 13:05 - 13:42 (00:37)
blabla Fri Jun 26 14:32 - 14:40 (00:07)
blabla Fri Jun 26 14:23 - 14:25 (00:02)
blabla Fri Jun 26 13:36 - 13:41 (00:04)
blabla Fri Jun 26 13:25 - 13:30 (00:05)
blabla Fri Jun 26 11:47 - 11:59 (00:12)
blabla Fri Jun 26 08:44 - 08:58 (00:13)
blabla Fri Jun 26 20:59 - 11:20 (4+14:20)
blabla Thu Jun 25 12:51 - 13:00 (00:08)
blabla Thu Jun 25 12:23 - 12:43 (00:20)
blabla Thu Jun 25 12:15 - 12:22 (00:07)
blabla Thu Jun 25 11:24 - 11:30 (00:06)
blabla Thu Jun 25 10:24 - 10:27 (00:02)
blabla Thu Jun 25 09:48 - 11:01 (01:13)
blabla Thu Jun 25 08:21 - 09:01 (00:40)
blabla Thu Jun 25 00:26 - 01:06 (00:39)
blabla Thu Jun 25 00:14 - 00:14 (00:00)
blabla Wed Jun 24 17:03 - 17:05 (00:02)
blabla Wed Jun 24 16:29 - 17:28 (00:59)
blabla Wed Jun 24 16:25 - 16:28 (00:03)
blabla Wed Jun 24 15:41 - 16:25 (00:43)
blabla Wed Jun 24 10:34 - 15:58 (05:24)
blabla Tue Jun 23 14:20 - 14:44 (00:23)
blabla Fri Jun 19 16:05 - 16:46 (00:41)
blabla Fri Jun 19 14:39 - 16:04 (01:25)
blabla Fri Jun 19 14:38 - 14:38 (00:00)
blabla Fri Jun 19 10:38 - 13:46 (03:08)
blabla Thu Jun 18 12:46 - 08:41 (19:55)
blabla Thu Jun 18 09:24 - 11:17 (01:53)
blabla Wed Jun 17 07:53 - 08:54 (01:01)
blabla Mon Jun 15 13:26 - 16:32 (03:06)
blabla Fri Jun 12 12:52 - 15:09 (02:17)
blabla Fri Jun 12 11:42 - 11:53 (00:10)
blabla Fri Jun 12 09:55 - 10:37 (00:41)
blabla Wed Jun 10 17:41 - 17:51 (00:09)
blabla Wed Jun 10 17:35 - 17:41 (00:05)
blabla Mon Jun 8 15:50 - 15:56 (00:05)
blabla Mon Jun 8 14:18 - 15:25 (01:06)
blabla Mon Jun 8 14:06 - 14:18 (00:11)
blabla Mon Jun 8 09:20 - 09:29 (00:08)
blabla Mon Jun 8 09:16 - 09:18 (00:02)
blabla Sun Jun 7 21:52 - 22:36 (00:43)
blabla Fri Jun 5 23:11 - 23:23 (00:12)
blabla Fri Jun 5 18:31 - 20:10 (01:39)
blabla Fri Jun 5 08:27 - 08:31 (00:04)
blabla Fri Jun 5 00:32 - 00:40 (00:08)
blabla Thu Jun 4 10:32 - 10:34 (00:02)
blabla Wed Jun 3 17:45 - 17:48 (00:03)
blabla Wed Jun 3 17:38 - 17:43 (00:05)
blabla Wed Jun 3 11:25 - 13:11 (01:46)
blabla Wed Jun 3 11:01 - 11:18 (00:16)
blabla Wed Jun 3 10:19 - 10:30 (00:11)
blabla Wed Jun 3 08:20 - 08:27 (00:07)
blabla Tue Jun 2 13:16 - 14:29 (01:12)
blabla Tue Jun 2 10:05 - 13:04 (02:58)
blabla Tue Jun 2 08:29 - 08:41 (00:11)
blabla Mon Jun 1 10:10 - 16:07 (05:56)
The Total figure (most right-hand column) represents total login time
for a given session. For example, (00:11) means 11 minutes,
(01:39) means one hour and 39 minutes, and (4+14:20) means four days
and 14 hours and 20 minutes!
The task is to present this data in a histogram similar to this:
Total: 70.07
00-: 1.61
01-: 2.63
02-: 1.00
03-: 1.00
04-: 0.04
05-: 0.00
06-: 0.00
07-: 0.00
08-: 0.05
09-: 0.00
10-: 0.24
11-: 2.84
12-: 2.62
13-: 2.71
14-: 2.28
15-: 1.87
16-: 2.03
17-: 3.16
18-: 4.95
19-: 5.26
20-: 7.86
21-: 9.38
22-: 12.00
23-: 6.54
In essence, I want to get hourly-summary for a given account. For example,
how many hours and minutes user "blabla" was logged in between 00:00am and
06:00am.
At the moment, I am trying to write it using Date::Calc module (by
sb@engelschall.com). Somehow, my script is getting more and more complicated.
Maybe I need to relax and leave it for a while...
One more useful note. Up to now, I used another wonderful Linux utility
sac(1) which does hourly histograms. Alas, I have discovered that corruption
of wtmp causes it to create more unreliable results than last(1) command.
I do not expect you to write a script for me. You have better things to do.
Thank you in advance for any comments.
Dusan U. Baljevic, BSEElec(Hons)
Senior Systems Programmer/Manager
Member of ACM, ACS, WIA
http://www.matra.com.au/~dusan/dusan.html
------------------------------
Date: 10 Jul 1998 14:51:47 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Arrays - here's the code
Message-Id: <6o5ns3$c82$1@monet.op.net>
In article <slrn6qc98a.ncp.the_wildman_98@foobar.net>,
The Wildman <the_wildman_98@hotmail.com> wrote:
>If figured it might help if I showed the code that was causing trouble.
Always a good idea. Sometimes you hit the jackpot.
># The idea of this code is to avoid duplication. If $event[<current>] matches
># $event[<any of the previous>] then it should determine a new value for
># $event[<current>].
1 >sub f113 {
2 > for ($i = 0;$i < $events;) {
3 > ### (Code to set $event[$i] omitted here) ###
4 > if ($i eq 0) {
5 > $i++;
6 > } else {
7 > for ($j = 0;$j < $i;$j++) {
8 > if ($event[$i] == $event[$j]) {
9 > last;
10 > }
11 > # this line works as expected
12 > print $i," ",$event[$i],"/",$j," ",$event[$j],"\n";
13 > }
14 > $i++;
15 > }
16 > # $event[$i] prints as a null value right here, which is
17 > # what led me to believe I was doing arrays totally wrong.
18 > print $i," ",$event[$i],"\n";
19 > }
20 >}
I guess I'll start with the problem you're actually complaining about,
on line 18. The code I omitted (at line 3) sets $event[$i]. But then
by the time you get to line 18 to print out $event[$i], $i is
different, because you added one to it, either on line 5 or line 14.
I hope that's what you wanted to know.
That out of the way, I suggest that you rewrite the code like this:
sub f113 {
my @used;
for ($i=0; $i<$events; $i++) {
do {
### (Code to set $event[$i] omitted here) ###
} while $used[$event[$i]];
# Mark this event `used' so we don't use it again.
$used[$event[$i]] = 'yup';
print $i, " ", $event[$i], "\n";
}
It would be a lot shorter that way, and that is usually a good thing.
Now let's fix the ### (Code to set $event[$i]) ### so that it doesn't
look like an escaped inmate from the Pennsylvania State Prison for
COBOL Offenders. Here's what you had:
> $dice = &roll(1,100);
> if ($dice <= 5) {$event[$i] = 1;}
> if ($dice >= 6 && $dice <= 10) {$event[$i] = 2;}
> (26 more omitted)
> if ($dice >= 95 && $dice <= 99) {$event[$i] = 29;}
> if ($dice eq 100) {$event[$i] = 30;}
Now you have two problmes here: A little one and a big one. The
little one is that you used `eq' instead of `==' for comparing
numbers, which you must never do.
The big one is that you used thirty lines where five would do. The
Cardinal Rule of Programming is that if you have two parts of the
program to do the same thing, you should merge them. A related rule
is: Use code to capture irggularity, and data to capture regularity.
Here you have an extremely regular structure, so regular that it could
be turned into a little table. So that's exactly what we'll do, and
replace your thirty lines of code with a thirty-element array:
$dice = &roll(1,100);
@max_dice = ( 0, 5, 10, 20, 23, 24, 27, 31, 34, 37,
38, 41, 44, 48, 50, 53, 55, 56, 57, 62,
64, 69, 75, 81, 85, 86, 88, 93, 94, 99,
);
# Search table, looking for largest-numbered event
for ($event_no = 1; $event_no < @max_dice; $event_no++) {
if ($dice < $max_dice[$event_no]) {
# If the actual roll is larger than the max value for this
# event, then we have gone a little too far into the table.
$event_no--;
last;
}
}
$event[$i] = $event_no;
After we do this, we're going to make sure that $event_no has not been
used yet. Until we do that, there's no point in assigning it to
$event[$i], so we can delay that until the end. The entire function
now looks like this:
sub f113 {
my @used;
my ($i, $event_no);
for ($i=0; $i<$events; $i++) {
do {
$dice = &roll(1,100);
my @max_dice = ( 0, 5, 10, 20, 23, 24, 27, 31, 34, 37,
38, 41, 44, 48, 50, 53, 55, 56, 57, 62,
64, 69, 75, 81, 85, 86, 88, 93, 94, 99,
);
# Search table, looking for largest-numbered event
for ($event_no = 1; $event_no < @max_dice; $event_no++) {
($event_no, last) if $dice < $max_dice[$event_no];
}
} while $used[$event_no];
$used[$event_no] = 'yup';
print $i, " ", $event_no, "\n";
$events[$i] = $event_no;
}
}
There are only about nine lines here that have real semantic content.
That's a big improvement, because the original function was forty or
fifty lines long.
This may be as far as you want to go, but I gather (from the name
`f113') that you have a lot of very similar functions in this program,
and the Cardinal Rule says you should merge them. There are only
three parts of the function that aren't totally generic:
The part that rolls the dice
The @max_dice table
$events
If you make these into function arguments, you can use the same
function to roll events on many different tables. The function might
look like this:
sub f_generic {
my ($num_events, $num_dice, $dice_sides, @result_table) = @_;
my (@used, @result, $i);
for ($i=0; $i<$num_events; $i++) {
do {
$dice = &roll($num_dice, $dice_sides);
# Search table, looking for largest-numbered event
my $event_no;
for ($event_no = 1; $event_no < @result_table; $event_no++) {
($event_no, last) if $dice < $result_table[$event_no];
}
} while $used[$event_no];
$used[$event_no] = 'yup';
print $i, " ", $event_no, "\n";
$result[$i] = $event_no;
}
@result; # Return the results back to the caller.
}
Now, to get the effect of f113, do this:
@table_113 = ( 0, 5, 10, 20, 23, 24, 27, 31, 34, 37,
38, 41, 44, 48, 50, 53, 55, 56, 57, 62,
64, 69, 75, 81, 85, 86, 88, 93, 94, 99,
);
@events = f_generic(4, # Generate four unique events
1, 100, # using 1d100
@table_113); # select events from this table
If you really have 113 similar functions, you can probably reduce the
code size by a factor of 70 or 80.
Hope this helps.
------------------------------
Date: 10 Jul 1998 17:18:06 GMT
From: k y n n <NOSPAMkEynOn@panix.comNOSPAM>
Subject: BUG in "tell"? (perl 5.004_1/Linux 5.0)
Message-Id: <6o5ice$7n8@news1.panix.com>
I'm having problems getting tell to work in my linux box. Script:
open(OUT, ">shit") || die "merde!\n";
$s = <<EOF;
I'M GOING NUCKING FUTS!!
I'M GOING NUCKING FUTS!!
I'M GOING NUCKING FUTS!!
EOF
print tell OUT, "\n";
syswrite OUT, $s, length($s);
print tell OUT, "\n";
produces the inexplicable output:
linux% script_above
0
0
linux% cat shit
I'M GOING NUCKING FUTS!!
I'M GOING NUCKING FUTS!!
I'M GOING NUCKING FUTS!!
linux%
while the same script on an sgi machine produces a more reasonable
result:
sgi% script_above
0
75
sgi% cat shit
I'M GOING NUCKING FUTS!!
I'M GOING NUCKING FUTS!!
I'M GOING NUCKING FUTS!!
sgi%
Am I doing something wrong? Or is there a bug with "tell" on linux?
FWIW, the perl version on the linux box is 5.004_1, and the linux is
Red Hat release 5.0 (Hurricane).
Thanks for your help,
K.
--
To those who prefer to reply by e-mail, please remove the upper-case
letters from the return address in the header. Thank you. K.
------------------------------
Date: 10 Jul 1998 18:10:55 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: BUG in "tell"? (perl 5.004_1/Linux 5.0)
Message-Id: <6o5lff$fud$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
k y n n <NOSPAMkEynOn@panix.comNOSPAM> writes:
:I'm having problems getting tell to work in my linux box. Script:
You don't understand buffering.
:To those who prefer to reply by e-mail, please remove the upper-case
:letters from the return address in the header. Thank you. K.
Nope. Post so I can reply and receive as a special bonus
a decent answer.
--tom
--
"They'll get my perl when they pry it from my cold, dead /usr/local/bin."
Randy Futor in <1992Sep13.175035.5623@tc.fluke.COM>
------------------------------
Date: Fri, 10 Jul 1998 11:53:23 -0600
From: Joe Schell <jschell@uswest.net>
To: k hofer <k.hofer@nortel.com>
Subject: Re: Bug in Date::Format? (week number)
Message-Id: <35A65513.97BF88CE@uswest.net>
k hofer wrote:
>
> Hi,
>
> I am using a script to get the week number:
>
> The output for Thursday the 09 of July 1998 is:
> =======================================
> Day of year: 190
> Week number starting with Sunday: 27
> Week number starting with Monday: 27 <=====
>
> =======================================
>
> Produces the wrong week number when starting with Monday! Week should be
> 28.
>
I am not sure I understand why you think the result is wrong. In one
case the week 'starts' on Sunday; in the second it 'starts' on Monday.
I would expect that for those two cases the week number would be same
for tuesday to saturday. I would expect some confusion if the year had
started with Sunday, but it started with a thursday. Perhaps if you
choose a date that was closer to the beginning of the year, for example
thursday jan 8th 1998, you could then demonstrate why you thought the
count was wrong.
---Joe
------------------------------
Date: Fri, 10 Jul 1998 19:41:33 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Calling DLLs from within PERL
Message-Id: <35A6D0DD.6389@comenius.ms.mff.cuni.cz>
alan_k'necht@canadalife.com wrote:
>
> On 8 Jul 1998 14:24:19 GMT, "Uwe Honekamp" <uwe.honekamp@etas.de>
> wrote:
>
> Could you (or someone else) suggest a couple of the other alternatives
> and maybe some resources where I could look for more information?
>
> Thanks...
>
> >alan_k'necht@canadalife.com wrote in =
> ><35a37466.1382828@news.worldlinx.com>...
> >> Is there a way to call DLLs using PERL in a NT environment?
> >
> >Yes, and there's actually more than one way (as there always is :-)=20
> >to do this.=20
> >However, I encourage you to have a look at SWIG, the Simplified=20
> >Wrapper and Interface Generator. Great tool.
> >
> >http://www.cs.utah.edu/~beazley/SWIG/
> >
> >Regards
> >
> >Uwe
I do not see the whole thread so I hope I do not repeat someones post
:-)
If you do not want to create your own compiled modules you may
use Win32::API;
# http://www.divinf.it/dada/perl
$writeINI = new Win32::API("KERNEL32", "WritePrivateProfileString",
[P,P,P,P], I) or
die "WritePrivateProfileString: $!\n";
$section = "main\0"; # all parameters are LPSZ = C string
$name = "Some\0";
$value = "Value\0";
$writeINI->Call($section,$name,$value,$INI)
HTH, Jenda
http://www.fmi.cz/private/Jenda/
------------------------------
Date: Fri, 10 Jul 1998 10:50:12 -0700
From: user <user@cisco.com>
Subject: capture system() STDERR to filehandle
Message-Id: <35A65454.BC982895@cisco.com>
How can I capture STDERR from system() to current selected filehandle?
open(TEST, ">out.txt") || die "Cannot open out.txt";
select TEST;
# any clue to print STDERR generated from the following system
call to TEST????
system("ls -k"); # just want to generate system error
close(TEST);
Pius
pius@cisco.com
------------------------------
Date: 10 Jul 1998 18:08:49 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: capture system() STDERR to filehandle
Message-Id: <6o5lbh$fud$2@csnews.cs.colorado.edu>
In comp.lang.perl.misc, USERID@cisco.com writes:
:How can I capture STDERR from system() to current selected filehandle?
This is in the FAQ. And as soon as you post under a real ID,
I'll tell you which one.
--tom
--
/* This is the one truly awful dwimmer necessary to conflate C and sed. */
--Larry Wall, from toke.c in the v5.0 perl distribution
------------------------------
Date: Fri, 10 Jul 1998 17:47:42 GMT
From: sravanthi@my-dejanews.com
Subject: Date utility functions in perl
Message-Id: <6o5k3v$q3h$1@nnrp1.dejanews.com>
I want to know is there any perl function available, to return the number fo
days between two dates if I pass the two dates in a certain format. ex,
07/27/98, 05/30/98.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 10 Jul 1998 17:46:56 GMT
From: ncarey@harlequin.com (Nicholas Carey)
Subject: Re: Dejanews/closed lists/moderated groups/lists [Was: Re: Is perl5-porters closed to subscription?
Message-Id: <35a64bb4.59351963@newshost.harlequin.com>
On Fri, 10 Jul 1998 08:59:53 -0500, fl_aggie@thepentagon.com (I R A
Aggie) wrote:
> In article <6o4tee$k5i$1@nnrp1.dejanews.com>, birgitt@my-dejanews.com wrote:
>
> + Is it a matter of netiquette or is it really against the law (violation
> + of the author's copyright - is there really a written law for that ?)
[elided]
> Of course, you can only sue for damages caused unless you file a copyright
> with your local copyright office. And _you_ have to file suit to enforce
> your rights -- copyright infringement is typically a civil matter, not
> criminal.
Not true -- see below.
>
> And who among us is rich enough to file suit over what we post to Usenet?
> The cost is likely to far exceed any monetary rewards.
>
> + What are my rights as the author of that email ? Have there been
> + cases where this became a point of a severe dispute ?
>
> My understanding is that you still retain rights to your {e}mail, but
> that the receipiant also some rights to what you *gave* them. That's not
> real clear to me, but I haven't been bothered to gain clarification.
Right. It's pretty much the same as a book or a handwritten letter.
Copyright Law is [pretty much] based on a manufacturing paradigm:
the only way to 'copy' something is to make a *physical* copy of it.
So, as the author of a work owns the copyright and controls the right
to copy the work, while the owner of a particular copy of a work
controls the use and disposition of that instance but can't copy it.
This paradigm breaks down somewhat with works like email, USENET
news posts or computer software, since its only physical expression
is a pattern of electron states. Ordinary use of such works
*requires* that the pattern be copied. But that is a whole 'nother
topic for discussion.
For instance, only the author or his licensees may make a copy of a
book, but the book's buyer may [within broad limits] do what she
likes with it (sell it, shred it and use it for garden mulch, etc.],
with the sole exception that she can't make a copy of it. Similiarly,
if you are, say, Ms. Monica Lewinski, and decide to publish the
love letters written to you by Mr. William Jefferson Clinton, you've
probably got both a criminal and civil problem on your hands:
although the letters are your property, the text [the expression
of an idea] belongs to the author -- even though the copyright
is not registered the the Copyright Office, even though the letter
makes no assertion of copyright, the copyright still belongs to the
author.
As almost any rental videotape takes great delight in telling you,
copyright violations *are* a criminal offense under Federal Law
with pretty severe penalties. And the copyright holder can sue
for damages in civil court as well. Whether or not the author can
get the FBI or a Federal Prosecutor to take your case is another
matter -- I suspect they have other, better things to do with their
time. But if you're willing to pay a lawyer, you most certainly
can drag the copyright violator into Federal Court. But you
probably won't get much in the way of damages for somebody
misusing a piece of email you sent them. Unless of course,
you're the President of the United States and the email is
a love letter to Monica Lewenski ;-)
DISCLAIMER: This advice is worth exactly what you paid for it.
If you really care about this issue, talk to an intellectual
property lawyer.
Nicholas
------------------------------
Date: Fri, 10 Jul 1998 17:47:41 GMT
From: sravanthi@my-dejanews.com
Subject: difference between two dates using perl.
Message-Id: <6o5k3t$q3g$1@nnrp1.dejanews.com>
I want to now how can I find the difference between two dates in certain
format using perl? for example, 07/11/98 , 30/2/98 and I want to know the
number of days in between these two dates. Is there any module written for
that, or I have to write my own function for that? Please reply me.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 10 Jul 1998 18:06:24 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: difference between two dates using perl.
Message-Id: <6o5l70$fud$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
sravanthi@my-dejanews.com writes:
:I want to now how can I find the difference between two dates in certain
:format using perl? for example, 07/11/98 , 30/2/98 and I want to know the
:number of days in between these two dates. Is there any module written for
:that, or I have to write my own function for that? Please reply me.
% man perlfaq4
[...]
How can I compare two date strings?
--tom
--
With a PC, I always felt limited by the software available. On Unix, I am
limited by my knowledge. --Peter J. Schoenster <pschon@baste.magibox.net>
------------------------------
Date: Fri, 10 Jul 1998 19:47:19 -0700
From: Jan Krynicky <JKRY3025@comenius.ms.mff.cuni.cz>
Subject: Re: Directory Names with Perl for NT
Message-Id: <35A6D237.1C@comenius.ms.mff.cuni.cz>
> > Jeff Lockard wrote in message <35A2AF16.6F93D0CE@rwd.com>...
> > >Hi -
> > >
> > >I am trying to write some simple scripts that will recursively move
> > >files and subdirectories from one server to another. I am not a Perl
> > >expert and have been using the SYSTEM command to shell out to use the
> > >DOS copy, xcopy, and move commands.
> > >
> > >The problem that I keep running into is that the folders and files may
> > >have spaces in the names which tend to mess up the DOS commands (even on
> > >
> > >NT!). Long names are fine, but a space causes the DOS commands to fail.
> > >
> > >Does anyone know of a Perl module/extension that will allow me to do
> > >this?
> > >
> > >Thanks for any help...
> > >Jeff Lockard
> > >RWD Technologies, Inc
You may
use Win32::FileOp;
Copy "c:\some dir" => '\\\\server\share\new dir\\';
This module is able to give you progress dialogs, confirmation bozes,
FileOpen/FileSave dialogs and more.
See http://www.fmi.cz/private/Jenda/
Jenda
------------------------------
Date: 10 Jul 1998 13:12:27 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Help installing DBD-DBI modules
Message-Id: <6o5i1r$dnr$1@tholian.cse.psu.edu>
Consider upgrading to the latest gcc. Yours appears to be an older binary
package built for Solaris 2.5 instead of 2.5.1. Perhaps it can be used to
build 2.8.x from source.
Consider upgrading your perl to 5.00404. When you do, be sure to read the
INSTALL doc, you want to use Sun's malloc instead of Perl's and maybe some
othe non-defaults.
John
groenveld@acm.org
------------------------------
Date: Fri, 10 Jul 1998 18:23:21 GMT
From: ncarey@harlequin.com (Nicholas Carey)
Subject: Re: HELP: Internet Database Design questions...
Message-Id: <35a65740.62307673@newshost.harlequin.com>
On Wed, 08 Jul 1998 23:32:12 -0700, Avi Goldenberg
<mozzer@earthlink.net> wrote:
>Hi...
>
>*sigh* For being someone who though they were technically competent, I
>am suddenly humbled into a quivering child!
>
>I need some help understanding (or at least pointed towards a great text
>or two on) a good approach towards setting up a web site that has
>interactive database abilities.
Take a look at Phil Greenspun's site at MIT. He's written a good
book on database-backed web sites and is in the process of writing
another one. And his site is, shall we say, a pretty good example
of the breed -- try 6000+ oneline images, each available in several
resolutions, up to 1000x1500 jpg and [large] FlashPix. His site takes
400,000 hits/day and runs about 20 hits/second. He does run an HP K460
box -- slightly better pipes than your average Joe.
http://www.photo.net/wtr/dead-trees/
The book, _Database Backed Web Sites_
http://www.photo.net/wtr/thebook/
A draft of the new book, _Philip and Alex's Guide to Web
Publishing_
http://www.photo.net/
The portal to Phil Greenspun's site
http://www.photo.net/philg/
Phil Greenspun's home page
Rummage around his site -- it's great. And you might find some
pictures you absolutely have to have.
Nicholas
--
------------------------------
Date: Fri, 10 Jul 1998 17:02:28 GMT
From: wbaseley@mindspring.com (WD Baseley)
Subject: Re: I am an "antispam spammer"?
Message-Id: <35a942cf.22866101@news.mindspring.com>
[comp.lang.perl.misc added to newsgroups]
In article <slrn6qcfme.nqf.the_wildman_98@foobar.net>,
the_wildman_98@hotmail.com (The Wildman) articulated:
>However, you didn't reply to it. You saw the warning and decided to make a
>snide remark. Exactly what is an "antispam spammer" anyway? Maybe *you*
>are a spammer. You certainly have the mentality (i.e. you lied about
>replying) for it.
This person: a) tried to help you; b) doesn't like mungs and other
stunts aimed at deflecting junk email. There are a lot of people like
that. Your mentality is the one that should be questioned, for being
so stupidly rude to someone who was attempting to assist you.
>Alternatively, I can attempt to educate you by pointing you to the
>appropriate FAQs and web pages. I would prefer that solution, and I think
>you would too.
A generous offer. Could you point me to the RFC that allows you to
attempt to publicly humiliate anyone who objects to jumping through
your reply hoops?
-- WD Baseley
"They have won the war against spam"
~ Sanford Wallace ~ April 8, 1998
- The Email Abuse FAQ is at <http://members.aol.com/emailfaq>
------------------------------
Date: 10 Jul 1998 18:35:27 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Re: I am an "antispam spammer"?
Message-Id: <slrn6qcohn.og2.the_wildman_98@foobar.net>
On Fri, 10 Jul 1998 17:02:28 GMT, Wildman's eyes rolled up in his head and
froth dripped from his fangs when WD Baseley
<wbaseley@mindspring.com> said the following fighting words:
>[comp.lang.perl.misc added to newsgroups]
And snipped. I have no desire to argue such issues there. I'll gladly argue
them here, however, and maybe even learn something along the way. Or maybe
not.
In any case, he knows it was posted here and is welcome to discuss it here.
Hopefully, he will at least read this ng and gain an understanding of why I
post the way I do.
>This person:
>a) tried to help you;
No, he didn't. If - for example - I see someone munging by putting "nospam"
on the left side of the @ rather than the right, I'll explain why doing it
that way is wrong, explain a better way to do it, and not call them an
"antispam spammer" (whatever the fuck that is).
He also lied about replying, since the hotmail address does accept email,
and I only got the email to my regular address. I *did* get a reply from
someone else at the hotmail address, to which I responded nicely, thanked
them for their reply, and pointed out my regular address.
>b) doesn't like mungs and other stunts aimed at deflecting junk email.
And I don't like spam. He didn't have to reply directly to me. I read the
ng's I post to, and expect to see responses there.
>There are a lot of people like that.
And there are a lot of people like me. I know it violates RFCs, and
incoveniences others. But spam violates my mailbox and incoveniences me. I
do not wish to deal with the amount of spam I used to in the past, and I
don't believe its right that I should have to stop using the internet to
avoid spam. Post without munging if you wish, and "just hit delete". But
don't expect to do the same until spam is at more manageable levels.
My regular address is *still* floating around on mailing lists from when I
was posting it in the clear. I sure don't need to be added to more.
>Your mentality is the one that should be questioned, for being so stupidly
>rude to someone who was attempting to assist you.
I was rude? I think he was rude. Perhaps I responded in kind. Stupidly rude?
I disagree. Assist me? Bullshit! His reply to my question was worthless, and
a flimsy excuse to bitch at me.
>A generous offer. Could you point me to the RFC that allows you to
>attempt to publicly humiliate anyone who objects to jumping through
>your reply hoops?
I certainly wasn't attempting to publicly humiliate him. If that is the way
it came across, I will apologize for that. But I knew how much he hated
emailing me - despite his doing it anyway - yet I felt he needed a forum in
which to respond. Since c.l.p.misc isn't about spam and this ng is, I felt
it was a good compromise.
One additional note, I've changed the way I mung. I used to use a
"spamblock", but now I use a "spam sink" - which I empty and deal with
manually. Think about the signifigance of that for a moment.
--
The Wildman - wildman at microserve dot net
Do NOT reply to this post! All mail sent to the From/Reply-To will be
considered spam, and handled appropriately.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------
------------------------------
Date: 10 Jul 1998 17:08:09 GMT
From: "Lee Falkenhagen" <falkenl@hotmail.com>
Subject: memory usage of constants versus vars
Message-Id: <01bdac25$52534c00$915c5093@lfalkenhagen.dhs.state.tx.us>
I have quite a few "variables" in my scripts that I initialize once and
they are then read only. Is it better from a performance/memory
perspective to declare them as constants instead? Or keep them as
variables...
--
Lee Falkenhagen
Certified Sybase DBA
------------------------------
Date: Fri, 10 Jul 1998 14:05:13 -0400
From: AACTION Mortgage Webmaster <info@aactionmortgage.net>
Subject: Re: need to code a delete function
Message-Id: <35A657D9.7AF7@aactionmortgage.net>
F.Quednau wrote:
>
> AACTION Mortgage Webmaster wrote:
> >
> > also are there issues for not using the close(); at the end or does it
> > take care of itself?
>
> AFAIK close is performed at the end of the script or if the file is re-opened.
>
> --
> ____________________________________________________________
> Frank Quednau
> http://www.surrey.ac.uk/~me51fq
> ________________________________________________
Things are not panning out. I tried both the unlink and open functions
but each were responded by the httpd 500 error with the apache daemon
aactionmortgage.net is hosting on (bsdi unix). I think I am triggering
security violations becasue I am using an ISP other than our hosting
provider (IP and reverse DNS issues). Yet the datafiles are set to chmod
777. The scripts are set to chmod 751.
So the other alternative is to write code that erases the text *inside*
the datafile. This is the hard part, writing code that reads and sorts
the data text, overwrites the text, and saves the file without
triggering a http 500 error. Time to fire up the expresso machine
tonite! Perhaps a stop at Barnes and Noble would be in order because
"Perl by Example" is not working for me. I need someting more
CGI-centric.
------------------------------
Date: Fri, 10 Jul 1998 17:35:04 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o5ild$9pc$1@rand.dimensional.com>
[posted to comp.lang.perl.misc and mailed to the cited author]
In article <6o5h0g$dll$1@tholian.cse.psu.edu>
groenvel@cse.psu.edu (John D Groenveld) wrote:
> The charter
>should allow a moderator who has no experience with Perl
>to make quick decisions on whether a post should be
>accepted.
What? This is silly. How, exactly, do you expect such a
charter to be effective?
The only way to meet this criterion would be to write a charter
so specific and so restrictive that it will be utterly useless.
One of the best qualities of moderation is that allows things
to be filtered through the judgment of someone who is expert in
the field and understands the all the issues involved with
the subject he is moderating.
If we want to remove the human judgment, we may as well write
a robomoderator and forget about it. At least then nobody could
complain that a particular rejection was malicious, arbitrary,
or clouded by a conflict of interest.
Regards,
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: 10 Jul 1998 14:34:01 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o5mqp$drl$1@tholian.cse.psu.edu>
The current charter is effective because it explicitly states
that announcements of new releases of Perl or its extensions
will accepted. Proponents of a change in the charter want to
include other types of announcements. Why shouldn't we expect
them to reach a consensus of what other specific types will
be accepted?
It seems to me that the experts in Perl who would be in the
best position to act as King Soloman either already have a
commercial interest in Perl or inevitably end up with some. My
understanding is that Randal does not want to be in the position
to have to balance this conflict of interest. I assume other
Perl experts will have the same reasonable reservations. If
they don't, I think many readers will.
I don't think moderating c.l.p.a should be a fulltime job. If
the charter is explicit in what will be accepted, it doesnt
have to be.
John
groenveld@acm.org
------------------------------
Date: 10 Jul 1998 17:50:35 GMT
From: "Dalavon" <dalavon@mindspring.com>
Subject: New User
Message-Id: <01bdac2b$5155f180$f80110ac@atl-mail.accutech>
Hello,
I am a new user. I just loaded perl onto a HP9000 and I do not think I
installed the man pages correctly (I am fairly new to UNIX also). I can
not find them anywhere on my system. Can any one help?
Also are there any Perl user groups in the Atlanta, GA area.
Thankyou
Jim
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". 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 3120
**************************************