in reply to Re^2: Passing Variables
in thread Passing Variables

But how to I pass a connection? would I do it like
use DBI; use Module; $dbh- dbi->connect(...); $variable = $packageName->routine($dbh);
or is there a better way to make the Module Assume that everything called in the main script is useable?

Replies are listed 'Best First'.
Re^4: Passing Variables
by pg (Canon) on Oct 23, 2004 at 22:27 UTC
    "or is there a better way to make the Module Assume that everything called in the main script is useable?"

    Unfortunately that is not the better way, many monks here can give a long lecture as why, but let me just make it simple: why should the person call your module know that, inside your module, you expect the connection being named $dbh, not $connection, or $blah?

Re^4: Passing Variables
by Anonymous Monk on Oct 23, 2004 at 22:34 UTC
    so, If I passed $dbh into a method, then that method should beable to access all functions attached to $dbh?

      Yes, when a function gets passed a blessed reference (a reference to an object) then the methods associated with that object are available without explicitly importing them.