2009/7/21 Tomáš Bažant <tbaz...@suse.cz>: > i'm writing a web application using %SUBJ% and would like to set 'our > $dbh = ...' so that i do not need to pass db handler as an argument to > functions in different packages every time i need. but this 'global' > variable is not seen inside imported package as $::dbh (as it is in > normal non-mod_perl application).
The scoping of variables is not changed by mod_perl. When you declare a package variable, you should be able to see it from other packages, but you won't be able to refer to it as $dbh except in the package where you declared it. Example: package Foo; our $dbh; $dbh->ping; # works package Bar; $dbh->ping; # fails You can still use the fully-qualified name to get at it: $Foo::dbh. - Perrin