diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2003-01-26 19:35:03 +0000 |
---|---|---|
committer | <> | 2015-02-23 10:18:26 +0000 |
commit | a2d12bc84fb2af87dd1c0c6e5bc854554902cd67 (patch) | |
tree | 7665979c7c281b21971de576d93246a022bff649 /XPath/Variable.pm | |
download | perl-xml-xpath-a2d12bc84fb2af87dd1c0c6e5bc854554902cd67.tar.gz |
Imported from /home/lorry/working-area/delta_perl-xml-xpath/XML-XPath-1.13.tar.gz.HEADXML-XPath-1.13master
Diffstat (limited to 'XPath/Variable.pm')
-rw-r--r-- | XPath/Variable.pm | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/XPath/Variable.pm b/XPath/Variable.pm new file mode 100644 index 0000000..9c8b59e --- /dev/null +++ b/XPath/Variable.pm @@ -0,0 +1,43 @@ +# $Id: Variable.pm,v 1.5 2001/03/16 11:10:08 matt Exp $ + +package XML::XPath::Variable; +use strict; + +# This class does NOT contain 1 instance of a variable +# see the XML::XPath::Parser class for the instances +# This class simply holds the name of the var + +sub new { + my $class = shift; + my ($pp, $name) = @_; + bless { name => $name, path_parser => $pp }, $class; +} + +sub as_string { + my $self = shift; + '\$' . $self->{name}; +} + +sub as_xml { + my $self = shift; + return "<Variable>" . $self->{name} . "</Variable>\n"; +} + +sub get_value { + my $self = shift; + $self->{path_parser}->get_var($self->{name}); +} + +sub set_value { + my $self = shift; + my ($val) = @_; + $self->{path_parser}->set_var($self->{name}, $val); +} + +sub evaluate { + my $self = shift; + my $val = $self->get_value; + return $val; +} + +1; |