source: gs2-extensions/parallel-building/trunk/src/perllib/cpan/XML/XPath/Variable.pm@ 24626

Last change on this file since 24626 was 24626, checked in by jmt12, 13 years ago

An (almost) complete copy of the perllib directory from a (circa SEP2011) head checkout from Greenstone 2 trunk - in order to try and make merging in this extension a little easier later on (as there have been some major changes to buildcol.pl commited in the main trunk but not in the x64 branch)

File size: 838 bytes
Line 
1# $Id: Variable.pm 7909 2004-08-06 05:11:55Z mdewsnip $
2
3package XML::XPath::Variable;
4use strict;
5
6# This class does NOT contain 1 instance of a variable
7# see the XML::XPath::Parser class for the instances
8# This class simply holds the name of the var
9
10sub new {
11 my $class = shift;
12 my ($pp, $name) = @_;
13 bless { name => $name, path_parser => $pp }, $class;
14}
15
16sub as_string {
17 my $self = shift;
18 '\$' . $self->{name};
19}
20
21sub as_xml {
22 my $self = shift;
23 return "<Variable>" . $self->{name} . "</Variable>\n";
24}
25
26sub get_value {
27 my $self = shift;
28 $self->{path_parser}->get_var($self->{name});
29}
30
31sub set_value {
32 my $self = shift;
33 my ($val) = @_;
34 $self->{path_parser}->set_var($self->{name}, $val);
35}
36
37sub evaluate {
38 my $self = shift;
39 my $val = $self->get_value;
40 return $val;
41}
42
431;
Note: See TracBrowser for help on using the repository browser.