Just wanted to show you how things have been shaping up thus far as I work to fill in the blanks (in both my knowledge of how this is all going to fit together, and in the missing methods I'll need to get the jobs done)

http://www.webdragon.net/miscel/Subscriber.pm
http://www.webdragon.net/miscel/DB.pm
http://www.webdragon.net/miscel/Config.pm
http://www.webdragon.net/miscel/Mailer.pm

With what I have there, I was able to find four invalid email addresses out of the 6100 records in the table, with this little gem:

#!/usr/bin/perl

use CGI qw{:standard *table};
use CGI::Carp qw(fatalsToBrowser);

use Subscriber;
use Subscriber::DB;
use Subscriber::Mailer;

# Look ma! no hard-coded user/pass info!
my $db = Subscriber::DB->new->connect(1);

my $sth = $db->filter(
    "sub_mailerdata",
    "where email is not null ",
    qw[id lastname firstname email]
);
$sth->execute();
my @table;
push @table, start_table({-border=>1});
push @table, Tr( th( [ @{$sth->{NAME}} ] ) );
while (my $row = $sth->fetchrow_hashref)
{
    my $sub = Subscriber::Mailer->new( Subscriber->new( %{$row} ) );
        
    push @table, Tr( td( [ @{$row}{qw[id lastname firstname email]} ] ))
        unless $sub->valid_target();
}

push @table, end_table();

print header(),
    start_html(),
    @table,
    end_html();

__END__

Does it look to you that I'm moving in the right direction? Any things you think I should be keeping in mind as I go about this? Pitfalls/Traps? etc, etc, yadda, yadda. :)

Obviously I haven't started yet adding methods to make new Subscribers themselves persistent, or for removing them from the DB. One of the things I need to consider is how to provide removal functionality to the end-user themselves. (particularly considering that thus far, none of them has a personal password in the system and remove requests are being handled manually. I'm hoping to replace that admin overhead eventually. :)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to