in reply to Combining calls to a subroutine issue.
(That's the "quickest" thing, though some rearrangement -- possibly using a loop over a data structure of call parameters -- would be worthwhile.)if ( $page eq 'x1a.html' ) { $re_type = "a2"; $Q = ($prod) ? 'a0' : 'a0'; $send=$sec.$account.$year.$view; got_send(); # first "page" $re_type = "x2"; $Q = ($prod) ? 'p0' : 'w0'; $send=$sec.$account.$year.$view; got_send(); # second "page" $req_type = "y1"; $Q = ($prod) ? 'p0' : 'w0'; $send=$sec.$account.$year.$view.$action; got_send(); # third "page" }
But I suppose there might be something you haven't shown us in your "got_send()" sub that makes this impractical?
The way out would be to refactor the "got_send" sub to make it more modular: pass parameters to it on each call, instead of having it refer to global variables; have it return a string (or something), which the caller will know what to do with, based on the caller's knowledge of the context for each call, rather than trying to do everything inside of "got_send()".
Perhaps I'm misunderstanding the question? Or maybe you've left out some useful details...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Combining calls to a subroutine issue.
by Anonymous Monk on Apr 14, 2010 at 17:28 UTC | |
by graff (Chancellor) on Apr 15, 2010 at 03:45 UTC | |
by Anonymous Monk on Apr 15, 2010 at 15:50 UTC | |
by graff (Chancellor) on Apr 16, 2010 at 17:31 UTC |