G'day bishop729,
Welcome to the Monastery.
If a module is installed, you can simply put
use Some::Module;
in your code (see use for some variations on that syntax).
If you don't want your users to have to install anything, you can put the module source in your repo. Something like this:
bin/ script.pl lib/ Some/ Module.pm
You can use FindBin so your code can find the module.
Be aware that you'll need to keep copies of Some::Module in all repos; all fixes, enhancements, extensions, etc. will need to be kept in sync across all repos. This tends towards a maintenance nightmare and I certainly don't recommend it; however, if it's a requirement that users don't install modules, this is probably what you'll need to do.
I don't know how familiar you are with writing modules. I'd recommend using Exporter to avoid namespace pollution. Your code might look something like this:
package Some::Module; use strict; use warnings; our $VERSION = '0.001'; use Exporter 'import'; our @EXPORT_OK = qw{isnum isint isfloat}; our %EXPORT_TAGS = (all => [@EXPORT_OK]); sub isnum { ... } sub isint { ... } sub isfloat { ... } 1;
And don't forget to add your POD after that.
See also:
— Ken
In reply to Re: Portable way of checking if a scalar is a number / integer / float
by kcott
in thread Portable way of checking if a scalar is a number / integer / float
by bishop729
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |