Should have copied the attached to the list.
Hope the attached patches are useful to others.
---------------------------------------------------------
This communication may not represent my employer's
views,
if any, on the matters discussed.
-----Original Message-----
From: tlhackque
Sent: Saturday, January 05, 2008 18:20
To: Brian Cassidy
Subject: RE: [rt.cpan.org #30317] IfModified parse
problem - and some other
bug fixes
I apologize for the VERY late response; I was swamped
for a while & then the
afflicted system was unavailable & the user went
away...
Yes, this fixes the problem. Many thanks.
In testing this, I also noticed another couple of
divots.
1) When there are any directories containing no
images in the
photo_dir tree, things get very confused. You assume
that the gallery stack
has an entry for the top level, but fail to push it if
it's empty. Things
go badly down hill as you pop something else.
2) You return files (and galleries) in the filesystem
order. People
expect some predictable order. Best to sort.
Patches for these are below, applied in the attached
.tar file. Also, my
previous patch, which allows one to set a maximum size
for a displayed
image.
Hope these are useful.
Apologies again for being soo slow.
T
diff
CGI-Application-PhotoGallery-0.08/lib/CGI/Application/PhotoGallery.pm
PhotoGallery.pm
159c159
< our $VERSION = '0.08';
---
> our $VERSION = '0.08t';
306c306,310
< my @dirs =
File::Find::Rule->directory->maxdepth( 1 )->in(
$directory
);
---
> die( "$directory is not a directory" ) unless -d
$directory;
>
> my @dirs = File::Find::Rule->directory ->
mindepth( 1 )
> ->
maxdepth( 1 )->in( $directory
);
> @dirs = sort @dirs;
309c313
< for my $dir ( @dirs ) {
---
> for my $dir ( $directory, @dirs ) {
311c315
< $self->get_photos( $dir );
---
> $self->get_photos( $dir );
313c317,318
< if ( $dir ne $dirs[ 0 ] ) {
---
> @files = sort { $$a{filename} cmp
$$b{filename} } @files;
> if ( $dir ne $directory ) {
319c324
< {
---
> {
324c329
< if @files;
---
> if @files || ($dir eq $directory);
473a479,488
> if( defined $self->param( 'max_width' ) ) {
> my $max_width = $self->param( 'max_width' );
>
> if( $width > $max_width ) {
> my $scale = $max_width / $width;
> $width = int($width * $scale);
> $height = int($height * $scale);
> }
> }
>
---------------------------------------------------------
This communication may not represent my employer's
views, if any, on the
matters discussed.
-----Original Message-----
From: Brian Cassidy [mailto:brian.cassidy@gmail.com]
Sent: Monday, October 29, 2007 22:11
To: tlhackque@yahoo.com
Subject: Re: [rt.cpan.org #30317] IfModified parse
problem
On 10/28/07, via RT
<bug-CGI-Application-PhotoGallery@rt.cpan.org> wrote:
> Logs errors trying to check thumbnail cache
modification date. Seems
> to hit all files; extracted just one below for
brevity
>
> apache error log:
> [Sun Oct 28 10:50:54 2007] [error] [client
192.168.148.108] Argument
> "Thu, 01 Jan 1970 00:00:00 GMT; length=2051" isn't
numeric in numeric
> eq (==) at
>
/usr/lib/perl5/site_perl/5.8.8/CGI/Application/PhotoGallery.pm
line
Ah, it must be my non-parsing of HTTP dates coming
back to bite me.
Attached is a potential fix that uses HTTP::Date. Can
you test it out for
me?
-Brian