package BibExport::DbPeople;

use Bib::Write;
use warnings;
use strict;


our %exported = ();

sub _encode
{
    my $Text = $_[ 0 ];
    
    $Text =~ s/([\n\r%])/sprintf( "%%%.2x", ord( $1 ) )/ge;
    return $Text;
}

sub _list {
    my ( $obj, $key ) = @_;
    foreach my $a ( @{$obj->{lc($key)}} ) {
        $exported{ $a } or do {
            print "START:author\n";
            print "  NAME:" . _encode( $a ) . "\n";
            print "END:author\n\n";
        };
        $exported{ $a } = 1;
    }
}

# ==============================================================================

sub new {
    my $class = shift;
    $class = ref( $class ) || $class;

    return bless( {}, $class );
}

sub done {
    my ($this) = @_;
}

sub ae
{
    my ($this, $obj) = @_;
    _list( $obj, 'editor' );
    _list( $obj, 'author' );
}

sub inproceedings { ae( @_ ); }
sub proceedings { ae( @_ ); }
sub article { ae( @_ ); }
sub techreport { ae( @_ ); }


1;

