On Mon, 10 May 2010, Steve wrote: > Where $newsub is an object, the following fails to work as I expected it to: > $logger->info("Created sub->", $newsub->ptn); > Since my log is a text file, this yields the following line in the file: > 2010/05/10 16:38:59 INFO> cmsIMsubs-S.pl:176 main::getSubs - Created > sub->CMS::Schema::Result::Subscription=HASH(0x96b9164)->ptn > In case it's not obvious, I'd like to log the phone number, not what type of > object I'm looking at.
I doubt this is related to Log4perl, I bet you'll get the same result with print(). Make sure that your ptn() method does the right thing when called in list (!) context. Here's some code to show that it works as expected: use strict; package Wobble; sub new { bless {}, shift; } sub ptn { return "wobble!" } package main; use Log::Log4perl qw(:levels get_logger); Log::Log4perl->easy_init($DEBUG); my $logger = get_logger(); my $wobble = Wobble->new(); $logger->info("return of ptn: ", $wobble->ptn()); -- Mike Mike Schilli m...@perlmeister.com ------------------------------------------------------------------------------ _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel