Re: problems with require, subs and databasehandles

2003-11-04 Thread Wiggins d'Anconia
peter grotz wrote: Hi, [...] Why don´t use $dbh as a global? Now in this way it works for me at this time! In general using globals in this way is considered bad form. It is considered bad form because as the number of lines, modules, etc. grows in the program it becomes harder and harder to

Re: problems with require, subs and databasehandles

2003-11-04 Thread peter grotz
Hi, first, thanks fro your answer! Wiggins d Anconia schrieb: [...] Your 'dbh' is lexically scoped, which means it goes out of view at the end of the file, therefore it will not be available for use in your subroutine. Using either 'our' or 'use vars' will fix the symptom, see below for more a

Re: problems with require, subs and databasehandles

2003-11-04 Thread Wiggins d Anconia
> Hello, > > I have a main prog and some subs in different files. > At runtime I use "require ´pathtofile/´;" to include these files to the > main prog as subs. In the main prog I´m using the modul HandySQL3 with a > databasehandle let´s say > > /snip/ > ##main prog ## use strict; use warnings

problems with require, subs and databasehandles

2003-11-04 Thread peter grotz
Hello, I have a main prog and some subs in different files. At runtime I use "require ´pathtofile/´;" to include these files to the main prog as subs. In the main prog I´m using the modul HandySQL3 with a databasehandle let´s say /snip/ ##main prog ## require ´./sub.pl´; use HandySQL3; my $dbh