NAME
Gloom::Doc - All About Gloom
SYNOPSIS
package MyModule::Base;
do 'MyModule/Gloom.pm';
DESCRIPTION
Gloom is a very small OO module that can be used by CPAN modules that need to be OO, but don't want to add a dependency module to do it.
It provides inheritance, standard new
and init
constructor methods, and has
attribute accessors.
HOWTO
If I have an OO CPAN module called Foo, I symlink lib/Foo/Gloom.pm to the Gloom.pm in the Gloom repository (see below). (When you make a tarball, Perl turns the symlink into a copied real file.)
Then I create a module called Foo::Base that looks like this:
package Foo::Base;
do 'Foo/Gloom.pm';
That's it. Now I can make Foo::Bar OO like this:
package Foo::Bar;
use Foo::Base -base;
has 'stuff';
and:
package Foo::Bar::Baz;
use Foo::Bar -base;
has 'more_stuff';
WHY DO?
You don't use Gloom, you do it. Gloom.pm has no package statement. Perl's do
command will still find it in the @ISA
path, but it will eval the code under your package.
REPOSITORY
http://github.com/ingydotnet/gloom-pm
If you use the symlink trick, you'll probably want to checkout this repo next to you other repos.
AUTHOR
Ingy döt Net <ingy@cpan.org>
COPYRIGHT
Copyright (c) 2010. Ingy döt Net.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html