in reply to Override Data Display Method

There's this hype about overloading, but I find it a bit scary. I don't really know why, but I'd rather use some technique that allows interpolation of any data.

When you're no longer talking about having a simple scalar, but about interpolating a function call, it's easy to find in perlfaq, under How do I expand function calls in a string?:

This is documented in perlref. In general, this is fraught with quoting and readability problems, but it is possible. To interpolate a subroutine call (in list context) into a string:
print "My sub returned @{[mysub(1,2,3)]} that time.\n";
If you prefer scalar context, similar chicanery is also useful for arbitrary expressions:
print "That yields ${\($n + 5)} widgets\n";
Version 5.004 of Perl had a bug that gave list context to the expression in "${...}", but this is fixed in version 5.005.

So, you could try:
print "Your order is for $count donuts which are specified with ${\ $d +onut->printed }<BR><BR>\n";


If you need list context, you'd use @{[]}, but ${\ join ' ', ...} is a LOT faster (you could use $" to join with, but that's a bit slower, and it's probably a single space anyway).

Another solution would be using printf:
printf("Your order for %d donuts which are specified with %s<BR><BR>\n +", $count, $donut->printed);


HTH

++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
-- vs lbh hfrq OFQ pnrfne ;)
    - Whreq