Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: inconsistent module access (require vs use)

by LanX (Saint)
on Jun 25, 2022 at 10:18 UTC ( [id://11145033]=note: print w/replies, xml ) Need Help??


in reply to Re^2: inconsistent module access
in thread inconsistent module access

My most esteemed brethren choroba and HaukeX already nailed down your problem.

But you seem to be confused about the difference between use and require

from the docs

    use Module

    Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package. It is exactly equivalent to

    BEGIN { require Module; Module->import( LIST ); }

    except that Module must be a bareword. ...

BEGIN happens at compile-time, if you want to use a module at run-time, you always need to call

->import

too.

It's also an FAQ, plz see

--> What's-the-difference-between-require-and-use?

and plz follow the various links embedded in this node to round up the picture.°

HTH! :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) well you could already have followed some of them before

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-03-28 11:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found