in SGN::View::Email, skip email sending if running in test mode
[sgn.git] / lib / SGN / View / Email.pm
blob41a337f252f3812198b26372d62d4da3c2810e34
1 package SGN::View::Email;
2 use Moose;
3 use namespace::autoclean;
4 use Data::Dump 'dump';
6 BEGIN { extends 'Catalyst::View::Email' }
8 __PACKAGE__->config(
9 stash_key => 'email'
12 around 'process' => sub {
13 my $orig = shift;
14 my $self = shift;
15 my ($c) = @_;
17 if( $c->can('test_mode') && $c->test_mode ) {
18 $c->log->debug("skipping email send, since running in test mode. email:\n".dump( $c->stash->{ $self->stash_key } ));
19 } else {
20 $self->$orig( @_ );
24 =head1 NAME
26 SGN::View::Email - Email View for SGN
28 =head1 DESCRIPTION
30 View for sending email from SGN. Nearly-bare subclass of L<Catalyst::View::Email>.
32 =head1 AUTHOR
34 Robert Buels
36 =head1 SEE ALSO
38 L<SGN>
39 L<Catalyst::View::Email>
41 =head1 LICENSE
43 This library is free software, you can redistribute it and/or modify
44 it under the same terms as Perl itself.
46 =cut