Thanks for your response, it was a great help.
If I change my sub routine "email" from my sample code here into a module and lets say I would be passing all the values to this new module now called mod_email like this;
mod_email( {to=>$to, from => $email, subject=>$subject, body=>$body, ttparams => $templ_data} );
There is no problem passing the values into the module like that, but how could I pass this array of hashes "@imgs" to this module? Here is some lines of code of my trying for your opinion:
#from the .pl file call the module
...
mod_email( {to=>$to, from => $email, subject=>$subject, body=>$body, t
+tparams => $templ_data},imgs=>@imgs );
#now this part would be code inside of the module mod_email
...
sub process_email_stuff
{
my ($vals) = @_;
my $to = $vals->{ to } || {};
my $from = $vals->{ from } || {};
my $subject = $vals->{ subject } || {};
my $body = $vals->{ body } || {};
my $ttparams = $vals->{ ttparams } || {};
#questioning this:
my @imgs = $vals->{ imgs } || {};
my $msg = MIME::Lite::TT::HTML->new(
From => $from, ...
#all the other stuff its done, now get to the @imgs processing, hopefu
+lly.
for my $img (@imgs ) {
$msg->attach( %$img ) or die "Error adding $img- {Filename}: $!\n"
+;
}
...
1;
I hope this is clear about want I am trying to accomplish, and thanks once again!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.