Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 49943
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: MARKSTOS [...] cpan.org
Cc: miyagawa [...] bulknews.net
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



CC: miyagawa [...] bulknews.net
Subject: Needs discussion: wish: PSGI support in CGI.pm
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Charset: utf8
Content-Disposition: inline
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1262
Download (untitled) / with headers
text/plain 1.2k
Miyagawa has proposed that CGI.pm include direct support for the PSGI specification. An initial implementation has already been completed and is available in the 'pgsi_support' branch of my repo: http://github.com/markstos/CGI.pm/commits/psgi_support I support the theory of the project, which ports WSGI to Perl, which seems to have proven valuable in the Python and Ruby communities. This post explains more: http://bulknews.typepad.com/blog/2009/09/psgi-perl-wsgi.html Before this work is merged into the core, a few things need to happen: 1. We need to agree on the exact API 2. It needs to be tested and documented 3. Lincoln Stein needs to approve it. Here are my concerns regarding the API as it is proposed: 1. I'm concerned that the CGI::PSGI module exists primarily to set a variable: $CGI::PSGI. Directly setting the global or using a pragma seems more consistent with existing features. 2. I'm concerned about adding *any* significant features to CGI.pm at this point. However, there is no easy way to add this functionality externally. Ideally, if this moves forward, it would be ideal to have a similar update released to CGI::Simple at the same time. Next, I'm interested in feedback from other CGI.pm users about the proposed change
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=
In-Reply-To: <rt-3.6.HEAD-2295-1253707741-398.49943-15-0 [...] rt.cpan.org>
X-Ironport-Anti-Spam-Result: AvQEAOmzu0rO+Ir8/2dsb2JhbACBUtUhhBwFh34
References: <RT-Ticket-49943 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1253707741-398.49943-15-0 [...] rt.cpan.org>
X-Ironport-Anti-Spam-Filtered: true
Message-ID: <4ABC17E1.5060709 [...] babyl.dyndns.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
X-RT-Original-Encoding: utf-8
X-Ironport-Av: E=Sophos;i="4.44,448,1249272000"; d="scan'208";a="46564019"
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id E80D019B82DE for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 21:05:05 -0400 (EDT)
Received: (qmail 13101 invoked by uid 103); 25 Sep 2009 01:05:05 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Sep 2009 01:05:05 -0000
Received: from ironport2-out.teksavvy.com (HELO ironport2-out.pppoe.ca) (206.248.154.183) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 24 Sep 2009 18:04:59 -0700
Received: from 206-248-138-252.dsl.teksavvy.com (HELO gilgamesh.babyl.dyndns.org) ([206.248.138.252]) by ironport2-out.pppoe.ca with ESMTP; 24 Sep 2009 21:04:54 -0400
Received: by gilgamesh.babyl.dyndns.org (Postfix, from userid 65534) id 32EF743A6B; Thu, 24 Sep 2009 22:05:53 -0400 (EDT)
Received: from [192.168.0.103] (enkidu [192.168.0.103]) by gilgamesh.babyl.dyndns.org (Postfix) with ESMTP id 229A6439E5 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 22:05:52 -0400 (EDT)
Delivered-To: cpan-bug+CGI.pm [...] diesel.bestpractical.com
User-Agent: Thunderbird 2.0.0.9 (X11/20071031)
Subject: Re: [rt.cpan.org #49943] Needs discussion: wish: PSGI support in CGI.pm
Return-Path: <yanick [...] babyl.dyndns.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-CGI.pm [...] rt.cpan.org
X-Old-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.2.4
Date: Thu, 24 Sep 2009 21:07:45 -0400
X-Old-Spam-Level:
X-Spam-Level: *
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on gilgamesh.babyl.dyndns.org
To: bug-CGI.pm [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Yanick Champoux <yanick [...] babyl.dyndns.org>
RT-Message-ID: <rt-3.6.HEAD-2295-1253840721-1168.49943-0-0 [...] rt.cpan.org>
Content-Length: 734
Download (untitled) / with headers
text/plain 734b
MARKSTOS via RT wrote: Show quoted text
> Miyagawa has proposed that CGI.pm include direct support for the PSGI > specification. [..]
Show quoted text
> Next, I'm interested in feedback from other CGI.pm users about the > proposed change
I share Mark's caution about adding new functionality to CGI. It's a module with a long history used by a lot of people, and in consequence we want to be extra-careful with any changes. On the other hand, the modifications to support PSGI are fairly minimal, and shouldn't impact any of the current functionality of the module. In this specific case, I think my vote would go for including the PSGI support, but only after making sure the implemented API is sound, and after having tested it through and through.
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-2295-1253840721-1168.49943-6-0 [...] rt.cpan.org>
References: <RT-Ticket-49943 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1253707741-398.49943-15-0 [...] rt.cpan.org> <4ABC17E1.5060709 [...] babyl.dyndns.org> <rt-3.6.HEAD-2295-1253840721-1168.49943-6-0 [...] rt.cpan.org>
Message-ID: <693254b90909241837v456867c7s2e97d2970886a877 [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 83CD219B82D8 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 21:37:37 -0400 (EDT)
Received: (qmail 18613 invoked by uid 103); 25 Sep 2009 01:37:36 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Sep 2009 01:37:36 -0000
Received: from mail-px0-f178.google.com (HELO mail-px0-f178.google.com) (209.85.216.178) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 24 Sep 2009 18:37:31 -0700
Received: by pxi8 with SMTP id 8so2602274pxi.27 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 18:37:29 -0700 (PDT)
Received: by 10.142.9.11 with SMTP id 11mr334195wfi.101.1253842649237; Thu, 24 Sep 2009 18:37:29 -0700 (PDT)
Delivered-To: cpan-bug+CGI.pm [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #49943] Needs discussion: wish: PSGI support in CGI.pm
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=I3tPIuh0rHuQ12jFknv2pwu4zcTKSfecMaWULSuFkThfE56RAcTk7VLCymCzviZzJ0 pAOTxuLnq9dIWgX2oQSAitHKdgWxBSb0jAG5x0+piQ07pnJSEtTSQnsyrxdJBQgiOves IE/rx+ENfbROwR7P0pU8Qpd65LAIDWj+XKl3c=
Return-Path: <miyagawa [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=Eeq6Ois7D3/wDzfYg8glSPtOjhiJscCuXH2guV+b7iA=; b=ZHki2zPuRg8y4EZMGto+fbN0EiP/CfyGYYjxbdOV85Bh4rnpRqxDnr8g1HuH1Afj6L QnVHiuWKT5GB1xHIi6dq6rtbcxFoFLUrL6Q6zQ/xIq2zjt9M5yBk5NjXVzdCne4LCkHU W06uVLA7c16yLJfzd9/ft2qrLfthl5+37/WKw=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-CGI.pm [...] rt.cpan.org
Date: Fri, 25 Sep 2009 10:37:29 +0900
X-Spam-Level: *
To: bug-CGI.pm [...] rt.cpan.org
From: Tatsuhiko Miyagawa <miyagawa [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-2295-1253842666-447.49943-0-0 [...] rt.cpan.org>
Content-Length: 1265
Download (untitled) / with headers
text/plain 1.2k
Show quoted text
> 1. I'm concerned that the CGI::PSGI module exists primarily to set a > variable: $CGI::PSGI. Directly setting the global or using a pragma > seems more consistent with existing features.
CGI::PSGI module is there to help ease the migration in web frameworks, so "use CGI::PSGI" will fail if the installed CGI.pm doesn't support PSGI. The problem here is that current (unpatched) CGI.pm DOESN'T fail when called "$CGI::PSGI = 1" nor "use CGI qw(:psgi)" and silently doesn't do anything useful re: PSGI variables. Making CGI::PSGI module just to set the flag then makes sure that your application bails out if you need PSGI support but when your CGI.pm doesn't support it. Also, your frameworks can say "requires 'CGI::PSGI'" in Makefile.PL, instead of specifying the CGI.pm version number. the API's awkwardness is something separate worth discussing. I wanted to say use CGI::PSGI; my $q = CGI::PSGI->new($env); my($status, $headers) = $q->headers($content_type); without touching CGI.pm at all, but it was really hard since CGI.pm directly manipulates %ENV and there are so many methods to clone. (That means it's not technically impossible, so we still keep that as an option if a direct PSGI support is unapproved). Thanks, -- Tatsuhiko Miyagawa
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-2295-1253842666-447.49943-6-0 [...] rt.cpan.org>
References: <RT-Ticket-49943 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1253707741-398.49943-15-0 [...] rt.cpan.org> <4ABC17E1.5060709 [...] babyl.dyndns.org> <rt-3.6.HEAD-2295-1253840721-1168.49943-6-0 [...] rt.cpan.org> <693254b90909241837v456867c7s2e97d2970886a877 [...] mail.gmail.com> <rt-3.6.HEAD-2295-1253842666-447.49943-6-0 [...] rt.cpan.org>
Message-ID: <693254b90909241909w58fcccd1r10dd7c2e01196927 [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id E944219B82CC for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 22:09:57 -0400 (EDT)
Received: (qmail 23612 invoked by uid 103); 25 Sep 2009 02:09:57 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Sep 2009 02:09:57 -0000
Received: from mail-bw0-f217.google.com (HELO mail-bw0-f217.google.com) (209.85.218.217) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 24 Sep 2009 19:09:51 -0700
Received: by bwz17 with SMTP id 17so1708774bwz.45 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 19:09:47 -0700 (PDT)
Received: by 10.103.84.12 with SMTP id m12mr1792647mul.79.1253844587479; Thu, 24 Sep 2009 19:09:47 -0700 (PDT)
Delivered-To: cpan-bug+CGI.pm [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #49943] Needs discussion: wish: PSGI support in CGI.pm
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=eBiO8FyBWzxstCRQcK/6MraLvtx2Mj0juqyWPab+th4gRffpGOzmcDwUN4qlg9obrp ZNtMi2Dmvq9QbkuqONodocZj05YlRYcpFplVVVegTZaEmrnMBh3H6cmCTGJ9Snywkj4J AsG/CtaDHPs9HRKzGFYzcTQInOx73DfX5pBZc=
Return-Path: <miyagawa [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=ce009SVPC5am56I4meZwfD6IRP49mu5pbay7UHNZhKs=; b=NmT2jk9yHp4Y258L/ruYKW2KREK8w+ngnG7BHgyQ+tYC6Ne+OQv5GSvgYUVvIgI6Xf d7tgQv2XdGaOCfJEQkKxZOzcWbMSwgLddbcakxkph1BA1MdHCkxpkS42zyaYF0IzaZUq nFLcb4WakUC8OKjj6BI098DYV4Yb2GPZgzVi4=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-CGI.pm [...] rt.cpan.org
Date: Fri, 25 Sep 2009 11:09:47 +0900
X-Spam-Level: *
To: bug-CGI.pm [...] rt.cpan.org
From: Tatsuhiko Miyagawa <miyagawa [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-2295-1253844607-1368.49943-0-0 [...] rt.cpan.org>
Content-Length: 657
Download (untitled) / with headers
text/plain 657b
On Fri, Sep 25, 2009 at 10:37 AM, miyagawa@gmail.com via RT <bug-CGI.pm@rt.cpan.org> wrote: Show quoted text
> The problem here is that current (unpatched) CGI.pm DOESN'T fail when > called "$CGI::PSGI = 1" nor "use CGI qw(:psgi)" and silently doesn't > do anything useful re: PSGI variables. Making CGI::PSGI module just to > set the flag then makes sure that your application bails out if you > need PSGI support but when your CGI.pm doesn't support it.
The other approach for this would be to let app developers to say: use CGI qw(:psgi); # this would set $CGI::PSGI to 1 die "Your CGI.pm doesn't support PSGI!" unless defined $CGI::PSGI; -- Tatsuhiko Miyagawa
CC: MARKSTOS [...] cpan.org
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-2295-1253842666-447.49943-6-0 [...] rt.cpan.org>
References: <RT-Ticket-49943 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1253707741-398.49943-15-0 [...] rt.cpan.org> <4ABC17E1.5060709 [...] babyl.dyndns.org> <rt-3.6.HEAD-2295-1253840721-1168.49943-6-0 [...] rt.cpan.org> <693254b90909241837v456867c7s2e97d2970886a877 [...] mail.gmail.com> <rt-3.6.HEAD-2295-1253842666-447.49943-6-0 [...] rt.cpan.org>
Message-ID: <693254b90909241916u50f6172ene931fa0451b7f961 [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 68F6519B82CC for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 22:16:35 -0400 (EDT)
Received: (qmail 24702 invoked by uid 103); 25 Sep 2009 02:16:34 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Sep 2009 02:16:34 -0000
Received: from mail-fx0-f215.google.com (HELO mail-fx0-f215.google.com) (209.85.220.215) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 24 Sep 2009 19:16:29 -0700
Received: by fxm11 with SMTP id 11so1981434fxm.15 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 19:16:26 -0700 (PDT)
Received: by 10.102.178.9 with SMTP id a9mr1756836muf.91.1253844986134; Thu, 24 Sep 2009 19:16:26 -0700 (PDT)
Delivered-To: cpan-bug+CGI.pm [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #49943] Needs discussion: wish: PSGI support in CGI.pm
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=frxjVOPA8prATPQWuInTvV2ddaMdXNDsK+WS3uH0pEmqZLRXDvK8KcsnTo4uLylEJu PO37XULg8a1hTPCxTbG4phcaIRzJ4oIw4ZyY/4KXeJdE0rjabY26moiRs0pn92LbHVML b5Ue1/AsYKocpX6VFxPOBHbPdfQE5E5G9UwP8=
Return-Path: <miyagawa [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=LN/TDduEF+72qLB0P0sPn/1GQgqgLX+3cdANY+IjT+c=; b=qQUIFmbmgq3L+0vgXbQjNMrVHmE0ixHCoz0rUV9rIjb6EYUD64n5ltDg2GBh2O/Zam gGjrJJt+2IXG0D5mkHQNOl7MjwuO7kTgLiCySEGxdePCURrwRH+JRUlCyQ1jCGkM3nek jeKsgM60GvesqNZLTqKASd8cImOgYGfOSJZyQ=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-CGI.pm [...] rt.cpan.org
Date: Fri, 25 Sep 2009 11:16:26 +0900
X-Spam-Level: *
To: bug-CGI.pm [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Tatsuhiko Miyagawa <miyagawa [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-2295-1253845006-872.49943-0-0 [...] rt.cpan.org>
Content-Length: 1528
Download (untitled) / with headers
text/plain 1.4k
On Fri, Sep 25, 2009 at 10:37 AM, miyagawa@gmail.com via RT <bug-CGI.pm@rt.cpan.org> wrote: Show quoted text
>  use CGI::PSGI; >  my $q = CGI::PSGI->new($env); >  my($status, $headers) = $q->headers($content_type); > > without touching CGI.pm at all, but it was really hard since CGI.pm > directly manipulates %ENV and there are so many methods to clone. > (That means it's not technically impossible, so we still keep that as > an option if a direct PSGI support is unapproved).
The actual implementation for that would be: 1) in CGI::PSGI::new, save the current %ENV somewhere and populate %ENV with PSGI's $env 2) Override methods that reads from STDIN, like read_from_stdin and read_from_client to read from $env->{'psgi.input'} 3) Override header() method, or implement a different named method (like psgi_header) to return $status and $headers_ref 4) in DESTROY, restore the saved %ENV, and call CGI::initialize_globals() I *think* this can be done without touching CGI.pm at all, but a) a fair amount of code may need to be duplicated b) I'm not really sure that's "thread-safe" (or event-loop safe). If you run multiple PSGI apps in parallel, in our case with AnyEvent/Danga::Socket based event-loop server or with Coro server and if the app does streaming output (rather than direct response), global resetting and sharing of %ENV might cause issues. (Well, actually this might be problematic with the current patch as well though: local *ENV = $env gets reset when it goes out of scope -- same problem). -- Tatsuhiko Miyagawa
CC: MARKSTOS [...] cpan.org
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <693254b90909241916u50f6172ene931fa0451b7f961 [...] mail.gmail.com>
References: <RT-Ticket-49943 [...] rt.cpan.org> <rt-3.6.HEAD-2295-1253707741-398.49943-15-0 [...] rt.cpan.org> <4ABC17E1.5060709 [...] babyl.dyndns.org> <rt-3.6.HEAD-2295-1253840721-1168.49943-6-0 [...] rt.cpan.org> <693254b90909241837v456867c7s2e97d2970886a877 [...] mail.gmail.com> <rt-3.6.HEAD-2295-1253842666-447.49943-6-0 [...] rt.cpan.org> <693254b90909241916u50f6172ene931fa0451b7f961 [...] mail.gmail.com>
Message-ID: <693254b90909242124u1c76f5bdhcde0b911e498c033 [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 13B3F19B81E0 for <bug-CGI.pm [...] rt.cpan.org>; Fri, 25 Sep 2009 00:24:31 -0400 (EDT)
Received: (qmail 12925 invoked by uid 103); 25 Sep 2009 04:24:31 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Sep 2009 04:24:31 -0000
Received: from mail-px0-f191.google.com (HELO mail-px0-f191.google.com) (209.85.216.191) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 24 Sep 2009 21:24:26 -0700
Received: by pxi29 with SMTP id 29so2606240pxi.14 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 24 Sep 2009 21:24:23 -0700 (PDT)
Received: by 10.142.67.14 with SMTP id p14mr349014wfa.135.1253852663047; Thu, 24 Sep 2009 21:24:23 -0700 (PDT)
Delivered-To: cpan-bug+CGI.pm [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #49943] Needs discussion: wish: PSGI support in CGI.pm
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=uO65E1rVtWV1IlG7iePqSpUKq4CBV0e1PasUgYCVRz1PaukW4qNHbdUoFIB/J9uduZ wD/V+f2jfCSXh00A/c4JrZazTsq26f7lWgw2l9QfA9LzcQyZLRqZvEPBCoVn40HomPoo RwDfhw5r2LR8UT2NUtyj8HLt73ggi6Lk2CqrQ=
Return-Path: <miyagawa [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=vRjcWN7xkZRii4zr0XpLxnUXGngJ4SSsH1rt8tE+9Fw=; b=eiMLQbCVRvSt1lGVxiZynCEQ3VFtTWwspIjXXfotHPhzFD5elQ4DW/pGlAZNUrEnXQ iydlVKEil3gu9lvGofz36dc/K0pnngce0dhl+cC2eMiuS/IIKjx6QNcQ+tNkHpXe2ijf G8Du6t/BWlRMjr5i68QUq6gDTO8acl20f1O+Q=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-CGI.pm [...] rt.cpan.org
Date: Fri, 25 Sep 2009 13:24:23 +0900
X-Spam-Level: *
To: bug-CGI.pm [...] rt.cpan.org
From: Tatsuhiko Miyagawa <miyagawa [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-2295-1253852681-258.49943-0-0 [...] rt.cpan.org>
Content-Length: 2119
On Fri, Sep 25, 2009 at 11:16 AM, Tatsuhiko Miyagawa <miyagawa@gmail.com> wrote: Show quoted text
> The actual implementation for that would be: > > 1) in CGI::PSGI::new, save the current %ENV somewhere and populate > %ENV with PSGI's $env > 2) Override methods that reads from STDIN, like read_from_stdin and > read_from_client to read from $env->{'psgi.input'} > 3) Override header() method, or implement a different named method > (like psgi_header) to return $status and $headers_ref > 4) in DESTROY, restore the saved %ENV, and call CGI::initialize_globals()
Okay, I've done this: http://github.com/miyagawa/CGI-PSGI The implemenation is slightly modified, so PSGI $env is stored in the object and set to local *ENV whenever a method that touches %ENV is called. This might have a slight performance impact but I don't think it's really a problem. I also left $q->header as it was, and added a new $q->psgi_header method instead. This is not a big deal since app developers need to change wherever $q->header was called to do print(). The benefit of new implementation is, as stated in README and POD, that it doesn't require CGI.pm patched to support PSGI natively. Mark, let's remove CGI::PSGI from CGI.pm main repo as you suggested and use $CGI::PSGI variable's defined-ness to see if CGI.pm supports PSGI or not. I think I can ship this CGI::PSGI to CPAN, and then CGI.pm can individually support PSGI with $CGI::PSGI or use CGI qw(:psgi); and both can live on CPAN: application users can chose whichever they want to. a) If they don't want to upgrade CGI.pm and are fine with changing their code, use CGI::PSGI b) If they don't want to change their CGI.pm based code, then upgrade CGI.pm that fully supports PSGI By "fully supports PSGI" the current CGI.pm (my patch) is not complete since it only does the read side. The app should still update their code to do return [ $q->header, [ $body ] ] instead of print $q->header, $body; To enable that you need to tie STDOUT, which actually CGI::Emulate::PSGI generally solves, in which case CGI.pm doesn't really need to be patched. Hmm ... ;) -- Tatsuhiko Miyagawa
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-29286-1358907362-311.49943-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
RT-Send-CC: miyagawa [...] bulknews.net
Content-Length: 58
I'm not sure there's anything else to do here. Resolving.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.