Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Method parameters validation and inheritanceby roman (Monk) |
on Sep 21, 2008 at 18:41 UTC ( [id://712870]=note: print w/replies, xml ) | Need Help?? |
Thanks for your comments. I should probably give some longcalls explanation. Code sample given is a simplified but real world example: $file encapsulates a binary file (log) produced by a phone switch. It contains cdrs (Call Data Records) describing voice calls carried out. The file is used as a source for several target applications (billing, dwh). If a call continues longer than say half an hour it is logged by parts. If join_longcalls is set for open_for_reading only complete calls are produced by read_cdr and the total duration of the call is summed up. So the join_longcalls flag really causes the long calls to be joined. In such case I am not sure whether to use join_long_calls or joins_long_calls? I think open_for_reading is clearer than plain reading since I try to use imperative for my subs. As kyle suggested, I could avoid some of the "SUPERs" and turns the code into:
The open_for_reading, actually returns Class::Prototyped based object, so join_longcalls - whatever its implementation is - actually wraps read_cdr method. This approach has some advantages:
This approach has also some disadvatages:
In Section
Seekers of Perl Wisdom
|
|