Re: globals and modules

2006-02-20 Thread The Ghost
But that's seems like a lot of extra typing: Then in any part of your code where you use the database handle you can say sub foo { my ($foo, $bar) = @_; my $dbh = Project::DB::Handle->new; my $sth = $dbh->prepare(...); I started out with an HTML::Mason where I've shared $dbh via

Re: globals and modules

2006-02-20 Thread Chas Owens
On 2/20/06, The Ghost <[EMAIL PROTECTED]> wrote: > I have defined $dbh (a database handle) as a global variable. I have > a module, RD, that needs access to the database. How can I use $dbh > within the RD module? > The best way to handle this is to create a singleton object to hold the database

Re: globals and modules

2006-02-20 Thread Tom Phoenix
On 2/20/06, The Ghost <[EMAIL PROTECTED]> wrote: > I have defined $dbh (a database handle) as a global variable. I have > a module, RD, that needs access to the database. How can I use $dbh > within the RD module? Every global variable is in some package, in perl. If you haven't used a package