# File lib/puppet/parser/scope.rb, line 324
324:   def setvar(name,value, options = {})
325:     table = options[:ephemeral] ? @ephemeral.last : @symtable
326:     #Puppet.debug "Setting %s to '%s' at level %s mode append %s" %
327:     #    [name.inspect,value,self.level, append]
328:     if table.include?(name)
329:       unless options[:append]
330:         error = Puppet::ParseError.new("Cannot reassign variable #{name}")
331:       else
332:         error = Puppet::ParseError.new("Cannot append, variable #{name} is defined in this scope")
333:       end
334:       error.file = options[:file] if options[:file]
335:       error.line = options[:line] if options[:line]
336:       raise error
337:     end
338: 
339:     unless options[:append]
340:       table[name] = value
341:     else # append case
342:       # lookup the value in the scope if it exists and insert the var
343:       table[name] = lookupvar(name)
344:       # concatenate if string, append if array, nothing for other types
345:       case value
346:       when Array
347:         table[name] += value
348:       when Hash
349:         raise ArgumentError, "Trying to append to a hash with something which is not a hash is unsupported" unless value.is_a?(Hash)
350:         table[name].merge!(value)
351:       else
352:         table[name] << value
353:       end
354:     end
355:   end