Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Class-InsideOut CPAN distribution.

Report information
The Basics
Id: 48106
Status: resolved
Priority: 0/
Queue: Class-InsideOut

People
Owner: Nobody in particular
Requestors: me [...] heyjay.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: get_hook not called with default new()
Date: Wed, 22 Jul 2009 22:25:27 -0500
To: bug-Class-InsideOut [...] rt.cpan.org
From: Jay Strauss <me [...] heyjay.com>
Hi, I believe there is a bug when using the "default" new method, in that it does not call the get_hook routine while setting attributes. In the example below, when calling the constructor the get_hook is not executed for the attribute being set. But if I call the setter for that attribute the get_hook does get executed: package My::Test; use Class::InsideOut qw(:all); public symbol => my %symbol, { set_hook => \&_populate }; sub _populate { my $self = shift; print "in _populate: ",$self,"\n"; } 1; my $test = My::Test->new(symbol=>"DELL"); $test->symbol("IBM"); Thanks Jay
Subject: set_hook not called with default new()
On Wed Jul 22 23:25:53 2009, me@heyjay.com wrote: Show quoted text
> Hi, I believe there is a bug when using the "default" new method, in
that it Show quoted text
> does not call the get_hook routine while setting attributes. In the
example Show quoted text
> below, when calling the constructor the get_hook is not executed for the > attribute being set. But if I call the setter for that attribute the > get_hook does get executed:
I'm assuming you mean the "set_hook", not the "get_hook". This is actually by design, though it's not clear in the documentation. The default constructor initializes the values *directly*, not by calling the accessor. This allows it to initialize otherwise read-only properties. Since the accessor is not used, the set_hook is not called either. I'm going to leave this ticket open to remind me to clarify the documentation about this behavior.