Apache 1.3.12, mod_perl 1.24, Apache::SSI 2.13, Date::Format 2.08 I've had problems with date formats in Apache::SSI. The behaviour of mod_include is to apply the <!--#config timefmt='%d-%m-%Y'--> configuration directive to all date formats. Apache::SSI does not seem to be applying the format. Examining the code led me to think that the Date::Format module wasn't being loaded correctly so I added a use statement to the top of the code (since I use these functions all over the place, there seemed to be no benefit to delaying the include). Now Apache::SSI was throwing errors indicating that I was passing the the wrong datatype (wanted an array and not an array constructor). I fixed the _lastmod sub to provide the required array (see patch below). Then I found that <!--#echo var='DATE_LOCAL'--> didn't work either. Looking at the code again, a time format didn't seem to get passed. So I fixed up the echo_DATE_LOCAL sub to format the date. The patch below includes both these patches but my questions are: Is there something else wrong which I should fix before changing the code ? If the SSI.pm code does need to change, am I doing it the right way before finishing the other subs ? Regards, Simon Wilcox Williams Lea Group --- SSI.213 Sun Jun 4 06:29:53 2000 +++ SSI.pm Mon Aug 28 14:33:51 2000 @@ -6,6 +6,7 @@ use File::Basename; use HTML::SimpleParse; use Symbol; +use Date::Format; $VERSION = '2.13'; my $debug = 0; @@ -344,13 +345,26 @@ } elsif ( defined ($value = $self->{_r}->subprocess_env($var)) ) { return $value; } elsif (defined &{"echo_$var"}) { - return &{"echo_$var"}($self->{_r}); + return &{"echo_$var"}($self->{_r}, $self->{'timefmt'}); } return ''; } sub echo_DATE_GMT { scalar gmtime; } -sub echo_DATE_LOCAL { scalar localtime; } +sub echo_DATE_LOCAL { + if (defined $_[1]) { + unless (exists $INC{'Date/Format.pm'}) { + eval "use Date::Format"; + warn "Can't load Date::Format: $@" if $@; + return if $@; + } + my @time=localtime; + return strftime($_[1], @time); + } else { + return scalar localtime; + } +} + sub echo_DOCUMENT_NAME { my $r = _2main(shift); return &_set_VAR($r, 'DOCUMENT_NAME', basename $r->filename); @@ -436,7 +450,8 @@ warn "Can't load Date::Format: $@" if $@; return if $@; } - return strftime($_[1], [localtime( (stat $_[0])[9] )]); + my @time=localtime( (stat $_[0])[9] ); + return strftime($_[1], @time); } else { return scalar localtime( (stat $_[0])[9]); }