Dmitry Koterov > Apache-Scriptor-Simple-1.21 > Apache::Scriptor::Simple

Download:
Apache-Scriptor-Simple-1.21.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.21   Source  

NAME ^

Apache::Scriptor::Simple - The simplest way to activate Apache::Scriptor.

SYNOPSIS ^

  #!/usr/local/bin/perl -w 
  # Use "handlers" handler directory:
  use Apache::Scriptor::Simple; 
  # that's all!

  #!/usr/local/bin/perl -w 
  # Custom handler directory:
  use Apache::Scriptor::Simple("myhandlers"); 
  # that's all!

DESCRIPTION ^

This module is used to make the work of creation Apache handler schipt easily. See example in Apache::Scriptor module.

EXAMPLE ^

  ### File /.htaccess:
    # Setting up the conveyor for .htm:
    # "input" => eperl => s_copyright => "output" 
    Action     perl "/_Kernel/Scriptor.pl"
    AddHandler perl .htm
    Action     s_copyright "/_Kernel/Scriptor.pl"
    AddHandler s_copyright .htm

  ### File /_Kernel/Scriptor.pl:
    #!/usr/local/bin/perl -w 
  use Apache::Scriptor::Simple; 

  ### File /test.htm:
    print "<html><body>Hello, world!</body></html>";

  ### File /_Kernel/handlers/s_copyright.pl:
    sub s_copyright
    {  my ($input)=@_;
       -f $ENV{SCRIPT_FILENAME} or return -1; # Error indicator
       # Adds the comment string BEFORE all the output.
       print '<!-- Copyright (C) by Dmitry Koterov (koterov at cpan dot org) -->\n'.$input;
       return 0; # OK
    }

  ### Then, user enters the URL: http://ourhost.com/test.htm.
  ### The result will be:
    Content-type: text/html\n\n
    <!-- Copyright (C) by Dmitry Koterov (koterov at cpan dot org) -->\n
    Hello, world!

AUTHOR ^

Dmitry Koterov <koterov at cpan dot org>, http://www.dklab.ru

SEE ALSO ^

Apache::Scriptor.

syntax highlighting: