Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Bingo. This is absolutely going to be a problem.

For those who saw that comment go over their heads, in mod_perl it is absolutely essential that global variables be declared with vars and not with my. The latter leads to serious black magic. Try RE (3): BrainPain-Help for one attempt at an explanation.

Here is another.

The key to the problem is that the subroutine has a single global name. There can only be one sub with that name in that package. Ever. However there may be many different lexical variables running around with that name. (Look up closures.) So when the one global has to figure out which lexical it names...well what is the right answer?

This is an issue in this case because Apache is just wrapping your entire script with a sub, and calling that. So that sub is called many times, leading to many copies of the lexical variable, and the brand new one being set each time isn't being seen where you want it to be.


In reply to Re (tilly) 2: Won't jump to Sub! by tilly
in thread Won't jump to Sub! by SilverB1rd

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-03-28 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found