Agent-TCLI-Package-Net

 view release on metacpan or  search on metacpan

lib/Agent/TCLI/Package/Net/HTTPD.pm  view on Meta::CPAN


sub _preinit :PreInit {
	my ($self,$args) = @_;

	$args->{'name'} = 'tcli_httpd';

	$args->{'session'} = POE::Session->create(
      object_states => [
          $self => [qw(
          	_start
          	_stop
          	_shutdown
          	_default
          	_child

			establish_context
			settings
			show
			spawn
			stop
			uri

			OK200
			NA404
			BeGone
			Log

			)],
      ],
      'heap' => $self,
	);
}

sub _init :Init {
	my $self = shift;

	$self->LoadYaml(<<'...');
---
Agent::TCLI::Parameter:
  name: address
  constraints:
    - NETADDR_IP4HOST
  help: An address to listen on
  manual: >
    The IP address for the HTTPD to listen on. Must already be configured
    on the system.
  type: Param
---
Agent::TCLI::Parameter:
  name: port
  constraints:
    - UINT
    -
      - BETWEEN
      - 1
      - 65535
  default: 8080
  help: A port to listen on
  manual: >
    Port sets the port used for the HTTPD to receive requests on.
    It must not already be in use by another process. If is is less
    than 1024, then the script must already be running as root or
    the HTTPD will fail to start. Port defaults to 8080.
  type: Param
  class: numeric
---
Agent::TCLI::Parameter:
  name: hostname
  constraints:
    - ASCII
  help: A hostname that the server will respond back with.
  manual: >
    The host nmae is the name the server will respond back with. It
    does not have to be the correct DNS name for the server. It will default
    to Sys::Hostname.
  type: Param
---
Agent::TCLI::Parameter:
  name: regex
  constraints:
    - ASCII
  help: A regular expression pattern
  manual: >
    The regex should be a string that can be evaluated inside a regular
    expression. It should not include the delimeters or be provided in
    qr() form.
  type: Param
---
Agent::TCLI::Parameter:
  name: logging
  help: Turn on logging to the Tail command line queue
  manual: >
    The logging switch turns on logging to the line queue monitored by the
    Tail command. This does not write to logs disk. One may then set up
    Tail tests for specific URI's to determine exactly which ones got through.
    To turn off, use no_logging.
    By default the line queue will only hold 10 lines so memory cannot
    accidentally be exhausted.
  type: Switch
---
Agent::TCLI::Parameter:
  name: response
  aliases: resp
  constraints:
    - ASCII
    -
      - IN_ARRAY
      - OK200
      - NA404
      - BeGone
  default: OK200
  help: The desired response
  manual: >
    The response must be one of the pre-defined responses. Currently these are:
    OK200, NA404, BeGone.
    The default is OK200.
  type: Param
---
Agent::TCLI::Parameter:
  name: handlers
  help: Show the active handlers



( run in 0.613 second using v1.01-cache-2.11-cpan-39bf76dae61 )