def createnewnamerecord # this method adds a new address record require 'fileutils' newname = "%s" % [@a_filename] # grab the new filename to create newdata =@a_name.to_s + "\n" + @a_address.to_s + "\n" + @a_citystatezip.to_s + "\n" + @a_phone.to_s + "\n" + @a_email.to_s + "\n" + @a_comment1.to_s + "\n" + @a_comment2.to_s + "\n" + @a_comment3.to_s + "\n" fullnewname = newname + ".nam" begin # exception trapped block fileName = File.join($addressfiles_directory, fullnewname ) fd = File.open(fileName,"w") fd.print(newdata) # save the record info to the file fd.close @createnewnamerecorddisplay=newdata # show the record info in the browser rescue SystemCallError, StandardError $stderr.print "system call error: " + $! end # exception rescue end