Bug 5549 : Allow hourly loans to be indicated in the loan rules
[koha.git] / C4 / TmplTokenType.pm
blobfc674b57ab36656f3597a90b08f3fdccbeb3569a
1 package C4::TmplTokenType;
3 use strict;
4 #use warnings; FIXME - Bug 2505
5 require Exporter;
7 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
9 ###############################################################################
11 =head1 NAME
13 C4::TmplTokenType.pm - Types of TmplToken objects
15 =head1 DESCRIPTION
17 This is a Java-style "safe enum" singleton class for types of TmplToken objects.
18 The predefined constants are
20 =cut
22 ###############################################################################
24 $VERSION = 0.01;
26 @ISA = qw(Exporter);
27 @EXPORT_OK = qw(
28 &TEXT
29 &TEXT_PARAMETRIZED
30 &CDATA
31 &TAG
32 &DECL
33 &PI
34 &DIRECTIVE
35 &COMMENT
36 &UNKNOWN
39 ###############################################################################
41 use vars qw( $_text $_text_parametrized $_cdata
42 $_tag $_decl $_pi $_directive $_comment $_null $_unknown );
44 BEGIN {
45 my $new = sub {
46 my $this = 'C4::TmplTokenType';#shift;
47 my $class = ref($this) || $this;
48 my $self = {};
49 bless $self, $class;
50 ($self->{'id'}, $self->{'name'}, $self->{'desc'}) = @_;
51 return $self;
53 $_text = &$new(0, 'TEXT');
54 $_text_parametrized = &$new(8, 'TEXT-PARAMETRIZED');
55 $_cdata = &$new(1, 'CDATA');
56 $_tag = &$new(2, 'TAG');
57 $_decl = &$new(3, 'DECL');
58 $_pi = &$new(4, 'PI');
59 $_directive = &$new(5, 'DIRECTIVE');
60 $_comment = &$new(6, 'COMMENT');
61 $_unknown = &$new(7, 'UNKNOWN');
64 sub to_string {
65 my $this = shift;
66 return $this->{'name'}
69 sub TEXT () { $_text }
70 sub TEXT_PARAMETRIZED () { $_text_parametrized }
71 sub CDATA () { $_cdata }
72 sub TAG () { $_tag }
73 sub DECL () { $_decl }
74 sub PI () { $_pi }
75 sub DIRECTIVE () { $_directive }
76 sub COMMENT () { $_comment }
77 sub UNKNOWN () { $_unknown }
79 ###############################################################################
81 =over
83 =item TEXT
85 normal text (#text in the DTD)
87 =item TEXT_PARAMETRIZED
89 parametrized normal text
90 (result of simple recognition of text interspersed with <TMPL_VAR> directives;
91 this has to be explicitly enabled in the scanner)
93 =item CDATA
95 normal text (CDATA in the DTD)
97 =item TAG
99 something that has the form of an HTML tag
101 =item DECL
103 something that has the form of an SGML declaration
105 =item PI
107 something that has the form of an SGML processing instruction
109 =item DIRECTIVE
111 a Template Toolkit directive
113 =item COMMENT
115 something that has the form of an HTML comment
116 (and is not recognized as an HTML::Template directive)
118 =item UNKNOWN
120 something that is not recognized at all by the scanner
122 =back
124 Note that end of file is currently represented by undef,
125 instead of a constant predefined by this module.
127 =cut