Apache2-WebApp-Toolkit

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      /var/www/project/conf/webapp.conf                 <-- G
      /var/www/project/htdocs                           <-- H
      /var/www/project/templates/example.tt             <-- I
      /var/www/project/templates/error.tt               <-- J
      /var/www/project/logs                             <-- K
      /var/www/project/logs/access_log
      /var/www/project/logs/errror_log
      /var/www/project/tmp                              <-- L
      /var/www/project/tmp/cache
      /var/www/project/tmp/cache/templates
      /var/www/project/tmp/uploads

    A) Application directory. All classes *(*.pm)* within this directory are
    precompiled into memory when Apache starts/restarts.

    B) Base class that can be "included" from other classes. Contains
    "_global()" and "_error()" methods that can be inherited using:

    Example:

      use base 'Project::Base';

README  view on Meta::CPAN


      [project]
      title              = Project                                 # must not contain spaces or special characters
      author             = Your Name Here
      email              = email@domain.com
      version            = 0.01

      [apache]
      doc_root           = /var/www/project                        # path to project directory
      domain             = www.domain.com                          # valid domain name
      disable_uploads    = 0                                       # allow file uploads
      post_max           = 5242880                                 # post max in bytes (example 5MB)
      temp_dir           = /var/www/project/tmp/uploads

      [template]
      cache_size         = 100                                     # total files to store in cache
      compile_dir        = /var/www/project/tmp/cache/templates    # path to template cache
      include_path       = /var/www/project/templates              # path to template directory
      stat_ttl           = 60                                      # template to HTML build time (in seconds)
      encoding           = utf8                                    # template output encoding

    H) Website sources. This includes HTML, CSS, Javascript, and images.
    When setting up FTP access - restrict access to this directory only.

README.pod  view on Meta::CPAN

  /var/www/project/conf/webapp.conf                 <-- G
  /var/www/project/htdocs                           <-- H
  /var/www/project/templates/example.tt             <-- I
  /var/www/project/templates/error.tt               <-- J
  /var/www/project/logs                             <-- K
  /var/www/project/logs/access_log
  /var/www/project/logs/errror_log
  /var/www/project/tmp                              <-- L
  /var/www/project/tmp/cache
  /var/www/project/tmp/cache/templates
  /var/www/project/tmp/uploads

A) Application directory.  All classes I<(*.pm)> within this directory are precompiled
into memory when Apache starts/restarts.

B) Base class that can be C<included> from other classes.  Contains C<_global()>
and C<_error()> methods that can be inherited using:

Example:

  use base 'Project::Base';

README.pod  view on Meta::CPAN


  [project]
  title              = Project                                 # must not contain spaces or special characters
  author             = Your Name Here
  email              = email@domain.com
  version            = 0.01

  [apache]
  doc_root           = /var/www/project                        # path to project directory
  domain             = www.domain.com                          # valid domain name
  disable_uploads    = 0                                       # allow file uploads
  post_max           = 5242880                                 # post max in bytes (example 5MB)
  temp_dir           = /var/www/project/tmp/uploads

  [template]
  cache_size         = 100                                     # total files to store in cache
  compile_dir        = /var/www/project/tmp/cache/templates    # path to template cache
  include_path       = /var/www/project/templates              # path to template directory
  stat_ttl           = 60                                      # template to HTML build time (in seconds)
  encoding           = utf8                                    # template output encoding

H) Website sources.  This includes HTML, CSS, Javascript, and images.  When setting
up FTP access - restrict access to this directory only.

example/webapp.conf  view on Meta::CPAN


[project]
title              = Project                                 # no spaces or special characters
author             = Your Name Here
email              = email@domain.com
version            = 0.01

[apache]
doc_root           = /var/www/project                        # path to project directory
domain             = www.domain.com                          # valid domain name
disable_uploads    = 0                                       # allow file uploads
post_max           = 5242880                                 # post max in bytes (example 5MB)
temp_dir           = /var/www/project/tmp/uploads

[template]
cache_size         = 100                                     # total files to store in cache
compile_dir        = /var/www/project/tmp/cache/templates    # path to template cache
include_path       = /var/www/project/templates              # path to template directory
stat_ttl           = 60                                      # template to HTML build time (in seconds)
encoding           = utf8                                    # template output encoding

lib/Apache2/WebApp.pm  view on Meta::CPAN

# mod_perl handler - Instanciate Apache2::WebApp::Toolkit objects.

sub handler : method {
    my ($self, $r) = @_;

    my $config = Apache2::WebApp::AppConfig->new;

    $self->{CONFIG} = $config->parse( $ENV{'WEBAPP_CONF'} );

    $self->{REQUEST} = Apache2::Request->new($r,
        DISABLE_UPLOADS => $self->{CONFIG}->{apache_disable_uploads},
        POST_MAX        => $self->{CONFIG}->{apache_post_max},
        TEMP_DIR        => $self->{CONFIG}->{apache_temp_dir}
      );

    $self->{PLUGIN}   = Apache2::WebApp::Plugin->new;
    $self->{STASH}    = Apache2::WebApp::Stash->new;
    $self->{TEMPLATE} = Apache2::WebApp::Template->new( $self->{CONFIG} ); 

    $self->dispatch;
}

lib/Apache2/WebApp.pm  view on Meta::CPAN

  /var/www/project/conf/webapp.conf                 <-- G
  /var/www/project/htdocs                           <-- H
  /var/www/project/templates/example.tt             <-- I
  /var/www/project/templates/error.tt               <-- J
  /var/www/project/logs                             <-- K
  /var/www/project/logs/access_log
  /var/www/project/logs/errror_log
  /var/www/project/tmp                              <-- L
  /var/www/project/tmp/cache
  /var/www/project/tmp/cache/templates
  /var/www/project/tmp/uploads

A) Application directory.  All classes I<(*.pm)> within this directory are precompiled
into memory when Apache starts/restarts.

B) Base class that can be C<included> from other classes.  Contains C<_global()>
and C<_error()> methods that can be inherited using:

Example:

  use base 'Project::Base';

lib/Apache2/WebApp.pm  view on Meta::CPAN


  [project]
  title              = Project                                 # must not contain spaces or special characters
  author             = Your Name Here
  email              = email@domain.com
  version            = 0.01

  [apache]
  doc_root           = /var/www/project                        # path to project directory
  domain             = www.domain.com                          # valid domain name
  disable_uploads    = 0                                       # allow file uploads
  post_max           = 5242880                                 # post max in bytes (example 5MB)
  temp_dir           = /var/www/project/tmp/uploads

  [template]
  cache_size         = 100                                     # total files to store in cache
  compile_dir        = /var/www/project/tmp/cache/templates    # path to template cache
  include_path       = /var/www/project/templates              # path to template directory
  stat_ttl           = 60                                      # template to HTML build time (in seconds)
  encoding           = utf8                                    # template output encoding

H) Website sources.  This includes HTML, CSS, Javascript, and images.  When setting
up FTP access - restrict access to this directory only.

lib/Apache2/WebApp/Helper/Project.pm  view on Meta::CPAN


    mkpath("$doc_root/app",                  $verbose, 0755);
    mkpath("$doc_root/bin",                  $verbose, 0755);
    mkpath("$doc_root/conf",                 $verbose, 0755);
    mkpath("$doc_root/htdocs",               $verbose, 0755);
    mkpath("$doc_root/logs",                 $verbose);
    mkpath("$doc_root/templates",            $verbose);
    mkpath("$doc_root/tmp",                  $verbose);
    mkpath("$doc_root/tmp/cache",            $verbose);
    mkpath("$doc_root/tmp/cache/templates",  $verbose);
    mkpath("$doc_root/tmp/uploads",          $verbose);

    # File::Path ignores default 0777, use chmod instead
    chmod 0777, "$doc_root/logs";
    chmod 0777, "$doc_root/tmp";
    chmod 0777, "$doc_root/tmp/cache";
    chmod 0777, "$doc_root/tmp/cache/templates";
    chmod 0777, "$doc_root/tmp/uploads";

    open (FILE1, ">$doc_root/logs/access_log"   ) or $self->error("Cannot open file: $!"); close(FILE1);
    open (FILE2, ">$doc_root/logs/error_log"    ) or $self->error("Cannot open file: $!"); close(FILE2);
    open (FILE3, ">$doc_root/htdocs/favicon.ico") or $self->error("Cannot open file: $!"); close(FILE3);

    print "created $doc_root/logs/access_log\n"    if ($verbose);
    print "created $doc_root/logs/error_log\n"     if ($verbose);
    print "created $doc_root/htdocs/favicon.ico\n" if ($verbose);

    $self->set_vars({

t/conf/webapp.in  view on Meta::CPAN

[project]
title           = Basic

[apache]
doc_root        = @ServerRoot@
disable_uploads = 0
post_max        = 5242880
temp_dir        = /tmp

usr/share/webapp-toolkit/webapp_conf.tt  view on Meta::CPAN


[project]
title              = [% project_title   %]                      # no spaces or special characters
author             = [% project_author  || 'Your Name Here'   %]
email              = [% project_email   || 'alias@domain.com' %]
version            = [% project_version || '0.01' %]

[apache]
doc_root           = [% apache_doc_root %]                      # path to project directory
domain             = [% apache_domain   %]                      # valid domain name
disable_uploads    = 0                                          # allow file uploads
post_max           = 5242880                                    # post max in bytes (example 5MB)
temp_dir           = [% apache_doc_root %]/tmp/uploads

[template]
cache_size         = 100                                        # total files to store in cache
compile_dir        = [% apache_doc_root %]/tmp/cache/templates  # path to template cache
include_path       = [% apache_doc_root %]/templates            # path to template directory
stat_ttl           = 60                                         # template to HTML build time (in seconds)
encoding           = utf8                                       # template output encoding

[%- USE dir = Directory("$source/plugin/conf") -%]



( run in 0.692 second using v1.01-cache-2.11-cpan-b16cb0d3907 )