> ahh no, nothing in that regard.. What I want is to add some of said > capabilities to another module that I'm creating that's unrelated to any > thing to do with mailing. The object merely tracks some client data. In > some instances I'll want to send an e-mail to the address in the client > data, if they have supplied one. The body of the mail may be created > from a Text::Template or some other source, possibly, but essentially I > would like to, at some branch in the end-user code, hand it off to be > mailed out, but with certain prerequisites determined by my > own object.
IMO this is probably a bad reason to subclass. It sounds much more appropriate to do a HAS-A relationship instead of a IS-A relationship.
For instance your code at some point is going to call a method that causes an email to be sent. At that point you would create a MIME::Lite object and use it to create and send the mail as needed. Doing this via ISA semantics doesnt make a lot of sense to me.
If you were overriding some behaviour in the mail module it would be a different story.
Well here I have this Subscriber object, let's call it. They signed up on a web form, and I've poulated the object with the validated data.
what would I like to do with the Subscriber?
o send them a welcome mailing
o snailmail - add them to tommorow's list of mailing labels along with a marker to the correct template
o e-mail - send them a greeting using the welcome template
o add them to a database
o retrieve them from a database
o based on certain criterion, send them monthly mailings of special events
o based on certain criterion, send them coupons on birthday or anniversary
The Subscriber object, can, as necessary, generate from itself a complete address, complete email, greeting (including salutation, for use in templates), make sure we've entered a valid date for b-day/anniversary, etc.
There's other things but by and large I can program them into the admin interface easily enough, but my thought is to abstract away some of the functions in order to simplify the interface programming.
# clone the subscriber and send them a welcome greeting my $mailer = Subscriber::Mailer->new($subscriber); # fill in the welcome template $mailer->add_template( $template_object ); # fire it off $mailer->send() or generate_some_sensible_error($!);
There's still the part that needs to determine whether we're sending them an e-mail or a printed mail to a snailmail address, to consider, but this is the 'raw idea' of the thing.
-- Scott R. Godin Laughing Dragon Services www.webdragon.net