Creating a Perl Module
Creating a Perl Module Organic Design procedure |
Package template
Creating a perl package requires a namespace to be specified, and an exit signal of 1 after reading a perl module.
Exporting names
The Exporter package allows convenient short names with the tradeoff of polluting your namespace. See perldoc Exporter
Defining the path
The package needs to be located in the @INC path where a perl script can load and use it.
You can add a new path to @INC with;
inside perl scripts. However, this is hardcoded into the program itself. If you want to specify aditional @INC path information, they environment variable PERL5LIB can be used, e.g.
Example
<perl>
use OD::Wiki;
$odwiki = OD::Wiki->new(
url => 'http://www.organicdesign.co.nz',
user => 'foo',
pass => 'bar'
);
$odwiki->edit( title => 'MyArticle', content => 'foo', summary => 'testing', minor => 1 ); </perl>