I will attempt to explain how to put some generally useful function into a "module" so that you can call it from other programs.
Best way, is by example:
Make a file called TEST_GIZMO.pm and stick this code into it:
Now make a file called test_module.pl and stick this
code into it:
#!/usr/bin/perl -w
use strict;
use TEST_GIZMO;
test1;
test2;
TEST_GIZMO::test1; #this is "fully qualified name", a way to
#invoke test1 even if that name wasn't
#explicitly exported.
When you run test_module.pl, you should see:
test1 in TEST GIZMO worked!
test2 in TEST GIZMO worked!
test1 in TEST GIZMO worked!
I hope that this is enough "boiler plate" for you to create your own library functions. There is of course a lot to this subject, but I hope I got you started! |