[system] / trunk / pg / lib / Value / Context / Data.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Value/Context/Data.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3482 Revision 3483
140# Make one or more items become undefined, but still recognized. 140# Make one or more items become undefined, but still recognized.
141# (Implemented in the sub-classes.) 141# (Implemented in the sub-classes.)
142# 142#
143sub undefine {my $self = shift; $self->remove(@_)} 143sub undefine {my $self = shift; $self->remove(@_)}
144 144
145#
146# Redefine items from the default context, or a given one
147#
148sub redefine {
149 my $self = shift; my $X = shift;
150 my %options = (using => undef, from => "Full", @_);
151 my $Y = $options{using}; my $from = $options{from};
152 $from = $Parser::Context::Default::context{$from} unless ref($from);
153 $Y = $X if !defined($Y) && !ref($X);
154 $X = [$X] unless ref($X) eq 'ARRAY';
155 my @data = (); my @remove = ();
156 foreach my $x (@{$X}) {
157 my $y = defined($Y)? $Y: $x;
158 Value::Error("No definition for %s '%s' in the given context",$self->{name},$y)
159 unless $from->{$self->{dataName}}{$y};
160 push(@remove,$x) if $self->get($x);
161 push(@data,$x => $from->{$self->{dataName}}{$y});
162 }
163 $self->remove(@remove);
164 $self->add(@data);
165}
166
145 167
146# 168#
147# Get hash for an item 169# Get hash for an item
148# 170#
149sub get { 171sub get {

Legend:
Removed from v.3482  
changed lines
  Added in v.3483

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9