[Jifty-commit] jifty-plugin-comment branch, master, updated. 567fd869d43c8b18efb3a73892131991a9e590a6
Jifty commits
jifty-commit at lists.jifty.org
Fri May 21 17:13:13 EDT 2010
The branch, master has been updated
via 567fd869d43c8b18efb3a73892131991a9e590a6 (commit)
from db75bb9d25d4a00ba15528142fc90fad261861ec (commit)
Summary of changes:
Makefile.PL | 1 -
lib/Jifty/Plugin/Comment/Action/CreateComment.pm | 25 ++++++---------------
2 files changed, 7 insertions(+), 19 deletions(-)
- Log -----------------------------------------------------------------
commit 567fd869d43c8b18efb3a73892131991a9e590a6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri May 21 17:13:44 2010 -0400
Move from CGI::Cookie, which looks at ENV, to plack's way of cookie handling
diff --git a/Makefile.PL b/Makefile.PL
index 5b4ebee..48d576c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -8,7 +8,6 @@ requires('MIME::Base64::URLSafe');
requires('Regexp::Common');
requires('Regexp::Common::URI');
requires('Regexp::Common::Email::Address');
-requires('CGI::Cookie');
auto_install();
tests('t/*.t t/*/t/*.t');
diff --git a/lib/Jifty/Plugin/Comment/Action/CreateComment.pm b/lib/Jifty/Plugin/Comment/Action/CreateComment.pm
index d8ab8fc..e238274 100644
--- a/lib/Jifty/Plugin/Comment/Action/CreateComment.pm
+++ b/lib/Jifty/Plugin/Comment/Action/CreateComment.pm
@@ -158,7 +158,6 @@ use Jifty::Action::Record::Create schema {
;
};
-use CGI::Cookie;
use MIME::Base64::URLSafe;
#use Contentment::Notification::CommentPublished;
#use Contentment::Notification::CommentNeedsModeration;
@@ -208,14 +207,11 @@ sub take_action {
my $email = urlsafe_b64encode(
$self->argument_value('email'));
- my $cookie = CGI::Cookie->new(
- -path => '/',
- -name => 'COMMENT_REMEMBORY',
- -value => join('.', $your_name, $web_site, $email),
- -expires => '+3M',
- );
-
- Jifty->web->response->add_header( 'Set-Cookie' => $cookie->as_string );
+ Jifty->web->response->cookies->{COMMENT_REMEMBORY} = {
+ path => '/',
+ value => join('.', $your_name, $web_site, $email),
+ expires => '+3M',
+ };
$self->SUPER::take_action(@_);
@@ -274,15 +270,8 @@ Creating a comment this way causes a cookie named "COMMENT_REMEMBORY" to be stor
=cut
-my $comment_cookie;
sub fetch_comment_cookie {
- return $comment_cookie if defined $comment_cookie;
-
- my %cookies = CGI::Cookie->fetch;
- $comment_cookie
- = $cookies{'COMMENT_REMEMBORY'} ? $cookies{'COMMENT_REMEMBORY'} : '';
-
- return $comment_cookie;
+ return Jifty->web->request->cookies->{COMMENT_REMEMBORY};
}
=head2 from_cookie
@@ -303,7 +292,7 @@ sub from_cookie {
);
}
- elsif (my $value = eval { fetch_comment_cookie()->value }) {
+ elsif (my $value = fetch_comment_cookie() ) {
my @fields = split /\./, $value;
if (defined $fields[ $pos ]) {
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list