Skip Menu |
 

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 18183
Status: resolved
Priority: 0/
Queue: CGI-Session

People
Owner: Nobody in particular
Requestors: dcturner2000 [...] yahoo.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 4.07
Fixed in: (no value)

Attachments


Subject: DESTROY wipes out exception handling
Download (untitled) / with headers
text/plain 495b
If I initialise CGI::Session then die() with a message, the message gets lost which makes debugging rather frustrating. I am using the postgresql driver. The error seems to be that eval{} is used within the cleanup, which wipes out $@ if no error occurs. The attached patch provides the best description of the problem by offering a quick-and-dirty fix for my case. There probably is a much better way; perhaps use Error qw(:try)? Version CGI::Session 4.07, perl 5.8.6, Linux 2.6.10
Subject: exception-fix.patch
Download exception-fix.patch
text/x-diff 798b
diff -U3 -r ./Session/Driver/postgresql.pm /usr/lib/perl5/site_perl/5.8.6/CGI/Session/Driver/postgresql.pm --- ./Session/Driver/postgresql.pm 2006-03-09 12:02:19.000000000 +0000 +++ /usr/lib/perl5/site_perl/5.8.6/CGI/Session/Driver/postgresql.pm 2006-03-15 13:24:11.560071302 +0000 @@ -63,14 +63,20 @@ sub __ex_and_ret { my ($dbh,$sql,$datastr,$sid,$type) = @_; + my $save_error = $@; eval { my $sth = $dbh->prepare($sql) or return 0; $sth->bind_param(1,$datastr,{ pg_type => $type }) or return 0; $sth->bind_param(2,$sid) or return 0; $sth->execute() or return 0; }; - return 0 if $@; - return 1; + if ($@) { + $@ = $save_error; + return 0; + } else { + $@ = $save_error; + return 1; + } } 1;
Subject: Re: [rt.cpan.org #18183] DESTROY wipes out exception handling
Date: Wed, 15 Mar 2006 09:10:22 -0500
To: Guest via RT <bug-CGI-Session [...] rt.cpan.org>
From: Mark Stosberg <mark [...] summersault.com>
Download (untitled) / with headers
text/plain 773b
On Wed, Mar 15, 2006 at 08:36:06AM -0500, Guest via RT wrote: Show quoted text
> > If I initialise CGI::Session then die() with a message, the message > gets lost which makes debugging rather frustrating. I am using the > postgresql driver. The error seems to be that eval{} is used within > the cleanup, which wipes out $@ if no error occurs. > > The attached patch provides the best description of the problem by > offering a quick-and-dirty fix for my case. There probably is a much > better way; perhaps use Error qw(:try)?
This patch looks reasonable to me. In terms of a "better way", on the cgi-session-users list, we are discussing alternatives to make the use of DESTORY optional, but having the "flush()" kinds of actions happen explicitly, or at other points. Mark


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.