File Coverage

blib/lib/XML/XPathEngine/Variable.pm
Criterion Covered Total %
statement 3 18 16.6
branch n/a
condition n/a
subroutine 1 7 14.2
pod 0 6 0.0
total 4 31 12.9


line stmt bran cond sub pod time code
1             # $Id: Variable.pm,v 1.5 2001/03/16 11:10:08 matt Exp $
2              
3             package XML::XPathEngine::Variable;
4 2     2   9 use strict;
  2         4  
  2         522  
5              
6             # This class does NOT contain 1 instance of a variable
7             # see the XML::XPathEngine::Parser class for the instances
8             # This class simply holds the name of the var
9              
10             sub new {
11 0     0 0   my $class = shift;
12 0           my ($pp, $name) = @_;
13 0           bless { name => $name, path_parser => $pp }, $class;
14             }
15              
16             sub as_string {
17 0     0 0   my $self = shift;
18 0           '\$' . $self->{name};
19             }
20              
21             sub as_xml {
22 0     0 0   my $self = shift;
23 0           return "" . $self->{name} . "\n";
24             }
25              
26             sub get_value {
27 0     0 0   my $self = shift;
28 0           $self->{path_parser}->get_var($self->{name});
29             }
30              
31             sub set_value {
32 0     0 0   my $self = shift;
33 0           my ($val) = @_;
34 0           $self->{path_parser}->set_var($self->{name}, $val);
35             }
36              
37             sub evaluate {
38 0     0 0   my $self = shift;
39 0           my $val = $self->get_value;
40 0           return $val;
41             }
42              
43             1;