Hi...I'm working on a fairly 'out of the box' CentOS box. It's my first time working with Apache2 / mod_perl2. I started to see some odd behavior and tracked it down to what I believe to be a scope issue. I can boil the problem down with the short script which I'll paste into this message (it's only twelve lines long). Here's the problem:

On the old, production server (running mod_perl and Apache 1.x), both $page vars are always the same: CGI=HASH(0x2b3aa9d0b600) CGI=HASH(0x2b3aa9d0b600)

On the NEW server (NOT running mod_perl, but running Apache 2.x), both $page vars are always the same: CGI=HASH(0x2b3aa9d0b600) CGI=HASH(0x2b3aa9d0b600)

But, on the NEW server (RUNNING mod_perl2 and running Apache 2.x), the $pages are sometimes different, presumably because it is picking the $page variable up from some other thread or process: CGI=HASH(0x2b3aa9d0b600) CGI=HASH(0x2b3aa9fc9a20)

I tried 'compat' and even adjusting PerlInterpScope and neither one of those seemed to do anything (and I felt like I was desperately flailing for a solution instead of actually understanding what was going on…Any light shed would be much appreciated!

Example:
#!/usr/bin/perl use CGI; my $page = new CGI; print $page->header(); print "<html><head></head><body>"; print $page; print "<br>"; test(); print "</body></html>"; sub test{ print $page; }

In reply to mod_perl2 scope issue? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.