Kevin Treleaven

NAME

Anansi::Script - Manages how Perl script user input and process output should be handled.

SYNOPSIS

    #!/usr/bin/perl

    use Anansi::Script;

    my $OBJECT = Anansi::Script->new();
    if(defined($OBJECT)) {
        my $channels = $OBJECT->channel();
        if(defined($channels)) {
            my %channelHash = map { $_ => 1 } (@{$channels});
            if(defined($channelHash{MEDIUM})) {
                my $medium = $OBJECT->channel('MEDIUM');
                if('CGI' eq $medium) {
                    $OBJECT->channel('CONTENT', << "HEREDOC"
    <html>
     <body>
      <p>This Perl script was run using the Common Gateway Interface.</p>
     </body>
    </html>
    HEREDOC
                    );
                } elsif('SHELL' eq $medium) {
                    $OBJECT->channel('CONTENT', 'This Perl script was run using the Shell.'."\n");
                }
            }
        }
    }

    1;

DESCRIPTION

Determines the medium used to run the Perl Script and implements the resources to handle the user input and process output. Simplifies the interaction mechanism and enables the Perl Script to be used in different mediums. See Anansi::ComponentManager for inherited methods.

INHERITED METHODS

addChannel

Declared in Anansi::ComponentManager.

addComponent

    $OBJECT->SUPER::addComponent(undef);

    $OBJECT->Anansi::ComponentManager::addComponent(undef);

Declared in Anansi::ComponentManager. Overridden by this module. Redeclared in order to preclude inheritance.

channel

Declared in Anansi::ComponentManager.

component

Declared in Anansi::ComponentManager.

componentIdentification

Declared in Anansi::ComponentManager.

components

Declared in Anansi::ComponentManager.

DESTROY

Declared in Anansi::Singleton.

finalise

    $OBJECT->SUPER::finalise(undef);

    $OBJECT->Anansi::Script::finalise(undef);

Declared as a virtual method in Anansi::Class. Overridden by this module. Indirectly called during object destruction.

fixate

Declared as a virtual method in Anansi::Singleton.

implicate

Declared as a virtual method in Anansi::Class.

import

Declared in Anansi::Class.

initialise

    $OBJECT::SUPER->initialise(@_);

    $OBJECT->Anansi::Script::initialise(@_);

Declared as a virtual method in Anansi::Class. Overridden by this module. Indirectly called during object construction.

new

Declared in Anansi::Singleton.

old

Declared in Anansi::Class.

priorities

Declared in Anansi::ComponentManager.

reinitialise

Declared as a virtual method in Anansi::Singleton.

removeChannel

Declared in Anansi::ComponentManager.

removeComponent

    $OBJECT->SUPER::removeComponent(undef);

    $OBJECT->Anansi::ComponentManager::removeComponent(undef);

Declared in Anansi::ComponentManager. Overridden by this module. Redeclared in order to preclude inheritance.

used

Declared in Anansi::Class.

uses

Declared in Anansi::Class.

METHODS

channelComponent

    my $return = $OBJECT->channelComponent($component, 'some channel');

Attempts to create a new subroutine to enable the direct use of a channel of the currently loaded component and define it as a channel of this module. If a channel with the same name as the component channel already is defined for this module then it silently fails. If a subroutine with the same name as the channel does not exist in this module's namespace then that subroutine name is used otherwise it remains anonymous. Returns 0 (zero) on failure and 1 (one) on success.

NOTES

This module is designed to make it simple, easy and quite fast to code your design in perl. If for any reason you feel that it doesn't achieve these goals then please let me know. I am here to help. All constructive criticisms are also welcomed.

AUTHOR

Kevin Treleaven <kevin AT treleaven DOT net>