Perlbal documentation

Mark Smith marksmith at
Tue Oct 12 17:43:57 PDT 2004


Long time no talk!  Good to hear from you.

Perlbal is designed to be really flexible.  You can intercept pretty
much any step of the process really easily using our plugin system.  For
example, to do cacheing work, you could have a plugin override this:

# for Foo plugin class, register a start_serve_request hook handler
$svc->register_plugin('Foo', 'start_serve_request', sub {
    my Perlbal::ClientHTTPBase $obj = $_[0];
    my $uriref = $_[1];

    if ($$uriref =~ m!^/static-content.html!) {
        # now you know the uri wanted, you can go load it from wherever
        # you have your static documents stored... in memory, on disk,
        # or wherever... be wary of doing syncronous operations though

        # setup some handlers for handling events
        $obj->set_read_handler(sub { ... });
        $obj->set_write_handler(sub { ... });
        $obj->set_err_handler(sub { ... });
        $obj->set_hup_handler(sub { ... });
        $obj->set_close_handler(sub { ... });
        # note: the above aren't implemented just yet, but would be very
        # easy to add if you need them.  what is implemented is changing
        # the internal state of the object (what will be served, error
        # status, etc)

        # returning 1 means that we suspend all normal processing for
        # this connection, as you've handled everything here
        return 1;

    return 0;

As just an example.  You can see more plugins in our CVS repository, in
the wcmtools/perlbal/lib/Perlbal/Plugin/ directory.

On Tue, Oct 12, 2004, Benjamin Krueger wrote:
> Excellent stuff. While I've got you on the line, so to speak, I wanted
> to ask how extensible it is. Specifically, we're looking for a proxy
> which can also compress http content to end-users, and do some
> light-weight caching. For example, caching and serving a set of most
> frequently accessed "static" pages (they're dynamic, but only in the
> fact that they're regenerated over specific time intervals and then
> cached). How complex is it for us to implement these types of features
> as plug-ins for perlbal. Does it lend itself to that kind of
> customization?
> --
> Benjamin Krueger
> CarDomain Network, Inc.
> Tel. 206 926 2147
> Fax. 206 926 2299

Mark Smith
junior at

More information about the perlbal mailing list