#!/usr/bin/perl
# ABSTRACT: Generate a set of random person names. (Default: US)
# PODNAME: bin/Personify

use strict;
use warnings;

use lib '/Users/gene/sandbox/github/ology/Mock-Person/lib';
use Mock::Person;

# Get gender.
my $g = defined $ARGV[0] ? shift : die "Usage: perl $0 b|f|m [names] [num]\n";
# Get desired number of names.
my $d = defined $ARGV[0] ? shift : 2;
# Get desired number of data-points.
my $n = defined $ARGV[0] ? shift : 9;

# Roll!
for my $i (0 .. $n) {
    # Get our random person.
    my $p = '';
    if (($g eq 'b' && $i % 2) || $g eq 'f') {
        $p = Mock::Person::name(sex => 'female', country => 'us');
    }
    else {
        $p = Mock::Person::name(sex => 'male', country => 'us');
    }
    # Only use the requested number of names.
    my @names = split / /, $p;
    my $name = '';
    if ($d == 1) {
        print $names[-1];
    }
    elsif ($d == 2) {
        print "@names[0,-1]";
    }
    else {
        print $p;
    }
    print "\n";
}

__END__

=pod

=encoding UTF-8

=head1 NAME

bin/Personify - Generate a set of random person names. (Default: US)

=head1 VERSION

version 0.03

=head1 AUTHOR

Gene Boggs <gene@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Gene Boggs.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut
