in reply to On elegant coding...
in thread Just thinking ...

Well, this code has one inconsistency. In one case, you aggregate an action with an exit, while in another you dont. E.g.,
show_cache_and_exit($STATE);
aggregates two actions, while
update_cache(); exit 0;
would have been written as
update_cache_and_exit(0)
if it were consistent with the aggregation methodology used for show_cache()

Alternatively, and in the favor of fine granularity,

show_cache_and_exit($STATE);

Could be written as

show_cache(); exit($STATE);

Replies are listed 'Best First'.
RE: RE: On elegant coding...
by merlyn (Sage) on Oct 14, 2000 at 07:54 UTC
    Yeah, I played around a little with factoring. You're right, I could have combined those.

    But the inelegance was that there are two different reasons we could be updating the cache in the parent... one because we couldn't fork, and the other because the cache was so old we dared not show a stale cache. And I was trying to figure out how to have both of those fall out to the same place in the program without freaking out with state variables or contorted conditions, and just didn't get there.

    -- Randal L. Schwartz, Perl hacker