| Email-Sample documentation | Contained in the Email-Sample distribution. |
Email::Sample - generate sample email for testing
Version 0.01
use Email::Sample;
my $emailgen = Email::Sample->new();
...
$emailgen->add_valid_domains( [ 'url.com.tw' , 'google2.com.tw' ] );
my @valid_emails = $emailgen->valid_emails( size => 20 );
my @invalid_emails = $emailgen->invalid_emails();
Email::Sample use Data::Random to generate a bunch of valid or invalid email for testing.
Cornelius, <cornelius.howl at gmail.com>
Please report any bugs or feature requests to bug-email-sample at rt.cpan.org, or through
the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Email-Sample. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Email::Sample
You can also look for information at:
Copyright 2009 Cornelius, all rights reserved.
This program is released under the following license: MIT
| Email-Sample documentation | Contained in the Email-Sample distribution. |
package Email::Sample; use warnings; use strict; use Data::Random qw(:all); # use Text::Greeking;
our $VERSION = '0.01';
sub new { my $class = shift; my $self = {}; return bless $self, $class; }
my @valid_domains = qw( yahoo.com gmail.com ); sub valid_emails { my $self = shift; my %args = @_; $args{size} ||= 10; my @emails = (); for( 1 .. $args{size} ) { push @emails, $self->g_valid_identity() . '@' . $self->get_random_valid_domain; } return \@emails; } sub add_domains { my $self = shift; $self->add_valid_domains(@_); }
sub add_valid_domains { my $class = shift; push @valid_domains , @_; } sub add_invalid_domains { } sub get_random_valid_domain { return $valid_domains[ int( rand( scalar(@valid_domains) - 1 ) ) ]; } sub g_valid_identity { my $self = shift; my %args = @_; $args{seperator} ||= '_'; my @random_words = rand_words( size => 3 ); return join( $args{seperator} , @random_words ); } sub g_invalid_identity { my ($self, %args ) = @_; }
1; # End of Email::Sample