Toolkit(3) Keep your handy modules organized

VERSION

This document describes Toolkit version 0.0.2

SYNOPSIS


use Toolkit;
# All your favorites are now available

DESCRIPTION

The Toolkit module provides a standard location to store modules that you use all the time, and then loads them for you automatically. For example, instead of always writing:

    use strict;
    use warnings;
    use Carp;
    use Smart::Comments;

in every program/module, you can just write:

    use Toolkit;

and put all your favorite modules in a file:

    > cat $PERL5LIB/Toolkit/Macros/ALWAYS/Modules
    use strict;
    use warnings;
    use Carp;
    use Smart::Comments;

You can also specify load-on-demand subroutines:

    > cat $PERL5LIB/Toolkit/Runtime/prompt
    use IO::Prompt qw( prompt );
    > cat $PERL5LIB/Toolkit/Runtime/say
    sub say { print @_, "\n" }

in which case Toolkit will install an "AUTOLOAD" that installs these subroutines the first time they're called.

INTERFACE

Calling:

    use Toolkit;

with no arguments loads any files in the directories:

    $PERL5LIB/Toolkit/Macros/ALWAYS/
    $PERL5LIB/Toolkit/Macros/DEFAULT/

or any of their subdirectories.

Calling:

    use Toolkit qw(foo bar);

any files in the directories:

    $PERL5LIB/Toolkit/Macros/ALWAYS/
    $PERL5LIB/Toolkit/Macros/foo/
    $PERL5LIB/Toolkit/Macros/bar/

or any of their subdirectories.

Using the Toolkit module in any way also installs an "AUTOLOAD" subroutine which looks in:

    $PERL5LIB/Toolkit/Runtime/

for a file of the same name as the subroutine that is being autoloaded. That is, if you write:

    use Toolkit;
    baz();

Then the module looks for a file:

    $PERL5LIB/Toolkit/Runtime/baz

and executes it in a special namespace. After the file executes, Toolkit expects that the special namespace will now have a subroutine of the required name, which it then calls.

DIAGNOSTICS

Toolkit couldn't open %s
You specified a particular macro for Toolkit to load, but it wasn't able to read the corresponding file. Usually a file permissions problem or a non-existent macro.
Undefined subroutine %s called
You used a subroutine that Toolkit couldn't autoload. Did you misspell the subroutine name, or fail to install a file of the same name in your "$PERL5LIB/Toolkit/Runtime/" subdirectory.
Toolkit could not load %s (running %s didn't install it).
You used a subroutine that Toolkit tried to autoload. It found the corresponding file in the "$PERL5LIB/Toolkit/Runtime/" subdirectory, but executing that file didn't produce a subroutine of the correct name.

CONFIGURATION AND ENVIRONMENT

Toolkit uses the following directories and files to configure its behaviour:
$PERL5LIB/Toolkit/Macros/ALWAYS/
Files in this directory are prepended to your source code whenever Toolkit is used
$PERL5LIB/Toolkit/Macros/DEFAULT/
Files in this directory are prepended to your source code whenever Toolkit is used without arguments
$PERL5LIB/Toolkit/Macros/any file name
These files are prepended to your source code whenever Toolkit is used and their name is specified after the "use Toolkit".
$PERL5LIB/Toolkit/Runtime/
Files in this directory are executed to whenever Toolkit is used and a subroutine of the same name is called. They are expected to define the required subroutine.

DEPENDENCIES

Requires:
  • File::Spec::Functions
  • Filter::Simple
  • version

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to "[email protected]", or through the web interface at <http://rt.cpan.org>.

AUTHOR

Damian Conway "<[email protected]>"

LICENCE AND COPYRIGHT

Copyright (c) 2005, Damian Conway "<[email protected]>". All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.