How to use different PM in different cases.

F

Franklin Lee

Hi ALl,

I have two different libs:
/opt/myapp/lib1/utils.pm
/opt/myapp/lib2/utils.pm

In the main program, I will get parameter, for example, $lib.

If $lib eq lib1, then I want to use /opt/myapp/lib1/utils.pm

If $lib eq lib2, then I want to use /opt/myapp/lib2/utils.pm

How can I design my program?

Thank you!

Franklin
 
G

Gunnar Hjalmarsson

Franklin said:
I have two different libs:
/opt/myapp/lib1/utils.pm
/opt/myapp/lib2/utils.pm

In the main program, I will get parameter, for example, $lib.

If $lib eq lib1, then I want to use /opt/myapp/lib1/utils.pm

If $lib eq lib2, then I want to use /opt/myapp/lib2/utils.pm

How can I design my program?

require "/opt/myapp/$lib/utils.pm";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top