On Tue, 2004-02-10 at 21:13, ian douglas wrote:
> We have a 'base' script, which I'll call webapp.pl, which requires a number of
> other scripts, including a script that loads up a number of cursors for our
> database at startup so they don't get prepared over and over and over. The
> scoping of the cursor names is giving me grief though

Ian,

To be blunt, this code has a lot of problems.

You should be using modules, not .pl files with no namespace declared,
and I believe that is the source of your current trouble with use vars. 
Are you using "strict"?

You also should be using subs with actual return values, not just having
them shove things into globals.  It makes your code really hard to read
and debug.  You wouldn't need comments like "defined in foo.pl" if you
followed the standard programming practice of returning values and
assigning them to variables in the calling script.

Putting request-specific things like cookies into globals could cause a
lot of problems because those values are persistent in mod_perl.

Don't use hundreds of variables with names like $cursor1, $cursor2.  Use
an array ( $cursors[1], $cursors[2] ) or a hash with meaningful names (
$cursors{'some_task'}, $cursors{'something_else'} ).
 
Sorry to be harsh, but your current issue is just the tip of the iceberg
here.

- Perrin


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to