Mercurial > pub > Impl
comparison Lib/IMPL/DOM/Navigator.pm @ 368:010ceafd0c5a
form metadata + tests
author | cin |
---|---|
date | Wed, 04 Dec 2013 17:31:53 +0400 |
parents | 4ddb27ff4a0b |
children |
comparison
equal
deleted
inserted
replaced
367:608e74bc309f | 368:010ceafd0c5a |
---|---|
127 } while ($this->advanceNavigator); | 127 } while ($this->advanceNavigator); |
128 } | 128 } |
129 | 129 |
130 sub Back { | 130 sub Back { |
131 my ($this,$steps) = @_; | 131 my ($this,$steps) = @_; |
132 | |
132 if ($this->{$_path} and @{$this->{$_path}}) { | 133 if ($this->{$_path} and @{$this->{$_path}}) { |
133 if ( (not $steps) || $steps == 1) { | 134 if ( (not defined $steps) || $steps == 1) { |
134 $this->{$_state} = pop @{$this->{$_path}}; | 135 $this->{$_state} = pop @{$this->{$_path}}; |
135 } else { | 136 } elsif ($steps > 0) { |
136 $steps ||= 1; | |
137 | |
138 $steps = @{$this->{$_path}} - 1 if $steps >= @{$this->{$_path}}; | 137 $steps = @{$this->{$_path}} - 1 if $steps >= @{$this->{$_path}}; |
139 | 138 |
140 $this->{$_state} = (splice @{$this->{$_path}},-$steps)[0]; | 139 $this->{$_state} = (splice @{$this->{$_path}},-$steps)[0]; |
141 } | 140 } |
142 $this->Current if defined wantarray; | 141 $this->Current if defined wantarray; |