as has been pointed out..your database handle becomes invalid from script to script, as they are individual instances of perl. in case of using mod_perl on a webserver you have to be aware of a basic gotcha..mod_perl runs one instance of perl and bootstraps the script code into it. this produces some weird results if you're not careful with variables, as these (variables of same name) will keep their values from previous run. this would explain you being able to print a (supposedly valid) reference to the database handle from the second script. Unfortunatelly this is just a left over value due to mod_perl side effects, but the database handle is actually invalid.
from what i understand of your web application, it doesn't need to keep sessions alive and complex state handling. I understand that one script gets some form input and generates a clickable table or form or such. then clicking on this calls the second script to generate more output etc. For this kind of thing you make each script totally independent and "atomic". first script gets called: process input, open database, read, close database, generate output. second script would do exactly same. without special attention, coupling these separate scripts closer together is a recipe for problems.
the hardest line to type correctly is: stty erase ^H
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.