> I have a CGI application where I do: > > require 'db.pl'; > > where db.pl defines some functions and variables related to connecting to > the database, and then executes C<$dbh = DBI->connect(...)>. <snip> > I can get around this by changing C<require> to C<do>, but is that the > "correct" way of doing things? No. Put the connect stuff in a subroutine and call it from your application. Things in the main section of a required file are only supposed to run once. - Perrin
- require v.s. do in modperl Philip Mak
- Re: require v.s. do in modperl Gunther Birznieks
- Re: require v.s. do in modperl Perrin Harkins
- Re: require v.s. do in modperl Gunther Birznieks
- Re: require v.s. do in modperl Perrin Harkins
- Re: require v.s. do in modperl Nick Tonkin
- Re: require v.s. do in modperl Gunther Birznieks