NAME
Badger - Perl Application Programming Toolkit
SYNOPSIS
use Badger;
# 1) have more fun
# 2) get the job done quicker
# 3) make your code shinier
# 4) finish work early
# 5) go skateboarding
# 6) enjoy life
WARNING
This is the first version of the Badger Toolkit. It should be treated as
*alpha* quality code.
!!! READ THE MORE DETAILED WARNING IN Badger.pm !!!
DESCRIPTION
The Badger toolkit is a collection of Perl modules designed to simplify
the process of building object-oriented Perl applications. It provides a
set of foundation classes upon which you can quickly build robust and
reliable systems that are simple, sexy and scalable. All modulo the
warning above.
Overview
Let's take a quick frolic through the feature list forest to get an idea
what "Badger" is all about.
Foundation classes for OO programming
Badger includes base classes for creating regular objects
(Badger::Base), mixin objects (Badger::Mixin), prototypes/singletons
(Badger::Prototype), factory classes (Badger::Factory) and central
resource hubs (Badger::Hub).
Class Metaprogramming
The Badger::Class module employs metaprogramming techniques to
simplify the process of defining object classes. It provides methods
to automate many of the annoying trivial tasks required to
"bootstrap" an object class: specifying base classes, version
numbers, exportable symbols, defining constants, loading utility
functions from external modules, creating accessor and mutator
methods, and so on. There are also methods that simplify the process
of accessing class data (e.g. package variables) to save all that
mucking about in symbols tables. Some of these methods will also
account for inheritance between related classes, making it much
easier to share default configuration values between related
classed, for example.
Badger::Class can itself be subclassed, allowing you to build your
own metaprogramming modules tailored to your particular needs.
Error handling and debugging
Base classes and mixin modules provide functionality for both *hard
errors* in the form of exception-based error handling and *soft
errors* for declining requests (e.g. to fetch a resource that
doesn't exist) that aren't failures but require special handling.
Methods for debugging and raising general warnings are also
provided. Generic hooks are provided for receiving notification of,
or implementing custom handling for errors, warnings and declines.
Running alongside this is a generic message formatting system that
allow you to define all error/warning/debug messages in one place
where they can easily be localised (e.g. to a different spoken
language) or customised (e.g. to generate HTML format instead of
plain text).
Symbol Exporter
Badger implements an object oriented version of the Exporter module
in the form of Badger::Exporter. It works correctly with respect to
class inheritance (that is, a subclass automatically inherits the
exportable symbols from its base classes) and provides a number of
additional features to simplify the process of defining exportable
symbols and adding custom import hooks.
Standard utilities and constants.
The Badger::Utils module provides a number of simple utility
functions of its own as well as acting as a delegate to various
other standard utility modules (e.g. Scalar::Util, Digest::MD5,
etc). Badger::Constants defines various constants used by the Badger
modules and also of general use. Both these modules are designed to
be subclassed so that you can create your own collections of utility
functions, constants, and so on.
Filesystem modules
The Badger::Filesystem module and friends provide an object-oriented
interface to a filesystem. Files and directories are represented as
Badger::Filesystem::File and Badger::Filesystem::Directory objects
respectively. As well as being useful for general filesystem
manipulation (in this respect, they are very much like the
Path::Class modules), the same modules can also be used to represent
virtual filesystems via the Badger::Filesystem::Virtual module. This
allows you to "mount" a virtual file system under a particular
directory (useful when you're dealing with web sites to map page
URLs, e.g. /example/page.html, to the source files, e.g.
/path/to/example/page.html). You can also create a virtual file
system that is a composite of several root directories (if you're
familiar with the Template Toolkit then think of the way the
"INCLUDE_PATH" works).
Codec modules
Going hand-in-hand with many basic filesystem operations, the codec
modules provide a simple object interface for encoding and decoding
data to and from any particular format. The underlying functionality
is provided by existing Perl modules (e.g. MIME::Base64, Storable,
YAML, etc). The codec modules are wrappers that provide a standard
interface to these various different modules. It provides both
functional and object oriented interfaces, regardless of how the
underlying module works. It also provides the relevant hooks that
allow codec objects to be composed into pipeline sequences.
Free
Badger is Open Source and "free" in both "free beer" and "free
speech" senese of the word. It's 100% pure Perl and has no external
dependencies on any modules that aren't part of the Perl core.
Badger is the base platform for version 3 of the Template Toolkit
(coming RSN) and has portability and ease of installation as primary
goals. Non-core Badger add-on modules can make as much use of CPAN
as they like (something that is usually to be encouraged) but the
Badger core will always be dependency-free to keep it
upload-to-your-ISP friendly.
FURTHER INFORMATION
See the documentation included with the Badger modules, starting with
Badger.pm. Or look online:
http://badgerpower.com/
AUTHOR
Andy Wardley <
[email protected]>
COPYRIGHT
Copyright (C) 1996-2008 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.