[Jifty-commit] jifty branch, plack-rebased, updated. 5c91a68cc2a029f86d491c709bf9d0ef1bcd5040

Jifty commits jifty-commit at lists.jifty.org
Sun Feb 7 01:38:09 EST 2010


The branch, plack-rebased has been updated
       via  5c91a68cc2a029f86d491c709bf9d0ef1bcd5040 (commit)
      from  1d42aeef424ebdd07a13c300c15357d1b3bfc4c9 (commit)

Summary of changes:
 Changelog                  |    8 ++++----
 lib/Jifty/Plugin/Compat.pm |   28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit 5c91a68cc2a029f86d491c709bf9d0ef1bcd5040
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Sun Feb 7 14:38:02 2010 +0800

    provide handler->cgi in compat plguin.

diff --git a/Changelog b/Changelog
index 03daddd..39fb4a0 100644
--- a/Changelog
+++ b/Changelog
@@ -8,10 +8,10 @@ INCOMPATABILITIES
  * The following methods are removed:
    - Jifty->handler->apache
    - Jifty->handler->cgi
-
-   Most methods for ->apache are provided by the Compat plugin, which
-   is automatically loaded for existing jifty apps.  Use corresponding
-   header methods of Jifty->web->request and Jifty->web->response.
+   Most methods for ->apache and ->cgi are provided by the Compat
+   plugin, which is automatically loaded for older jifty apps.  Use
+   corresponding header methods of Jifty->web->request and
+   Jifty->web->response.
 
  * Printing to STDOUT deprecated.  Use outs, outs_raw, or
    Jifty->web->response->body() instead.
diff --git a/lib/Jifty/Plugin/Compat.pm b/lib/Jifty/Plugin/Compat.pm
index fa5a376..d1d1d94 100644
--- a/lib/Jifty/Plugin/Compat.pm
+++ b/lib/Jifty/Plugin/Compat.pm
@@ -33,6 +33,10 @@ TODO: this should also rebind STDIN/STDOUT in the per-request hook.
     return 'Jifty::Plugin::Compat::Apache';
 };
 
+*Jifty::Handler::cgi = sub {
+    return 'Jifty::Plugin::Compat::CGI';
+};
+
 wrap 'Jifty::View::Mason::Handler::new',
     post => sub { my $self = shift;
                   $self->interp->compiler->add_allowed_globals('$r');
@@ -43,6 +47,30 @@ push @Jifty::TestServer::ISA, 'Jifty::Server';
 
 package Jifty::Server;
 
+package Jifty::Plugin::Compat::CGI;
+use Carp;
+
+sub param {
+    my ($class, $key, $val) = @_;
+    my $params = Jifty->web->request->parameters;
+    if (defined $val) {
+        $params->{$key} = $val;
+    }
+    else {
+        return $params->{$key};
+    }
+}
+
+sub Vars {
+    my $params = Jifty->web->request->parameters;
+}
+
+sub AUTOLOAD {
+    our $AUTOLOAD;
+    croak "compat cgi does not handle $AUTOLOAD";
+}
+
+
 package Jifty::Plugin::Compat::Apache;
 use Carp;
 

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list