khudgins has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on the final bits of a new web store application for my employer, and I've run into a bit of a pickle. We need to send the customer an email receipt for their order, and we'd like to send them a nicely formatted table of the items in their cart.

I can't use HTML, as there's a company policy decision stating that we don't put HTML in emails. (I agree - I read much email via PINE myself, and I hate HTML in my inbox). Therefore, format is the way to go. I think.

My question is, how do I make a format against a loop? I'm pulling the data from my database, and it's all working fine in HTML::Template. So I get:

$sqlString = "SELECT * FROM CartItems WHERE txtSessId = ?"; $sth = $dbh->prepare($sqlString); $sth->execute($session) $cartItemsRef = $sth->fetchall_arrayref({});

for a great return set for a TMPL_LOOP in my HTML templates. I can't format those well for a text-based table - I've tried. Given a format like this:

format RECEIPT = Item Quantity Price -------------------------------------------- @<<<<<<<<<<<<<<<<<<<<< @<<<<< @####.## $vars,$go,$here .

How do I loop this on the $cartItemsRef? I don't understand the format system deeply enough to do this.