On 2007-05-06 17:33:51 -0400, Guy Hulbert wrote:
> On Sun, 2007-05-06 at 23:10 +0200, Peter J. Holzer wrote:
> > How about doing something like this
> >
> > sub rfc822_date {
> > my ($t) = @_;
> > if (strftime("%a %b %z", gmtime(0)) ~= m/Thu Jan [-+]\d{4}$/) {
> > # strftime works as expected, so use that
> > return strftime("...", localtime($t));
>
> Why would you check this every time you want to compute a date ?
>
> Just check once during 'make test'. If it were a GNU package and not
> perl, the check would be done during ./configure.
The environment isn't necessarily the same during "make test" and
runtime. An extreme case is an RPM or Debian package: The make test is
run on the packagers machine, and then the package is installed on lots
of different machines with different environments.
So, if this is tested at all (and not just written into the
documentation), it should be tested at least once before it is used. But
as I wrote in the next paragraph, it doesn't have to be tested each time
rfc822_date is called - the result can be cached.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | [EMAIL PROTECTED] |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
signature.asc
Description: Digital signature
