Bug 17600: Standardize our EXPORT_OK
[srvgit] / Koha / Util / FrameworkPlugin.pm
1 package Koha::Util::FrameworkPlugin;
2
3 # Module contains subroutines used in the framework plugins
4 #
5 # Copyright 2014 Koha Development Team
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
21 #
22
23 use Modern::Perl;
24
25 our ( @ISA, @EXPORT_OK );
26 BEGIN {
27     require Exporter;
28     @ISA = qw( Exporter );
29     @EXPORT_OK = qw( wrapper date_entered );
30 }
31
32 =head1 NAME
33
34 Koha::Util::FrameworkPlugin - utility class with routines for framework plugins
35
36 =head1 FUNCTIONS
37
38 =head2 wrapper
39
40     wrapper returns a text for strings containing spaces, pipe chars, ...
41     The wrapper subroutine is used in several UNIMARC plugins.
42
43 =cut
44
45 sub wrapper {
46     my ( $str ) = @_;
47     return "space" if $str eq " ";
48     return "dblspace" if $str eq "  ";
49     return "pipe" if $str eq "|";
50     return "dblpipe" if $str eq "||";
51     return $str;
52 }
53
54 =head2 date_entered
55
56     date_entered returns date in yymmdd format as needed by MARC21 field 008
57
58 =cut
59
60 sub date_entered {
61     # find today's date
62     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
63     $year +=1900;
64     $mon +=1;
65     return substr($year,2,2).sprintf ("%0.2d", $mon).sprintf ("%0.2d",$mday);
66 }
67
68 1;