[Catalyst] Catalyst::Helper passes %T to POSIX::strftime - causes infinite loop under Win32

bits bits_catalyst at itools.com
Tue Jul 17 17:32:48 GMT 2007


Catalyst::Helper::_mk_changes calls POSIX::strftime on line 390:
    my $time = strftime('%Y-%m-%d %T', localtime time);

the %T parameter causes my Activestate Perl 5.8.8 820 to infinite loop.  


In fact,
   perl -MPOSIX -e "print POSIX::strftime('%T', localtime time);"
also infinite loops.

Nice.  


The perldoc for POSIX states in the strftime notes:
"If you want your code to be portable, your format (fmt ) argument should
use only the conversion specifiers defined by the ANSI C standard (C89, to
play safe). These are aAbBcdHIjmMpSUwWxXyYZ% ."

%T is not in the list.  On all the systems I have at my disposal, %H:%M:%S
produces equivalent output and uses only the conversion specifiers they
recommend.


For the sake of saving the next soul who wants to use Catalyst under Win32,
which apparently doesn't like %T, suggest changing to:

    my $time = strftime('%Y-%m-%d %H:%M:%S', localtime time);



--- Helper.pm   Wed Jul 11 03:24:55 2007
+++ Helper.pm.orig      Mon Oct 30 18:00:42 2006
@@ -387,7 +387,7 @@
 sub _mk_changes {
     my $self = shift;
     my $dir  = $self->{dir};
-    my $time = strftime('%Y-%m-%d %H:%M:%S', localtime time);
+    my $time = strftime('%Y-%m-%d %T', localtime time);
     $self->render_file( 'changes', "$dir\/Changes", { time => $time } );
 }




More information about the Catalyst mailing list