Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Using objects in exported functions

by Anomynous Monk (Scribe)
on May 31, 2004 at 11:06 UTC ( [id://357766]=note: print w/replies, xml ) Need Help??


in reply to Using objects in exported functions

Can you explain more what you don't like about it? You seem to want to be accessing a global from another package; code that explicitly says that ($main::dbh) would seem to me to be the way to go.

But, if you really want, you could put package main; our $dbh; before the package Exported line; then simply $dbh will refer to the one in main.

Or, at some miniscule risk of perl later trying to use the same name for some internal purpose, you could use a "punctuation variable" like ${^Dbh}. Such variables are always looked for in package main.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://357766]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-24 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found