[7445] in Perl-Users-Digest
Perl-Users Digest, Issue: 1070 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 24 09:07:19 1997
Date: Wed, 24 Sep 97 06:01:18 -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 Wed, 24 Sep 1997 Volume: 8 Number: 1070
Today's topics:
Re: '0': string or number? you make the call! (Bart Lateur)
Re: '0': string or number? you make the call! (Tad McClellan)
array assignment problem. <doug@3dlabs.com.remove>
Re: Beginner's question : Perl or Java ? (Bob Apthorpe)
CGI/Perl: Appending Two Associative Arrays (Darren Hayes)
Re: Change /etc/passwd <jcarlosd@ford.com>
Re: Getting next array element in a foreach (Bart Lateur)
Re: help for user authentication <aas@bergen.sn.no>
Re: Help, Why doesn't this work?! (Bart Lateur)
Indentation program <rohit@techapp.com>
Re: Installing Perl modules w/o root? (Tad McClellan)
Re: Is Perl Year2000 compliant? <seay@absyss.fr>
Re: perl mail on solaris (Neil Briscoe)
Perl on the end of a named pipe? <apollock@bit.net.au>
Q: Getting user input without pausing <joshua@mongoose.demon.co.uk>
require 'sys/socket.ph' <Benarson.Behajaina@swh.sk>
Re: require 'sys/socket.ph' <tw36027@glaxowellcome.com>
Re: setsockopt (solving 'address already in use' error) (Davor Cubranic)
Re: Simulating POST method w/ PERL. <aas@bergen.sn.no>
Re: Simulating POST method w/ PERL. (Martien Verbruggen)
Re: Text::English (Martien Verbruggen)
Re: Unlink syntax <eike.grote@theo.phy.uni-bayreuth.de>
Unlist syntax <womlake@zip.com.au>
Re: Unlist syntax (Tad McClellan)
week-of-the-year calculation <gilles@tls-cats.sps.mot.com>
Re: Where is perl/Tk for Win32 <mattias.lonnqvist@-NO-SPAM-.uidesign.se>
Writing xBase (dBase) files (Koos Pol)
Re: Writing xBase (dBase) files <seay@absyss.fr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 24 Sep 1997 09:02:00 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: '0': string or number? you make the call!
Message-Id: <342ace45.2579003@news.tornado.be>
Andreas Schmidt <andi@team-konzept.de> wrote:
>In perl there are no datatypes like integer or string, they all are just
>scalars. So there is no difference between assigning 0 or '0'.
All very nice. But it has the very nasty consequence that the most used,
and most typical Perl construct is buggy:
while(<>) { ... }
This will not only stop reading a file prematurely if it ends on a "0"
on a single line on it's own (without "\n"), but it will skip all
remaining files too!
I can't conclude anuthing else than that this behaviour with regard to
"0" is counter-intuitive.
Bart.
------------------------------
Date: Wed, 24 Sep 1997 06:18:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: '0': string or number? you make the call!
Message-Id: <nusa06.ul.ln@localhost>
Bart Lateur (bart.mediamind@tornado.be) wrote:
: Andreas Schmidt <andi@team-konzept.de> wrote:
: >In perl there are no datatypes like integer or string, they all are just
: >scalars. So there is no difference between assigning 0 or '0'.
^^^^^^^^^^^^^
There is often no difference. Sometimes there *is* a difference though.
(blue Camel p88)
: All very nice. But it has the very nasty consequence that the most used,
: and most typical Perl construct is buggy:
: while(<>) { ... }
: This will not only stop reading a file prematurely if it ends on a "0"
: on a single line on it's own (without "\n"), but it will skip all
: remaining files too!
No it won't.
----
while( $_ = <>) { ... }
If your write it like that, then it will behave as you describe,
but you didn't write it like that. ;-)
----
while( defined($_ = <>)) { ... } # same (correct) behavior as while (<>)
: I can't conclude anuthing else than that this behaviour with regard to
: "0" is counter-intuitive.
We get too used to the magic that perl does for us.
------- make a 'problem' file ---------
#!/usr/bin/perl -w
open(FILE, ">zero_end") || die "could not open 'zero_end' $!";
print FILE "first line\n";
print FILE 0;
close(FILE);
----------------
------- read/print the problem file ----
#!/usr/bin/perl -w
# echo.pl
while (<>) {
print "$.: $_\n";
}
----------------
invoked as:
echo.pl zero_end zero_end
outputs:
1: first line
2: 0
3: first line
4: 0
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: 24 Sep 1997 08:08:26 GMT
From: "Doug" <doug@3dlabs.com.remove>
Subject: array assignment problem.
Message-Id: <01bcbcf5$d808dc40$d9d880c1@doug-laptop.3dlabs.com>
Hi,
I am trying to recurse directories and list all files in them, and their
sub directories. To do this I'm getting the basedir from the user via
$FORM{'area'}. The user can also specify 'all', upon which I would like
to search a predefined list of directories. This is the relevant code I
have:
@areas = ('database','news','personal'); # Initial setting early in the
program
$FORM{'area'} =~ /all/i ? @DIRS = @areas : push (@DIRS, $FORM{'area'});
@DIRS is a list that I push/pop to keep track of which sub directories I
have to go into. This all works if I only have two items in the first
@areas = (...) line. I don't get any syntax errors. I'm using Perl 5 on
NT and calling the Perl script from an html page. Each time it fails the
web browser tries to download the perl script.
Help appreciated
Thanks
Doug
------------------------------
Date: Wed, 24 Sep 97 06:49:29 GMT
From: arclight@io.com (Bob Apthorpe)
Subject: Re: Beginner's question : Perl or Java ?
Message-Id: <60ad5v$86m$1@news.jumpnet.com>
>>> Example : I want to get the HTML source of a
>>> Web page every night at 8:00 pm. The name of the file is a function of
>>> the date of the day, say "http://foo/19970815.html" for the file on
>>> August 15. After that, I will locally process the file to extract some
>>> patterns to send them to a Scheme program. Is the Perl program *much*
>>> simpler than the corresponding Java one, or are they about the same size?
>
>Tom> I'm only now learning Java (having been lured to the dark side of the
>Tom> Force) so I can't say with certainty, but I'd guess the Java code is
>Tom> longer than this.
>
>'especially if you do it right, and shorter:
>
> use LWP::Simple;
> my ($d,$m,$y) = (localtime)[3..5];
> my $url = sprintf "http://foo/%04d%02d%02d.html",
> $y + 1900, $m + 1, $d;
> getprint $url or die "Problem getting $url";
My $US 0.02:
use LWP::Simple;
use Date::Manip;
my $url = 'http://foo/' . UnixDate("%Q", now) . '.html';
getprint $url or die "Problem getting $url";
Slower, shorter, possibly clearer and (of course) untested...
Have fun!
Bob
------------------------------
Date: Wed, 24 Sep 1997 09:22:13 GMT
From: darrenh@efn.org (Darren Hayes)
Subject: CGI/Perl: Appending Two Associative Arrays
Message-Id: <3428db58.719509734@news.efn.org>
Hello,
I have a CGI script setup to read in and parse info from an html form
then sendmail the form results. I am using Brenner's cgi-lib.pl Perl
library and &ReadParse routine to read in the form data into an
associative array. Everything is working well. Now I wish to redesign
the form so that we can have a second form page then after both
form pages have been submitted we can glue all the resulting data
together for further processing.
To be more specific, after a user "submits" the contents of
the first form and the CGI calls &ReadParse whic results in a
returned associative array. Then I do a test on the returned array to
find out if I want to do a conditional branch and render an
additional html form page. If the answer is yes a second form is
rendered which the user fills out then submits.
My question: Is there an easy way to "append" the data from the
associative array returned from the second forms &ReadParse CGI
call to the data sitting in the associative array returned from the
&ReadParse CGI for the first form?
For examples sake the data from form1 would be returned by:
&ReadParse(*form1_data);
And the data from form2 would be returned by:
&ReadParse(*form2_data);
Can I easily "append" the data sitting in %form_data2 to
the end of %form_data1 and keep the keys/values in order.
Would the following do the job?
%form_data2.=%form_data1
I hope this is clear ;-) This newbie appreciates any and all
feedback. Please email if you can as my ISP's news server hiccups
alot. Thanks.
Darren
darrenh@efn.org
------------------------------
Date: Wed, 24 Sep 1997 04:29:06 +0200
From: Juan Carlos del Rio <jcarlosd@ford.com>
Subject: Re: Change /etc/passwd
Message-Id: <34287AF2.539@ford.com>
Jeremy D. Zawodny wrote:
> >> >Is there any perl function or routine that can send the password
> >> >parameters (user, old password, new password) to the passwd command?
> >>
> >> The simplest way to do this from a language perspective is to use expect
> >> see http://expect.nist.gov.
> >
> You're suggesting that one use the HTTPD module to change Unix system
> passwords? I must have missed something...
Yes that is correct. I am trying to work with expect, as J Gloudon
suggested. It seems like working in other environments, though I was not
able yet to make it work on HP-UX 10.20 and running the /etc/passwd
command. I think it can be useful for an Intranet and for changing a
password in a system people never access by telnet.
------------------------------
Date: Wed, 24 Sep 1997 09:02:04 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Getting next array element in a foreach
Message-Id: <342bceaf.2684788@news.tornado.be>
Gip <nospam.gibsonc@aztec.asu.edu> wrote:
># assume for this ex that the @array contains b d h t
>foreach $item (@array) {
> if ($item eq "d") {
> # the next line is where my problem is; I want the next item 'h'!
> $next_item = ??? ; # I've tried shift unshift pop push
> $last;
> }
>}
How about setting a flag:
$flag=0;
foreach $item (@array) {
if ($flag) {
#got it!
}
$flag = $item eq 'd';
}
Bart.
------------------------------
Date: 24 Sep 1997 07:37:18 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: help for user authentication
Message-Id: <h7mc71ddc.fsf@bergen.sn.no>
comdog@computerdog.com (brian d foy) writes:
> #!/usr/bin/perl
>
> print <<'HTTP';
> Status: 401 Authentication Required
> Host: computerdog.com
> Content-type: text/plain
>
> Authentication is required to access this resource
> HTTP
>
> __END__
>
> of course, you'll need to handle the response yourself, but that's
> the point, isn't it ;)
Handling the response in a CGI script is usually impossible, because
most servers does not pass on the WWW-Authenticate header in the
environment. Something to do with security.
--
Gisle Aas <aas@sn.no>
------------------------------
Date: Wed, 24 Sep 1997 09:01:29 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Help, Why doesn't this work?!
Message-Id: <342dd6bd.4747277@news.tornado.be>
bbrown2@lindy.stanford.edu wrote:
>print "Rfile: $rpath$file\n";
>
>$ftp->get("$fullfile", "$rpath$file");
>
>
>The Path Values all print out OK, the directory is properly created,
>but I never get a file saved.
If $rpath doesn't end in a slash, you'll probably need an extra slash
between $rpath and $file. That is, if a slash is the directory separator
on your system.
HTH,
Bart.
------------------------------
Date: Tue, 23 Sep 1997 16:54:56 -0500
From: Rohit Basu <rohit@techapp.com>
Subject: Indentation program
Message-Id: <34283AB0.37B8@techapp.com>
Does anyone know abt existing utility that can indent
perl scripts ...
Pls respond by mail if u have any clues
thanks a lot in advance
- Rohit
--
Rohit Basu <rohit@techapp.com>
Technology Applications , Inc. Tel: 314-916-7058(W),
Weldon Springs, M0-63304. USA 314-532-9810(R)
------------------------------
Date: Wed, 24 Sep 1997 06:24:10 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Installing Perl modules w/o root?
Message-Id: <q8ta06.ul.ln@localhost>
peter@widgetworks.com wrote:
: Tad McClellan <tadmc@flash.net> wrote:
: > Perl FAQ, part 8:
: > "How do I keep my own module/library directory?"
: >
: > Guess you missed that when you checked before posting...
: Yup. I sure did. I never would have though to find it in a section
: described as "Interprocess communication (IPC), control over the
: user-interface (keyboard, screen and pointing devices)."
grep module *.pod
finds too many matches to deal with.
I want to search only the 'headings':
cd /dir/where/pods/are
grep '^=' *.pod >eq_lines
grep module eq_lines
;-)
I word search in eq_lines pretty much every day...
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 24 Sep 1997 12:02:24 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Is Perl Year2000 compliant?
Message-Id: <3428E530.50AB68AD@absyss.fr>
Fridiric GILLES wrote:
>
> Everybody heard about the Year2000 problem (this problem when the 2
> digits-coded year passes from 99 to 00). We can ask a question :
>
> Are Perl and all its modules Year2000 compliant?
>
> Does someone work on this problem?
> What are the tests to prove the compliance?
> If they are not compliant, when will the compliant version be released?
Frid,
Did you ever consider looking at the FAQ? Did you honestly think you
were the only person who had ever thought to ask this question? Have
you ever used a FAQ for any reason? Do you even know what a FAQ is?
- doug
hint: "perldoc perlfaq4". If you don't have a properly installed
version of Perl, go to http://www.perl.com/ and look around a bit.
------------------------------
Date: 24 Sep 1997 05:22:32 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: perl mail on solaris
Message-Id: <memo.19970924062231.21497A@skep.compulink.co.uk.cix.co.uk>
In article <comdog-ya02408000R2309972130510001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
> In article <609jac$5d2@camel2.mindspring.com>, jaws@atl.mindspring.com w
> rote:
>
>
> >#usr/local/bin/perl
> >
> >my $Mailto="jaws@mindspring.com";
> >my $MailSubject="test email";
> >
> >open (DOMAIL, "| mail -s $MailSubject $Mailto");
> >print DOMAIL <<"EndOfMessage";
> >
> >this is a test
> >EndOfMessage
> >
> >The operating system things $MailSubject is another recipient...
>
> especially since you have that embedded space in $MailSubject.
>
The quick solution to this is to use
open (DOMAIL, "| mail -s \"${MailSubject}\" $Mailto");
> how about using sendmail instead:
>
[snip]
Use the quick and convenient mailtools modules these days. Speak SMTP
natively. You'll be glad you did. ;-))
Regards
Neil
------------------------------
Date: Wed, 24 Sep 1997 19:21:31 +1000
From: "Andrew Pollock" <apollock@bit.net.au>
Subject: Perl on the end of a named pipe?
Message-Id: <60am2r$g02$1@hermes.bit.net.au>
This might be a bit of a dumb question, probably more a poorly worded one...
Is it possible to run Perl on the end of a named pipe, so that the
interpreter is always running, rather than firing it up all the time?
The reason I ask is because I've got a Linux box which runs countless Perl
scripts, many from cron, and it's starting to feel it when it goes to load
such a large binary at the drop of a hat.
Just a thought....
Andrew
----
Andrew Pollock Programmer/System Administrator
apollock@bit.net.au http://staff.bit.net.au/apollock
Brisbane Internet Technology Pty Ltd.
------------------------------
Date: Wed, 24 Sep 1997 11:48:44 +0100
From: the joshman <joshua@mongoose.demon.co.uk>
Subject: Q: Getting user input without pausing
Message-Id: <3428F00C.9F17ADBA@mongoose.demon.co.uk>
How do I get input such as $foo = <STDIN> without the
program pausing? This problem may be even worse for me
as I am using Win95. Hopefully any solution will also
apply to sockets.
Thanks!
------------------------------
Date: Wed, 24 Sep 1997 11:54:23 +0200
From: Benarson Behajaina <Benarson.Behajaina@swh.sk>
Subject: require 'sys/socket.ph'
Message-Id: <3428E34F.D2D8E9D7@swh.sk>
I'm running Perl version 5.004_01 on Solaris 2.5.
I couldn't run the following script (cache-compare.pl) :
#!/usr/local/bin/perl
require 'sys/socket.ph'
...
Running this script:
prompt% cache-compare.pl
Can't locate sys/socket.ph in @INC (did you run h2ph?)
So my question is: where can I find this socket.ph ?
Benarson.
------------------------------
Date: Wed, 24 Sep 1997 08:37:55 -0400
From: Thad Welch <tw36027@glaxowellcome.com>
To: Benarson Behajaina <Benarson.Behajaina@swh.sk>
Subject: Re: require 'sys/socket.ph'
Message-Id: <342909A3.DAE35C9E@glaxowellcome.com>
try
require "sys/socket.ph";
Benarson Behajaina wrote:
> I'm running Perl version 5.004_01 on Solaris 2.5.
> I couldn't run the following script (cache-compare.pl) :
>
> #!/usr/local/bin/perl
> require 'sys/socket.ph'
> ...
>
> Running this script:
> prompt% cache-compare.pl
> Can't locate sys/socket.ph in @INC (did you run h2ph?)
>
> So my question is: where can I find this socket.ph ?
>
> Benarson.
------------------------------
Date: 24 Sep 1997 00:08:50 -0700
From: cubranic@cs.ubc.ca (Davor Cubranic)
Subject: Re: setsockopt (solving 'address already in use' error)
Message-Id: <60aea2$3aa@cascade.cs.ubc.ca>
Trudno zhit' v derevne bez nagana. (alex@kawo2.rwth-aachen.de) wrote:
: And what is the difference between PF_INET and AF_INET,
: they are all 2 at my Linux-PC. Why was PF_INET introduced?
:
Right now, none. They both have same values, as far as I know. PF_INET stands
for protocol family Internet, AF_INET for address family, I think. PF_INET
should really be used in socket() system call, AF_INET in sockAddr structure.
Davor
------------------------------
Date: 24 Sep 1997 07:39:41 +0200
From: Gisle Aas <aas@bergen.sn.no>
Subject: Re: Simulating POST method w/ PERL.
Message-Id: <h67rr1d9e.fsf@bergen.sn.no>
Byron Stuart <byron@teleport.com> writes:
> browser. I have no idea where to begin. I've looked at the LWP
> lib, but can't figure out how to simulate a POST method, and send
> the "form" to the server. Any help would be great.
You did not look close enough. lwpcook says:
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = new LWP::UserAgent;
my $req = POST 'http://www.perl.com/cgi-bin/BugGlimpse',
[ search => 'www', errors => 0 ];
print $ua->request($req)->as_string;
--
Gisle Aas <aas@sn.no>
------------------------------
Date: 24 Sep 1997 03:35:08 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: Simulating POST method w/ PERL.
Message-Id: <60a1pc$g2l$1@comdyn.comdyn.com.au>
In article <342870B1.1635A9A4@teleport.com>,
Byron Stuart <byron@teleport.com> writes:
> I can't figure this out... I need to write a PERL script that
> connects to a web site CGI script. I need the PERL script to
> send a request to the web server's CGI script exactly like an
> HTML form using the POST method would. So, the web server's CGI
> script will respond back to me as if I were using a normal web
> browser. I have no idea where to begin. I've looked at the LWP
> lib, but can't figure out how to simulate a POST method, and send
> the "form" to the server. Any help would be great.
In the original distribution of the libwww package, look in the t/net
directory for the file http-post.t for an example.
also look at the included script lwp-request.
furthermore, after installation of LWP:
perldoc lwp
will give you a help page, which includes a POST request example.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 24 Sep 1997 03:45:44 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: Text::English
Message-Id: <60a2d8$g2l$2@comdyn.comdyn.com.au>
In article <gene-ya02408000R2309971623320001@corp.supernews.com>,
gene@moreinfo.com (Gene Hsu) writes:
> Does anyone know where to find this module? I haven't been able to find
> it in CPAN, though it's mentioned (barely) in one of the author lists.
> I'd like to get it so I can try out some of the Information Retrieval stuff
> from the perl journal.
from the modules list on CPAN:
Text::
::English adpf English language stemming IANPX
adfp means: alpha release, developer support, perl only, plain functions.
If you can't find it on CPAN, you should probably contact the developer:
IANPX (not posting his email here, because he might end up on spam
lists. You can undoubtedly click on the link on the modules page to
find out.)
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Wed, 24 Sep 1997 13:33:02 +0200
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Unlink syntax
Message-Id: <3428FA6E.2781@theo.phy.uni-bayreuth.de>
Hi,
wazza wrote:
>
> Thanks to those who promptly answered my query on how to delete files.
>
> I tried out the lines:
> $file = $path."temp.txt";
> unlink $file;
>
> but nothing seems to be happening. Could someone assist me with the
> correct syntax please.
The syntax in your example is correct. There must be some other
problem. Maybe you should insert a 'print $file' in your script
to check, if $file contains the desired file name. You could
also do a 'system("ls $file")' to check if the file really exists
(and the path is correct).
Bye, Eike
--
======================================================================
Eike Grote, Theoretical Physics IV, University of Bayreuth, Germany
----------------------------------------------------------------------
e-mail -> eike.grote@theo.phy.uni-bayreuth.de
WWW -> http://www.phy.uni-bayreuth.de/theo/tp4/members/grote.html
http://www.phy.uni-bayreuth.de/~btpa25/
======================================================================
------------------------------
Date: Wed, 24 Sep 1997 18:47:56 +1000
From: wazza <womlake@zip.com.au>
Subject: Unlist syntax
Message-Id: <3428D3BC.1636@zip.com.au>
Thanks to those who promptly answered my query on how to delete files.
I tried out the lines:
$file = $path."temp.txt";
unlink $file;
but nothing seems to be happening. Could someone assist me with the
correct syntax please.
Warren
------------------------------
Date: Wed, 24 Sep 1997 06:29:02 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Unlist syntax
Message-Id: <uhta06.ul.ln@localhost>
wazza (womlake@zip.com.au) wrote:
: Thanks to those who promptly answered my query on how to delete files.
: I tried out the lines:
: $file = $path."temp.txt";
: unlink $file;
Does $path end with a slash?
if not, then you may want:
unlink "$path/temp.txt"; # no need to put it into $file first
: but nothing seems to be happening. Could someone assist me with the
: correct syntax please.
Here is the correct syntax:
unlink $file or die "could not unlink '$file' $!";
;-)
--
Tad McClellan SGML Consulting
tadmc@flash.net Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 24 Sep 1997 09:37:33 +0200
From: "Fridiric GILLES" <gilles@tls-cats.sps.mot.com>
Subject: week-of-the-year calculation
Message-Id: <3428C33D.90766FFB@tls-cats.sps.mot.com>
--------------E874BB127E88742A87CDF443
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
In Perl FAQ related to dates:
> use Time::localtime;
> $day_of_year = localtime(time())->yday;
>
> You can find the week of the year by dividing this by 7:
>
> $week_of_year = int($day_of_year / 7);
>
> Of course, this believes that weeks start at zero.
>
The week-of-the-year calculation is not true because the week is not
supposed to begin with a Monday!
Here is the right calculation:
($wday,$yday)=(localtime)[6,7];
$wday=7 if $wday==0; # to make Sunday the last day of the week
$week=int(($yday-$wday)/7 + 2);
Frederic GILLES
--------------E874BB127E88742A87CDF443
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<HTML>
In Perl FAQ related to dates:
<BLOCKQUOTE TYPE=CITE>
<PRE> use Time::localtime;
$day_of_year = localtime(time())->yday;
You can find the week of the year by dividing this by 7:
$week_of_year = int($day_of_year / 7);
Of course, this believes that weeks start at zero.</PRE>
</BLOCKQUOTE>
<P>The week-of-the-year calculation is not true because the week is not
supposed to begin with a Monday!
<BR>Here is the right calculation:
<P>($wday,$yday)=(localtime)[6,7];
<BR>$wday=7 if $wday==0; # to make Sunday the last day of the week
<BR>$week=int(($yday-$wday)/7 + 2);
<P>Frederic GILLES
<BR> </HTML>
--------------E874BB127E88742A87CDF443--
------------------------------
Date: Tue, 23 Sep 1997 15:07:29 +0200
From: "Mattias Lvnnqvist" <mattias.lonnqvist@-NO-SPAM-.uidesign.se>
To: han@dataprompt.com
Subject: Re: Where is perl/Tk for Win32
Message-Id: <3427BF11.AEFF63FA@-NO-SPAM-.uidesign.se>
Weihan Chang wrote:
> Hi,
> I saw someone mentioned about a version of perl/Tk on Win32(Windows
> NT). Does anyone know where I can get a binary copy ?
> Thanks a lot.
CPAN. Non native ports. Or if you prefer an ftp-link directly, try
"ftp://ftp.sunet.se/pub/lang/perl/CPAN/ports/win32/Standard/x86/perl5.00402-bindist04-bc.tar.gz"
/Mattias
--
Mattias Lonnqvist * M.Sc. * Software consultant * Remove -NO-SPAM-
from email adress to reply. * no mail-to: link here, sorry.
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.uidesign.se/~malo/mail.html> for more info.
------------------------------
Date: 24 Sep 1997 10:29:43 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Writing xBase (dBase) files
Message-Id: <60aq2n$p75@news.nl.compuware.com>
Does someone have an alternative for writing xBase files ?
The module on CPAN is old and it is read-only.
-----------------------------------------------------------------------
Koos Pol P.O Box 12933
PC Systems Admin 1100 AX Amsterdam
Compuware Europe tel: +31 20 3116122
Koos_Pol@nl.compuware.com
-----------------------------------------------------------------------
------------------------------
Date: Wed, 24 Sep 1997 13:28:39 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Writing xBase (dBase) files
Message-Id: <3428F967.441E9F5F@absyss.fr>
[posted, NOT mailed due to munged address]
Koos Pol wrote:
>
> Does someone have an alternative for writing xBase files ?
> The module on CPAN is old and it is read-only.
I once started a writable xBase module, but I never did the .cdx files,
so things got corrupted kinda quickly. Someone with a .cr (costa rica?)
address was asking about it two months ago, so I gave him my files.
Maybe you can use DejaNews to find out who it was and get in touch with
him.
Good luck.
- doug
------------------------------
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 1070
**************************************