Forwarding Steve's answer to the list ... -- Mike
Mike Schilli m...@perlmeister.com ---------- Forwarded message ---------- From: Steve <st...@matsch.com> To: Mike Schilli <m...@perlmeister.com> Subject: Re: [log4perl-devel] DBIC Object not interpreted Date: Tue, 11 May 2010 08:15:17 -0400 On 5/11/2010 1:25 AM, Mike Schilli wrote: 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. I'm not quite sure why, but changing the double quotes around the "Created sub->" to single quotes had the desired effect? Also, $newsub->ptn is an accessor method for DBIx::Class::Row that should return the value of that particular column, as it now does. Thanks for the response! 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 No virus found in this incoming message.Checked by AVG - www.avg.com Version: 9.0.819 / Virus Database: 271.1.1/2866 - Release Date: 05/10/10 14:26:00
<<ATTACHMENT: steve.vcf>>
------------------------------------------------------------------------------
_______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel