NAME
    CGI::Application::Plugin::CaptureIO - Plug-in capture cache

VERSION
    0.01

SYNOPSIS
      use Your::App;
      use CGI::Application::Plugin::CaptureIO;

DESCRIPTION
    When all output contents are preserved in the cache, and the same next
    request is transmitted,

    it is a plug-in that outputs contents preserved in the cache.

    The effect is demonstrated as a load measures on the screen where the
    update is not very frequent

    though there are a lot of requests.

METHOD
  add_non_capture_runmodes
    Runmode that doesn't preserve contents in the cache is set.

    Example:

      sub setup {
 
         my $self = shift;
         $self->run_modes(
                          mode => "mode1",
                          mode2 => "mode2",
                          non_capture => "non_capture",
                          non_capture2 => "non_capture2",
                         );
         # Neither runmode non_capture nor non_capture2 cache contents. 
         $self->add_non_capture_runmodes(qw(non_capture non_capture2));
      }

  capture_init
    It sets it in the early preserving capture.

    Option:

      capture_clear   : The contents capture file and the directory not referred to whenever capture_init is executed when setting
                        it to "1" are deleted. 
                        The file and the directory from which several or more are not accessed are deleted at 
                        the second set with capture_ttl option.
                        defualt 0

      capture_ttl     : Contents are acquired, and output from the contents capture file in second when the
                        contents capture file specified that it preserves contents once survival time (The unit: second)
                        with capture_ttl number's passing. 
                        default 60

      capture_dir     : Directory that preserves contents capture file. default /tmp/cgiapp-capture/

      non_capture_rm  : Runmode that doesn't preserve contents in the cache is set.

    Example:

      sub cgiapp_init {
  
        my $self = shift;
        $self->capture_init(
                            capture_clear  => 0,
                            capture_ttl    => 60,
                            capture_dir    => "/home/akira/myapp/tmp",
                            non_capture_rm => [qw(non_capture1 non_capture2)],
                           );
      }

  current_url
    Current URL is returned.

    Example:

      sub mode1 {
 
         my $self = shift;

         # when current url is http://www.hogehoge.hoge/app?mode=mode1, http://www.hogehoge.hoge/app?mode=mode1 is stored in $current_url
         my $current_url = $self->current_url;
      }

  delete_non_capture_runmodes
    Runmode that doesn't preserve the capture contents set with
    add_non_capture_runmodes and

    capture_init is released.

    Example:

      $self->delete_non_capture_runmodes(qw(capture_mode1 capture_mode2));

TIPS
    It preserves in the capture cash file in case of as it is runmode that
    it is runmode or is error_mode

    specified with AUTOLOAD of $self->run_modes (Perhaps, when runmode that
    corresponds to the above-mentioned is called,

    everybody : about contents it is to be sure not to have to preserve it
    by them),

    and execute $self->add_non_capture_runmodes in AUTOLOAD and error_mode
    to make it not preserve,

    please under the present situation.

      # setup
      sub setup {
          my $self = shift;
          $self->start_mode("mode1");
          $self->mode_param("mode");
          $self->error_mode("error");
          $self->run_modes(
                          mode1 => "mode1",
                          mode2 => "mode2",
                          mode3 => "mode3",
                          mode4 => "mode4",
                          AUTOLOAD => "catch_exception",
                         );
      }
 
      # error mode
      sub error {
        my($self, $error) = @_;
        # require!!
        $self->add_non_capture_runmodes($self->get_current_runmode);
        # process start...
      }
 
      # AUTOLOAD mode
      sub catch_exception {
        my($self, $intended_runmode) = @_;
        # require!!
        $self->add_non_capture_runmodes(intended_runmode);
        # process start...
      }

NOTES
    This plug-in obtains a large hint from Sledge::Plugin::CacheContents of
    Sledge Web Application Flamework.

    The function that Sledge and Sledge::Plugin::CacheContents are excellent
    can have been mounted as a plug-in of CGI::Application.

SEE ALSO
    Carp CGI::Application Digest::SHA1 Exporter File::Find File::Path
    File::Spec File::stat Storable

AUTHOR
    Akira Horimoto <emperor.kurt@gmail.com>

COPYRIGHT
    Copyright (C) 2006 Akira Horimoto

    This module is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.