The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::Pillbug - Stand-alone HTML::Mason-enabled server

SYNOPSIS

Install Devel::Pillbug:

  > perl -MCPAN -e 'install Devel::Pillbug';

Start Devel::Pillbug:

  > pillbug;

All arguments are optional:

  > pillbug -host example.com -port 8080 -docroot /tmp/foo

Do it in Perl:

  use Devel::Pillbug;

  my $port = 8000; # Optional argument, default is 8080

  my $server = Devel::Pillbug->new($port);

  #
  # Optional: Use methods from HTTP::Server::Simple
  #
  # $server->host("example.com");

  #
  # Optional: Override the document root
  #
  # $server->docroot("/tmp/foo");

  #
  # See docs or "pillbug -h" for further options
  #

  $server->run;

DESCRIPTION

Devel::Pillbug is a stand-alone HTML::Mason server, extending HTTP::Server::Simple::Mason. It is designed for zero configuration and easy install from CPAN.

The "public_html" or "Sites" directory of the user who launched the process will be used for the default document root. Files ending in "html" are treated as Mason components. These and other behaviors may be overridden as needed.

METHODS

See HTTP::Server::Simple and HTTP::Server::Simple::Mason for inherited methods.

CLASS METHODS

  • $class->net_server($newServerType)

    Returns the currently active Net::Server subclass.

    Sets the server type to the specified Net::Server subclass, if one is supplied as an argument.

    Default value is Net::Server::PreFork.

  • $class->handler_class($newHandlerClass)

    Returns the currently active HTML::Mason::Request subclass.

    Sets the server type to the specified HTML::Mason::Request subclass, if supplied as an argument.

    Default value is Devel::Pillbug::MasonHandler.

INSTANCE METHODS

  • $self->docroot($docroot)

    Returns the currently active docroot.

    The server will set its docroot to the received absolute path, if supplied as an argument.

  • $self->index_name($name)

    Returns currently used index name, without extension (default is "index").

    Sets this to the received name, if supplied as an argument.

  • $self->comp_ext($extension)

    Sets the file extension used for Mason components (default is "html")

  • $self->allow_index($bool)

    Returns the current allowed state for directory indexes.

    Sets this to the received state, if supplied as an argument.

    0 = Off, 1 = On

  • $self->pretty_html_header($fragment)

    Prints the HTML fragment used for everything up to and including the "<body>" tag of internally-generated documents (errors and directory listings).

    Sets the fragment to the received string, if supplied as an argument.

  • $self->pretty_html_footer($fragment)

    Prints the HTML fragment used for everything below and including the "</body>" tag of internally-generated documents.

    Sets the fragment to the received string, if supplied as an argument.

CONFIGURATION AND ENVIRONMENT

The document root must exist and be readable, and Devel::Pillbug must be able to bind to its listen port (default 8080).

BUGS

Absolutely...

Currently, several brutish hacks are employed to work around minor issues in modules which Pillbug needs. These hacks will need to go away and/or be revisited over time.

Please use the CPAN RT system or contact me if you find something which isn't working as advertised.

VERSION

This document is for version .006 of Devel::Pillbug.

AUTHOR

Alex Ayars <pause@nodekit.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010, Alex Ayars <pause@nodekit.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0 or later. See: http://dev.perl.org/licenses/

SEE ALSO

File::HomeDir, Media::Type::Simple, Net::Server::PreFork.

This module extends HTTP::Server::Simple::Mason.