I am now using caller() in any method that requires class methods or
variables in its caller and it's working great!!

I'm creating objects that know how to save themselves. The utility method I
was refering to earlier generats SQL code for a particular class so that it
can write itself into a table. In the RDBMS I have parent and child tables
and I have corresponding parent and child classes. An object cant simply
write itself into the DB because it consists of multiple tables i.e. each
table associated with its ancestors. So when I call save on each of the
ancestor classes (via the child objects save method which calls
SUPER::save()), the utility method that generates the SQL must call a method
in the calling class to figure out what the fields are (i.e. the hashkeys)
for that class, and that class only - not the fields that have been
inherited from the entire heirarchy.

-----Original Message-----
From: Michael Fowler [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 20, 2001 12:15 AM
To: Mark Maunder
Cc: Beginners@Perl. Org
Subject: Re: Is __PACKAGE__->method() the best way...


On Thu, Jul 19, 2001 at 11:31:20PM +0100, Mark Maunder wrote:
> But I still want to know if __PACKAGE__ (or blesssing a temp object into
> the current package) is the best way of ensuring that the called method is
> passed an object of the callers type.

It isn't.  __PACKAGE__ isn't an object, it's a string.  Reblessing an object
changes the class of the object, which affects anything that uses that
object, including the calling code.

I don't know if there is a good way of passing an object of the caller's
type.  I'm not even sure there's a situation that requires it, that
shouldn't be designed some other way.


Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to