#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
use strict;
use warnings;
-our $VERSION = '0.30';
use HTML::Mason::PSGIHandler;
use base qw(HTML::Mason::Request::PSGI);
use Params::Validate qw(:all);
=head2 callback
-Method replaces deprecated component C<Element/Callback>.
-
Takes hash with optional C<CallbackPage>, C<CallbackName>
and C<CallbackOnce> arguments, other arguments are passed
throught to callback components.
process of the server. Such callbacks can be used to fill
structures.
+=item ReturnComponentOutput
+
+By default, callback returns the status codes of all rendered components, and
+prints the rendered components to STDOUT. If this argument is true, callback
+returns the rendered components instead of printing them to STDOUT.
+
=back
Searches for callback components in
my $name = delete $args{'CallbackName'} || 'Default';
my $page = delete $args{'CallbackPage'} || $self->callers(0)->path;
+ my $use_scomp = delete $args{'ReturnComponentOutput'} ? 1 : 0;
unless ( $page ) {
$RT::Logger->error("Couldn't get a page name for callbacks");
return;
}
my @rv;
+ my $scomp_out;
foreach my $cb ( @$callbacks ) {
- push @rv, scalar $self->comp( $cb, %args );
+ if ( $use_scomp ) {
+ no warnings 'uninitialized';
+ $scomp_out .= $self->scomp( $cb, %args );
+ } else {
+ push @rv, scalar $self->comp( $cb, %args );
+ }
}
- return @rv;
+ return $use_scomp ? $scomp_out : @rv;
+}
+
+sub clear_callback_cache {
+ %cache = %called = ();
}
}
return $path;
}
+=head2 abort
+
+Logs any recorded SQL statements for this request before calling the standard
+abort.
+
+=cut
+
+sub abort {
+ my $self = shift;
+ RT::Interface::Web::LogRecordedSQLStatements(
+ RequestData => {
+ Path => $self->request_path,
+ },
+ );
+ return $self->SUPER::abort(@_);
+}
+
1;