Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

perl module inside perl script? 1

Status
Not open for further replies.

Hemo

Programmer
Apr 9, 2003
190
US

I am using a perl module (Config::Tiny) and for portability reasons am wondering if it is possible to include a perl module within the code of the perl program itself?

I've not done this before and wondering if it is possible and how to go about doing so.

The module itself is a single .pm file.
 
Well, looking at a perl module it's just a script plus some overhead.

If you start embedding the module (meaning copying all subs/functions into the script) you have to be very carefull with variables since they might also occur in your "own" script.

Note however that it will deliver a lot of maintenance problems and possibly size problems.
 
If you copy the entire module, including the package declaration, into the bottom of your file it should work fine.

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Because of the benefits of using modules I would advise against this because if there are updates for this module, you'll miss out on any new functionality.

You'd be better off to have your installation process to determine if your dependencies exist, and if not install them.

Just a thought
Best Regards
--Paul
 
quite true, though I've done it sometimes

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top