Allow trim to return the trimmed whitespace if the caller wants them.
[koha.git] / misc / translator / TmplToken.pm
1 package TmplToken;
2
3 use strict;
4 use TmplTokenType;
5 require Exporter;
6
7 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
8
9 ###############################################################################
10
11 =head1 NAME
12
13 TmplToken.pm - Object representing a scanner token for .tmpl files
14
15 =head1 DESCRIPTION
16
17 This is a class representing a token scanned from an HTML::Template .tmpl file.
18
19 =cut
20
21 ###############################################################################
22
23 $VERSION = 0.01;
24
25 @ISA = qw(Exporter);
26 @EXPORT_OK = qw();
27
28 ###############################################################################
29
30 sub new {
31     my $this = shift;
32     my $class = ref($this) || $this;
33     my $self = {};
34     bless $self, $class;
35     ($self->{'_string'}, $self->{'_type'}, $self->{'_lc'}, $self->{'_path'}) = @_;
36     return $self;
37 }
38
39 sub string {
40     my $this = shift;
41     return $this->{'_string'}
42 }
43
44 sub type {
45     my $this = shift;
46     return $this->{'_type'}
47 }
48
49 sub pathname {
50     my $this = shift;
51     return $this->{'_path'}
52 }
53
54 sub line_number {
55     my $this = shift;
56     return $this->{'_lc'}
57 }
58
59 sub attributes {
60     my $this = shift;
61     return $this->{'_attr'};
62 }
63
64 sub set_attributes {
65     my $this = shift;
66     $this->{'_attr'} = ref $_[0] eq 'HASH'? $_[0]: \@_;
67     return $this;
68 }
69
70 ###############################################################################
71
72 1;