![]() |
|
Perl-Sensitive Sunglasses | |
PerlMonks |
Re^2: Modules 101 :: Using a Local Module from CPANby stevieb (Canon) |
on Dec 07, 2022 at 04:51 UTC ( #11148638=note: print w/replies, xml ) | Need Help?? |
What GrandFather said. My code isn't a script. In Perl parlance, it's a module. In general programming parlance, it's a library. In Perl, a script is something that is executed; ie. a 'binary'. A module is something that is loaded into the script, and you can use its functionality via its Application Programming Interface (ie. API). We include a library in perl script by use of the use or require "pragma". Other programming languages have similar techniques, named differently (eg. 'import', 'include' etc). In this specific module (Script::Singleton), things are a bit different. There is no API. Just by loading (ie. 'use') the module, all of its functionality is executed inline during the compile phase of the script build. If you're interested, I wrote an explanation of the build/run phases of a perl script many years ago. I can't vouch for how good it is though as I've not time to read it right now ;) OP: you're coming far young grasshopper. Keep up the good work.
In Section
Seekers of Perl Wisdom
|
|