Skip to content

Commit

Permalink
Ability to determine if a file was TrapIncluded or not
Browse files Browse the repository at this point in the history
  • Loading branch information
neophenix committed Jan 19, 2010
1 parent ca7114c commit 3949db1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Mungo/Response.pm
Expand Up @@ -393,6 +393,20 @@ sub defaultErrorHandler {
$self->{Mungo}->{data}->{ApacheResponseCode} = SERVER_ERROR;
}

=head2 $bool = $Response->Trapped();
Returns 1 if invoked within a TrapInclude, 0 otherwise
=cut

sub Trapped {
my $self = shift;
my $_r = tied %$self;
my $stack = $_r->{data}->{'IO_stack'};
return 1 if($stack && scalar(@$stack) > 1);
return 0;
}

=head2 $output = $Response->TrapInclude($filename, @args);
Like Include(), but results are returned as a string, instead of being printed.
Expand Down

0 comments on commit 3949db1

Please sign in to comment.