#!/usr/bin/perl -w -I/opt/eprints3/perl_lib

######################################################################
#
# This file is part of GNU EPrints 2.
# 
# Copyright (c) 2000-2004 University of Southampton, UK. SO17 1BJ.
# 
# EPrints 2 is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# EPrints 2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with EPrints 2; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
######################################################################
# cjg not supported yet.

use EPrints;

use strict;
#cjg Nice Command Options
#cjg man page
 
# Set STDOUT to auto flush (without needing a \n)
$|=1;

my $session = new EPrints::Session( 1, $ARGV[0] );
exit( 1 ) unless( defined $session );

my $user_ds = $session->get_repository->get_dataset( "user" );
$user_ds->map( $session, \&print_user_email );

$session->terminate();

sub print_user_email
{
	my( $session, $dataset, $user ) = @_;

	if( $user->is_set( "email" ) )
	{
		print $user->get_value( "email" )."\n";
	}
}
