in reply to Re: OO Conversion Query - Sharing Data
in thread OO Conversion Query - Sharing Data
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: OO Conversion Query - Sharing Data
by educated_foo (Vicar) on Apr 12, 2013 at 13:30 UTC | |
by Anonymous Monk on Apr 13, 2013 at 02:17 UTC | |
by educated_foo (Vicar) on Apr 13, 2013 at 13:20 UTC | |
by Anonymous Monk on Apr 13, 2013 at 07:17 UTC | |
by Anonymous Monk on Apr 14, 2013 at 01:57 UTC | |
by Anonymous Monk on Apr 14, 2013 at 11:26 UTC |