Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^3: mod_perl / Apache::Registry accidental closures

by imp (Priest)
on Jul 21, 2006 at 18:20 UTC ( #562910=note: print w/replies, xml ) Need Help??

in reply to Re^2: mod_perl / Apache::Registry accidental closures
in thread mod_perl / Apache::Registry accidental closures

I agree - that's the only change I made to the alternative that I recommended at the end of the post.

In that case I passed the values by reference, to preserve the behaviour of the original function (which modified the passed variable.)

  • Comment on Re^3: mod_perl / Apache::Registry accidental closures

Replies are listed 'Best First'.
Re^4: mod_perl / Apache::Registry accidental closures
by rhesa (Vicar) on Jul 21, 2006 at 19:13 UTC
    Yes, I agree with you both (of course).

    The tricky bit about just passing in the variables is that you'd need to redefine the interface of the sub (that is, return the modified values instead of editing in place). Which - for the people who stand to benefit the most from this Tutorial - might be a lot of work. If your script began with global variables in the first place, there's a good chance the rest of the program is procedural in nature.

    imp, Your solution with passing by reference is even better than ikegami's, in that I expect it to be easier to understand.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://562910]
[LanX]: ... and hope to get a free work day in compensation. :)
choroba went to a museum with the older children. The exhibition was called "American Indians".
[Discipulus]: this and...
[Discipulus]: shaving the ceil
LanX God shaves the Queen!
[marto]: plastering
LanX citing Sean Connery

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2018-02-19 10:30 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (261 votes). Check out past polls.