On 2005-07-05, Michael Peters <[EMAIL PROTECTED]> wrote:
>
> Mark Stosberg wrote:
>>>Jason Purdy wrote:
>>>
>>>I foresee a need for a setup hook for the BREAD plugin, to dynamically
>>>create runmodes.
>>
>>
>> I think you can just define these at the init() stage when the same effect.
>>
>> You will have access to the object then (not just the class), and can call
>> the
>> run_modes() method normally from your callback.
>>
>> Maybe that's the answer to why we don't need a setup() hook location. :)
>
> It still doesn't let you register things on an object basis. init can
> only be run before new(). I can't think of a use case where this would
> matter, but it might. Would anyone ever want to change a default (that
> couldn't be changed at prerun) or add a run mode to just an object and
> not a class?
I think you are wrong. Looking at the source code of new(),
We can see the object creation:
# Create our object!
my $self = {};
bless($self, $class);
Later followed by the call to the init hook, which would have this new
object available.
# Call cgiapp_init() method, which may be implemented in the sub-class.
# Pass all constructor args forward. This will allow flexible usage
# down the line.
$self->call_hook('init', @args);
Mark
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]