Commit
- Added 'last resort' try/catch in Engine::CGI to display lost exceptions. - Moo-fied Foswiki::If::Parser, Foswiki::Query::Parser. - Changed 'isa' to 'is' in some 'has' clauses (no good of typing faster than thinking :) ).
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ use strict; | |
use warnings; | ||
|
||
use CGI; | ||
use CGI::Carp; | ||
use Data::Dumper; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
vrurg
Author
Member
|
||
use Foswiki::Engine (); | ||
our @ISA = ('Foswiki::Engine'); | ||
|
||
|
@@ -25,6 +27,7 @@ use Foswiki::Request (); | |
use Foswiki::Request::Upload (); | ||
use Foswiki::Response (); | ||
use Unicode::Normalize; | ||
use Try::Tiny; | ||
This comment has been minimized.
Sorry, something went wrong.
cdot
Contributor
|
||
|
||
BEGIN { | ||
if ( $Foswiki::cfg{UseLocale} ) { | ||
|
@@ -97,8 +100,21 @@ sub run { | |
exit 1; | ||
} | ||
if ( UNIVERSAL::isa( $req, 'Foswiki::Request' ) ) { | ||
my $res = Foswiki::UI::handleRequest($req); | ||
$this->finalize( $res, $req ); | ||
try { | ||
my $res = Foswiki::UI::handleRequest($req); | ||
$this->finalize( $res, $req ); | ||
} | ||
catch { | ||
# Whatever error we get here – we generate valid HTTP response. At least we try... | ||
# This is the last frontier of error handling. | ||
# SMELL XXX Test code. | ||
|
||
# untie of the handles is required when remote debugging is used. | ||
untie(*STDOUT) if tied(*STDOUT); | ||
untie(*STDERR) if tied(*STDERR); | ||
|
||
CGI::Carp::confess( $_->{-text} ); | ||
}; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,12 +10,6 @@ Support for the conditions in %IF{} statements. | |
|
||
package Foswiki::If::Parser; | ||
|
||
use strict; | ||
use warnings; | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
use Foswiki::Query::Parser (); | ||
our @ISA = ('Foswiki::Query::Parser'); | ||
|
||
use Assert; | ||
use Foswiki::If::Node (); | ||
|
||
|
@@ -28,6 +22,11 @@ use Foswiki::If::OP_isempty (); | |
use Foswiki::If::OP_istopic (); | ||
use Foswiki::If::OP_isweb (); | ||
|
||
use Moo; | ||
This comment has been minimized.
Sorry, something went wrong.
cdot
Contributor
|
||
use namespace::clean; | ||
|
||
extends 'Foswiki::Query::Parser'; | ||
|
||
BEGIN { | ||
if ( $Foswiki::cfg{UseLocale} ) { | ||
require locale; | ||
|
@@ -40,16 +39,15 @@ BEGIN { | |
use constant OPS => qw(allows context defined dollar ingroup isempty | ||
istopic isweb ); | ||
|
||
sub new { | ||
my ($class) = @_; | ||
sub BUILD { | ||
my $this = shift; | ||
|
||
$this->nodeClass('Foswiki::If::Node'); | ||
|
||
my $this = $class->SUPER::new( { nodeClass => 'Foswiki::If::Node', } ); | ||
foreach my $op ( OPS() ) { | ||
my $on = 'Foswiki::If::OP_' . $op; | ||
$this->addOperator( $on->new() ); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
1; | ||
|
Is Data::Dumper really used anywhere?