Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Export again

by trwww (Priest)
on Feb 21, 2011 at 19:48 UTC ( #889482=note: print w/replies, xml ) Need Help??


in reply to Export again

You have to ->import the symbols in to your library:

use warnings; use strict; package MyStandardModules; use Time::HiRes (); package main; Time::HiRes->import('gettimeofday'); print gettimeofday();

I suggest either calling the function/method qualified with the namespace (ala my $time = Time::HiRes::gettimeofday()) or use()ing the module in the place you need the symbol imported.

Could you explain your adversion to use()ing the module in the package where the function is needed?

Replies are listed 'Best First'.
Re^2: Export again
by Cagao (Monk) on Feb 22, 2011 at 09:19 UTC

    Thanks for all the help so far guys, it's all making sense.

    I'd like to move the "use" statements to one standard location instead of having to "use" several modules in all of my code, plus I can always then be certain that certain functions are always going to be available.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889482]
help
Chatterbox?
[SwaJime]: Ran into an interesting piece of code today ...
[SwaJime]: select name,status, status2 from __ where status & status < 13 and status2 & 16 <> 16
[SwaJime]: I'm thinking that looks messed up. Sorry for OT ... but I know y'all are smart :-)
[SwaJime]: I expected items to not be selected if status was 0 ... but they were selected
[SwaJime]: any thoughts?

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-08-22 17:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (338 votes). Check out past polls.

    Notices?