Changes between Initial Version and Version 1 of CreatingAModule

Dec 1, 2009, 10:49:48 AM (12 years ago)



  • CreatingAModule

    v1 v1  
     2= BarnOwl Modules =
     4BarnOwl Modules are perl packages that live in the `BarnOwl::Module::` namespace. There are two ways to install a module such that BarnOwl will recognize it:
     6 * As a directory tree: You can install the `MyModule` module with a directory named `MyModule` containing the file `lib/BarnOwl/Module/`
     7 * As a [ PAR package] containing `lib/BarnOwl/Module/`
     9In both cases, the `lib/` directory will be added to perl's library path when your module is loaded, so you can include additional modules there, either to include dependencies or just to divide module code into other perl modules.
     11Modules can be located in either of two directories, the system module path, or the user module path. By default the user module path is at `~/.owl/modules` but this can be overridden with command-line options.
     13= Building a BarnOwl Module =
     15Building a BarnOwl module is easy. The only file ''required'' is the `.pm` Therefore, a minimal module simply contains the directory tree mentioned above, and you can start using the BarnOwl APIs.
     17== Distributing a BarnOwl Module ==
     19`BarnOwl` includes a [ Module::Install] plugin to make deploying modules as `PAR` files easier. Simply create a `Makefile.PL` in the top level of your module directory containing:
     22  #!/usr/bin/env perl
     23  use strict;
     24  use warnings;
     26  use inc::Module::Install;
     28  barnowl_module(MyModule);
     30  WriteAll;
     33You can then run `perl Makefile.PL` and `make MyModule.par` to automatically generate a `.par` file that you can deploy to other BarnOwl users.
     35Note that the first time you run `perl Makefile.PL` you will need to add BarnOwl's system library path to your `$PERL5LIB` On Athena, you would do this like:
     38  env PERL5LIB=/mit/barnowl/share/barnowl/lib perl Makefile.PL
     39  make MyModule.par
     42= Examples =
     44The BarnOwl Source includes two modules, for `Jabber` and `IRC` which are moderately complex examples of how to write a module that implements a new protocol for BarnOwl.
     46`nelhage` has written a number of small useful modules, that are also intended to be good examples for learning. They can be found in AFS at `/afs/` or on the web at []