Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Passing Variables

by Anonymous Monk
on Oct 23, 2004 at 18:20 UTC ( [id://401899]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Passing Variables

That has worked!
Now, on the same lines of thinking... If I call use DBI; in my script.cgi file, Do I need to recall use DBI; in the Module.pm or is there a way to export the already called modules to modules called from the Main Thanks again Ironicsky

Replies are listed 'Best First'.
Re^2: Passing Variables
by pg (Canon) on Oct 23, 2004 at 18:22 UTC

    It makes sense for you to create connection from a single place of your application, and then pass the connection to the rest (for example your modules).

      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?
        "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?

        so, If I passed $dbh into a method, then that method should beable to access all functions attached to $dbh?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://401899]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.