Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: using a variable with require

by NERDVANA (Deacon)
on Jun 22, 2022 at 18:12 UTC ( [id://11144948]=note: print w/replies, xml ) Need Help??


in reply to Re^2: using a variable with require
in thread using a variable with require

The usual pattern for this is to put each implementation into a package hierarchy of objects, then know the package name you want to load, then:

use Module::Load; ... load $package; my $obj= $package->new( %options ); $obj->do_something;

No need for awkward cross-package function-calls.

Log In?
Username:
Password:

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

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

    No recent polls found