As all active dev's know... We have too much auto vivification bug's around.
There is 2 solutions to finally fix them all:
1) Use the native perl feature described in Synopsis_09->Autovivification Document. It need alot of auditing code inside Kore itself. To make this task more easy there exist a little package Tie::Trace (Bug still, I donno how it will work with Blessing and Overloading)
2) We can Rewrite whole Actors and Environmental objects system to more OpenKore 3.0 model where you can't easly add or delete Actors and all actions and modifications done by their API with a lot of Validations and gettery-settery method's.
Well. The first solution is not very good at Plugins point. They still can cause core errors.
The second solution need alot of coding, and will break all existing plugins.
We are open for your Suggestions on this problem.
Fixing Auto vivify Bug's. [2.0.7 ~ 2.1]
Moderator: Moderators
Re: Fixing Auto vivify Bug's. [2.0.7 ~ 2.1]
Oh. forgot. there is additional package to handle our problem Tie::Hash::Vivify.
But it's still version 0.01.
But it's still version 0.01.
Re: Fixing Auto vivify Bug's. [2.0.7 ~ 2.1]
I prefer using getter and setter as they are common in oop and we can validate better. It will be a lot of work rewritting all the plugins, but I think it's better.
Btw. I think with implementation of getter/setter it's easier to develope new plugins...
Btw. I think with implementation of getter/setter it's easier to develope new plugins...
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the universe trying to produce bigger and better idiots.
So far, the universe is winning.
Richard Cook
Wiki
So far, the universe is winning.
Richard Cook
Wiki
Re: Fixing Auto vivify Bug's. [2.0.7 ~ 2.1]
Found 2 more things.
1st:
also found this little CPAN package autovivification
Also found this little trick to fully trace all the nasty things.
Just add
to all packages, to finally trace all non good coded places.
1st:
2nd:You can lock the hash using one of the functions from Hash::Util (a core module).Now the last statement will throw an exception:Code: Select all
use Hash::Util qw( lock_keys unlock_keys ); my $some_ref = { akey => { deeper => 1 } }; lock_keys %$some_ref; print "too deep" if $some_ref->{deep}{shit} == 1;
The downside is, of course, that you'll have to be very careful whenCode: Select all
Attempt to access disallowed key 'deep' in a restricted hash
checking for keys in the hash to avoid exceptions, i.e. use a lof of "if exists ..." to check for keys before you access them.
If you need to add keys to the hash again later you can unlock it:Code: Select all
unlock_keys %$some_ref; $some_ref->{foo} = 'bar'; # no exception
also found this little CPAN package autovivification
Also found this little trick to fully trace all the nasty things.
Just add
Code: Select all
use warnings NONFATAL => 'all', FATAL => 'uninitialized';
Re: Fixing Auto vivify Bug's. [2.0.7 ~ 2.1]
Most of AutoVivify is now fetched in the first place by Tie::ActorHash.
Fixed by EternalHarvest in r7229
It will not prevent us from thus reports, but at least now we can see where they happen to be called.
Thanks =)
Fixed by EternalHarvest in r7229
It will not prevent us from thus reports, but at least now we can see where they happen to be called.
Thanks =)