G'day... One of my classes has a method called format_cost which takes a number (integer representing a monetory amount in cents) and pretties it up for display as a dollar amount. I.e. format_cost(120000) returns "$1,200.00".
When I have the function stand-alone it behaves as it should, however when I have it as a method on a class, and make a call to it (external to the class/object), it returns the class or object itself. E.g. my @output = (); sub add_output { @output = (@output, @_); } add_output($q->h2("Cost per billing period: " . Super_DB_Object->format_cost($period_multiplier * $total_monthly_cost_in_cents))); add_output($q->h2("Cost per billing period: " . $customer->format_cost($period_multiplier * $total_monthly_cost_in_cents))); add_output($q->h2("Cost per billing period: " . format_cost($period_multiplier * $total_monthly_cost_in_cents))); add_output($q->h2("Cost per billing period: " . ($period_multiplier * $total_monthly_cost_in_cents))); print @output; displays: Cost per billing period: Super_DB_Object Cost per billing period: Customer=HASH(0x82ddef8) Cost per billing period: $2,277.00 Cost per billing period: 227700 Clearly, I'm missing something crucial here... :) (FWIW, $q is a CGI instance and output is to a browser) All help appreciated. Regards, Michael S. E. Kraus Software Developer Wild Technology Pty Ltd _______________________________ ABN 98 091 470 692 Level 4 Tiara, 306/9 Crystal Street, Waterloo NSW 2017, Australia Telephone 1300-13-9453 | Facsimile 1300-88-9453 http://www.wildtechnology.net The information contained in this email message and any attachments may be confidential information and may also be the subject of client legal - legal professional privilege. If you are not the intended recipient, any use, interference with, disclosure or copying of this material is unauthorised and prohibited. This email and any attachments are also subject to copyright. No part of them may be reproduced, adapted or transmitted without the written permission of the copyright owner. If you have received this email in error, please immediately advise the sender by return email and delete the message from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>