sub dual {
my ($self,$time);
if (ref($_[0]) ) {
($self,$time) = @_;
}else {
($time) = @_;
}
blah blah ..........
}
The only problem with the above method is that it will not work properly if the first argument to it is a reference. Is there any ohter way to make it a class method as well instance method.
Thanks
Nand
Have a look at the UNIVERSAL class, everyone derives from it implicitly, and it provides some functions. I believe you can use it to walk the inheritance tree, or at the least, differentiate between an object reference as opposed to a regular variable. The camel book has a few pages on it, or search the web.
Sean