Anansi::Script - Manages how Perl script user input and process output should be handled.
#!/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;
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.
Declared in Anansi::ComponentManager.
$OBJECT->SUPER::addComponent(undef); $OBJECT->Anansi::ComponentManager::addComponent(undef);
Declared in Anansi::ComponentManager. Overridden by this module. Redeclared in order to preclude inheritance.
Declared in Anansi::Singleton.
$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.
Declared as a virtual method in Anansi::Singleton.
Declared as a virtual method in Anansi::Class.
Declared in Anansi::Class.
$OBJECT::SUPER->initialise(@_); $OBJECT->Anansi::Script::initialise(@_);
Declared as a virtual method in Anansi::Class. Overridden by this module. Indirectly called during object construction.
$OBJECT->SUPER::removeComponent(undef); $OBJECT->Anansi::ComponentManager::removeComponent(undef);
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.
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.
Kevin Treleaven <kevin AT treleaven DOT net>
To install Anansi::Script, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Anansi::Script
CPAN shell
perl -MCPAN -e shell install Anansi::Script
For more information on module installation, please visit the detailed CPAN module installation guide.