in reply to how to pass object to a subroutine

Use can use something like this:
my $logger = sub { $log->message(@_); } # now you can call $logger like this: $logger->('This is a logging message'); # or like that: &$logger('This is a logging message');

Don't know if that answers your question, though.

Update: on second reading I think your problem is a different one: you want to print $log. But what do you want the output to be? An object doesn't have a nice default string representation.