Reasoning
'igaro' doesn't really need OO porting as per say, the only reason I'm doing it is to make the code less fragile. I think.
Another reason is my relative lack of OO experience, and I have a tech interview on Tuesday. I'm bringing myself up to speed the hard way. :)
The code
In essence I'd coded so that one function = one file. It was rare for this to be anything different, which of course diminished the need for employing classes.
Now I'm converting the common functions, but the logic seems a little daft. Before I'd require the file and stick it into the namespace as 'igaro_xxx_xxx'. Now I'm instantiating the function into $self->{common}{xxx_xxx} and the other functions that used to call &igaro_xxx_xxx will have to do $self->{common}{xxx_xxx}->exec();
I have worked around the sharing of parent data by sending a reference to the parent through the params, like $self->{common}{xxx_xxx}->exec(parent=>$self);
Previously all the data was stored in several global hashes like %DATA.
My brain has just about fried itself.
In reply to Re^2: OO Conversion Query - Sharing Data
by snoopy20
in thread OO Conversion Query - Sharing Data
by snoopy20
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |