52 lines
1.4 KiB
Perl
52 lines
1.4 KiB
Perl
# Selima Website Content Management System
|
|
# CopyYear.pm: The copyright year text generator.
|
|
|
|
# Copyright (c) 2004-2018 imacat.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# Author: imacat <imacat@mail.imacat.idv.tw>
|
|
# First written: 2004-10-17
|
|
|
|
package Selima::CopyYear;
|
|
use 5.008;
|
|
use strict;
|
|
use warnings;
|
|
use base qw(Exporter);
|
|
use vars qw(@EXPORT @EXPORT_OK);
|
|
BEGIN {
|
|
@EXPORT = qw(copyyear);
|
|
@EXPORT_OK = @EXPORT;
|
|
# Prototype declaration
|
|
sub copyyear($);
|
|
}
|
|
|
|
use Selima::Cache qw(:copyyear);
|
|
use Selima::DataVars qw(:proctime);
|
|
|
|
# copyyear: Return the copyright year
|
|
sub copyyear($) {
|
|
local ($_, %_);
|
|
my ($startyear, $thisyear);
|
|
$startyear = $_[0];
|
|
# Return the cache
|
|
return $CopyYear_copyyear if defined $CopyYear_copyyear;
|
|
$thisyear = (localtime $T_START)[5] + 1900;
|
|
$CopyYear_copyyear = $startyear;
|
|
$CopyYear_copyyear .= "-" . $thisyear
|
|
if $thisyear != $startyear;
|
|
return $CopyYear_copyyear;
|
|
}
|
|
|
|
return 1;
|