in reply to Re^5: $cgi->param() values are not updated instantly when read in a subroutine
in thread $cgi->param() values are not updated instantly when read in a subroutine

I'm currently on the way, so I don't have all data available. However, I had a peek at the logs and I read something about $cgi (and maybe others) that it will not stay shared or so. I think its the thing described here: http://www.webreference.com/programming/perl/subroutines/2.html (at the end of "Private Variables and Nested Subroutines"). I'll have a look at it tomorrow. Thank you for your help so far.
  • Comment on Re^6: $cgi->param() values are not updated instantly when read in a subroutine

Replies are listed 'Best First'.
Re^7: $cgi->param() values are not updated instantly when read in a subroutine
by ikegami (Patriarch) on Mar 09, 2011 at 17:14 UTC

    I had a peek at the logs and I read something about $cgi (and maybe others) that it will not stay shared or so

    You can't use my outside of subs in an Apache::Registry script. Refer to the mod_perl Guide. Possible solutions:

    sub foo { my ($cgi, ...) = @_; ... $cgi->... ... } sub main { my $cgi = ...; foo($cgi, ...); } main();
    or
    our $foo; sub foo { my (...) = @_; ... $cgi->... ... } sub main { local $cgi = ...; foo(...); } main();
Re^7: $cgi->param() values are not updated instantly when read in a subroutine
by Anonymous Monk on Mar 09, 2011 at 18:55 UTC