Melvin Smith wrote
> I think that would be just plain bad design, but I'd be happy
> if someone showed me a use for it. :)
well, I've been known to do
sub UNIVERSAL::debug
{
my $self = shift;
my $msg = "@_";
eval {$self=$self->name} if ref($self);
my $timestamp = ...;
my $caller = ...;
print "DEBUG [$timestamp] '$self' $caller: $msg\n";
}
sub UNIVERSAL::debugf { shift->debug(sprintf @_) }
which can then be called as:
$class->debug("hello");
or
$self->debugf("world, %d", 42);
or even
hello->debug(world);
You are right. This is just plain bad design. But it can be useful.
Dave.