From 881fc0d93da00b84ff94c3db066789c1fc271e39 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Fri, 11 Mar 2011 21:41:53 -0700 Subject: [PATCH] Logging now works with custom PREFIX installs. \o/ --- lib/API/Log.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/API/Log.pm b/lib/API/Log.pm index b81890a..51b27c5 100644 --- a/lib/API/Log.pm +++ b/lib/API/Log.pm @@ -56,12 +56,12 @@ sub alog my $time = POSIX::strftime('%Y-%m-%d %I:%M:%S %p', localtime); # Create var/ if it doesn't exist. - if (!-d "$Auto::Bin/../var") { - mkdir "$Auto::Bin/../var", 0600; ## no critic qw(ValuesAndExpressions::ProhibitMagicNumbers) + if (!-d "$Auto::bin{var}") { + mkdir "$Auto::bin{var}", 0600; ## no critic qw(ValuesAndExpressions::ProhibitMagicNumbers) } # Open the logfile, print the log message to it and close it. - open my $FLOG, '>>', "$Auto::Bin/../var/$date.log" or return; + open my $FLOG, '>>', "$Auto::bin{var}/$date.log" or return; print {$FLOG} "[$time] $lmsg\n" or return; close $FLOG or return; @@ -85,7 +85,7 @@ sub expire_logs } # Iterate through each logfile. - foreach my $file (glob fpfmt("$Auto::Bin/../var/*")) { + foreach my $file (glob fpfmt("$Auto::bin{var}/*")) { my (undef, $file) = split 'bin/../var/', $file; ## no critic qw(BuiltinFunctions::ProhibitStringySplit) # Convert filename to UNIX time. @@ -97,7 +97,7 @@ sub expire_logs # If it's older than days, delete it. if (time - $epoch > 86_400 * $celog) { ## no critic qw(ValuesAndExpressions::ProhibitMagicNumbers) - unlink "$Auto::Bin/../var/$file"; + unlink "$Auto::bin{var}/$file"; } }