The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

NCGI - A Common Gateway Interface (CGI) Class

SYNOPSIS

  use NCGI;
  my $cgi  = NCGI->new();
  my $html = $cgi->content;

  $html->_goto('head');
  $html->title('A Simple Example');

  $html->_goto('body');
  $html->h1('Simple Form');

  $html->form_open();
  $html->_add("What's your name? ");
  $html->input({type => 'text', name => 'name'});
  $html->input({type => 'submit', name => 'submit', value => 'Submit'});

  $html->form_close();
  $html->hr();

  my $query = $cgi->query;
  if ($query->{submit}) {
    $html->p('I think your name is ', $query->{name});
  }


  if (param()) {
    print "Your name is",em(param('name')),p,
    "The keywords are: ",em(join(", ",param('words'))),p,
    "Your favorite color is ",em(param('color')),
    hr;
  }

  $cgi->respond();

DESCRIPTION

NCGI has the same basic function as the well known CGI module. It is an aide for authors writing CGI scripts. The advantages over CGI are

 * Smaller and simpler Codebase: 300 lines vs 7000 lines
 * Modular/maintainable Codebase: separate Header, XHTML, Query Classes
 * Better output: Based on XML::API for consistent XHTML
 * Better debugging: in-built logging with timing functions
 * Different API

The disadvantages over CGI are

 * Different API
 * Less features
 * Probably not as portable

See http://rekudos.net/parselog/ to see it in action.

METHODS

new(%hash)

Create a "Log::Parse" object. The %hash looks approximately like this:

   my %args  = (
        file        => '',
        filetype    => '',
        handlers    => '',
        libdir      => '',
        step        => '',
        rrdrra      => '',
        apache_domain => '',
        debug       => 0,
        @_
    );

but will vary depending on the type of handlers.

parse()

Parses a logfile and creates RRDs according to the configuration given for the new() method.

SEE ALSO

NCGI::Header, NCGI::Query, XML::API

AUTHOR

Mark Lawrence <nomad@null.net>

COPYRIGHT AND LICENSE

Copyright (C) 2005 Mark Lawrence <nomad@null.net>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.