From: Don Armstrong Date: Sun, 11 Dec 2016 20:21:39 +0000 (-0800) Subject: fix basename X-Git-Url: https://git.donarmstrong.com/?p=catcam.git;a=commitdiff_plain;h=HEAD fix basename --- diff --git a/index.cgi b/index.cgi index 7035f47..d357012 100755 --- a/index.cgi +++ b/index.cgi @@ -6,10 +6,12 @@ use strict; use CGI::Simple; use File::Find; use File::stat; +use File::Basename qw(dirname); +use POSIX; my $q = CGI::Simple->new({num=>100}); -my $cat_dir = '/home/don/debian/.cat/'; +my $cat_dir = dirname($ENV{SCRIPT_FILENAME}); my %pics; @@ -37,10 +39,10 @@ EOF my $num = 0; my $previous_date = ''; for my $pic (sort {$pics{$b}->ctime <=> $pics{$a}->ctime} keys %pics) { - my $this_date = POSIX::strftime('%Y-%m-%d',time($pics{$pic}->ctime)); + my $this_date = POSIX::strftime('%Y-%m-%d',localtime($pics{$pic}->ctime())); if ($previous_date ne $this_date){ print "

$this_date

\n"; - $this_date = $previous_date; + $previous_date = $this_date; } my $basename = $pic; $basename =~ s/\.html//;