I have the following class hierarchy:
I have the following class hierarchy:
I would like 'bidule' to be set to 1 for objects 'Connection::Simulate' (I already sent a request to have the possibility to set default value without having to use the :Arg attribute. See http://www.cpanforum.com/posts/3633, but the proposed solution does not fit my current pb)
I tried to solve my pb without finding a solution.
For example, I declared a Preinit function in the Connection::Simulate, but the value '1' is not set correctly (this solution is in anyway incorrect: suppose we have the Connection, Connection::Simulate and Connection::Simulate::Blabla classes with default values set to 0 (for Connection), 1 (for Connection::Simulate), 2 (for Connection::Simulate::Blabla))
How can I solve my problem (without having to call the set_bidule method outside from the tree hierarchy ;-)) ?
Thanks
Gaetan
It works
But my next question is ;-)
How to initialize bidule in Connection::Simulate without having to declare @bidule (in Connection) with the :Arg attribute (I don't want this attribute to be accessible from outside my classes) ?
We could imagine for example the following syntax (in Connection package)
This would solve my problem but this solution, from my point of view, is not an elegant solution
Have a nice we
GaetanI obtain the following result:
Connection::Simulate::pre function is called but with no effect on the @bidule variable AND Connection::Init is not called (no :InitArgs variable is declared ?)
GaetanOK, the previous code is working, but when applying your "recipe" for my program, it does not work
If you add some lines in the code, the program fails
I need help (only for next Monday ;-))
GaetanIt works with the new Default attribute (this interface is cleaner) .... but not in all cases:
The default value I would like to set to my attribute is an object (and not a constant)Would it be possible to eval the :Default attribute parameter ? If the eval fails, then the attribute is initialized as if the eval was not called.
Gaetan