cvs commit: perlfaq perlfaq4.pod

[email protected] 14 Feb 2005 18:24:02 -0000
Newsgroups perl.cvs.perlfaq
Message-ID <[email protected]>
cvsuser     05/02/14 10:24:01

  Modified:    .        perlfaq4.pod
  Log:
  * How can I find the Julian Day?
  
  	* I pared down the answer.  I'm not a big calendar
  	calculating type of person, but I found the last paragraph
  	confusing.  I'm guessing that it's correct, but I don't
  	think it really helps someone who doesn't know about
  	calenders or Julian days already. I distilled David's
  	suggestions into a couple of sentences.
  
  	*  Instead of discussing julian days, I punted to an
  	external discussion which seems clear and complete, and
  	includes examples of calculations involving julian days.
  
  	* Dave Cross added the one-liners using DateTime
  
  * How do I find the soundex value of a string?
  
  	* I started modifiying this answer because it's not Knuth's
  	algorithm.  I thought this was odd, but Knuth credits Odell
  	and Russell in "Sorting and Searching".
  
  	* I've run into several answers that seem to say "You don't
  	really want to do that" without any idea why someone is
  	asking the question, then giving a half-hearted explanation
  	of what they don't want to do.
  
  	* I shortened the answer to simply point out the two modules
  	that the answer recommends. If someone wants to use
  	Text::Soundex, they are going to see how it works when they
  	reads its documentation or sees its output.
  
  Revision  Changes    Path
  1.60      +28 -28    perlfaq/perlfaq4.pod
  
  Index: perlfaq4.pod
  ===================================================================
  RCS file: /cvs/public/perlfaq/perlfaq4.pod,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- perlfaq4.pod	19 Jan 2005 16:09:31 -0000	1.59
  +++ perlfaq4.pod	14 Feb 2005 18:24:01 -0000	1.60
  @@ -1,6 +1,6 @@
   =head1 NAME
   
  -perlfaq4 - Data Manipulation ($Revision: 1.59 $, $Date: 2005/01/19 16:09:31 $)
  +perlfaq4 - Data Manipulation ($Revision: 1.60 $, $Date: 2005/02/14 18:24:01 $)
   
   =head1 DESCRIPTION
   
  @@ -454,26 +454,29 @@
   
   =head2 How can I find the Julian Day?
   
  -Use the Time::JulianDay module (part of the Time-modules bundle
  -available from CPAN.)
  +(contributed by brian d foy and Dave Cross)
   
  -Before you immerse yourself too deeply in this, be sure to verify that
  -it is the I<Julian> Day you really want.  Are you interested in a way
  -of getting serial days so that you just can tell how many days they
  -are apart or so that you can do also other date arithmetic?  If you
  -are interested in performing date arithmetic, this can be done using
  -modules Date::Manip or Date::Calc.
  -
  -There is too many details and much confusion on this issue to cover in
  -this FAQ, but the term is applied (correctly) to a calendar now
  -supplanted by the Gregorian Calendar, with the Julian Calendar failing
  -to adjust properly for leap years on centennial years (among other
  -annoyances).  The term is also used (incorrectly) to mean: [1] days in
  -the Gregorian Calendar; and [2] days since a particular starting time
  -or `epoch', usually 1970 in the Unix world and 1980 in the
  -MS-DOS/Windows world.  If you find that it is not the first meaning
  -that you really want, then check out the Date::Manip and Date::Calc
  -modules.  (Thanks to David Cassell for most of this text.)
  +You can use the Time::JulianDay module available on CPAN.  Ensure that
  +you really want to find a Julian day, though, as many people have
  +different ideas about Julian days.  See
  +http://www.hermetic.ch/cal_stud/jdn.htm for instance.
  +
  +You can also try the DateTime module, which can convert a date/time
  +to a Julian Day.
  +
  +  $ perl -MDateTime -le'print DateTime->today->jd'
  +  2453401.5
  +
  +Or the modified Julian Day
  +
  +  $ perl -MDateTime -le'print DateTime->today->mjd'
  +  53401
  +
  +Or even the day of the year (which is what some people think of as a
  +Julian day)
  +
  +  $ perl -MDateTime -le'print DateTime->today->doy'
  +  31
   
   =head2 How do I find yesterday's date?
   
  @@ -935,14 +938,11 @@
   
   =head2 How do I find the soundex value of a string?
   
  -Use the standard Text::Soundex module distributed with Perl.
  -Before you do so, you may want to determine whether `soundex' is in
  -fact what you think it is.  Knuth's soundex algorithm compresses words
  -into a small space, and so it does not necessarily distinguish between
  -two words which you might want to appear separately.  For example, the
  -last names `Knuth' and `Kant' are both mapped to the soundex code K530.
  -If Text::Soundex does not do what you are looking for, you might want
  -to consider the String::Approx module available at CPAN.
  +(contributed by brian d foy)
  +
  +You can use the Text::Soundex module. If you want to do fuzzy or close
  +matching, you might also try the String::Approx, and Text::Metaphone,
  +and Text::DoubleMetaphone modules.
   
   =head2 How can I expand variables in text strings?