#!/usr/bin/perl -w

use strict;
use Data::Dumper;
$Data::Dumper::Sortkeys = 1;
use lib "go/www/tools/";
use GO::GeneralPurposeParser;
use GO::Object::Term;

## read in the file
my $parser = GO::GeneralPurposeParser->new();
my $file_chunks = $parser->parse_from_file({
	file => 'obo_file.obo',
	parser => 'multi_field_tag_value',
	return_record_as_object => 'GO::Object::Term',

	process_record => #{
#		filter => sub { my $record = shift; return 1 if exists $record->{'[Term]'}; return undef; },
#		filter_args => { PASS =>  , FAIL => },
	
	sub {
		my $record = shift;
#		print STDERR "starting custom process_record sub\n";
#		print STDERR "record: ".Dumper($record)."\n";
		if (exists $record->{'[Term]'})
		{	print STDERR "record stanza type is term! Doing that whole creating a new term thing.\n";
#			return $parser->create_new_object('GO::Object::Term', { check_input => 1 }, $record);
#		}
#		else
#		{	next if $record->{'[Typedef]'} || $record->{'[Instance]'};
#			$parser->add_warning("Not creating an object, sorry!\n");
			return $record;
		}
		return undef;
	},

});



=cut



});
=cut

print STDERR "file chunks:\n".Dumper($file_chunks)."\n";

my $header = shift @$file_chunks;



my $errors = $parser->get_all_errors();
print STDERR "errors: ".Dumper($errors)."\n";


exit(0);