File Coverage

lib/CatalystX/Resource/TraitFor/Controller/Resource/Delete.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package CatalystX::Resource::TraitFor::Controller::Resource::Delete;
2             $CatalystX::Resource::TraitFor::Controller::Resource::Delete::VERSION = '0.03';
3 9     9   13818 use MooseX::MethodAttributes::Role;
  9         24  
  9         80  
4 9     9   85566 use namespace::autoclean;
  9         27  
  9         70  
5              
6             # ABSTRACT: a delete action for your resource
7              
8             requires qw/
9             resource_key
10             _msg
11             _redirect
12             /;
13              
14              
15             sub delete : Method('POST') Chained('base_with_id') PathPart('delete') Args(0) {
16 10     10 1 4455 my ( $self, $c ) = @_;
17 10         53 my $resource = $c->stash->{ $self->resource_key };
18 10         90 my $msg = $self->_msg( $c, 'delete' );
19 10         449 $resource->delete;
20 10         179099 $c->flash( msg => $msg );
21 10         47540 $self->_redirect($c);
22 9     9   1845 }
  9         30  
  9         72  
23              
24             1;
25              
26             __END__
27              
28             =pod
29              
30             =encoding UTF-8
31              
32             =head1 NAME
33              
34             CatalystX::Resource::TraitFor::Controller::Resource::Delete - a delete action for your resource
35              
36             =head1 VERSION
37              
38             version 0.03
39              
40             =head1 ACTIONS
41              
42             =head2 delete
43              
44             delete a specific resource with a POST request
45              
46             =head1 AUTHOR
47              
48             David Schmidt <davewood@cpan.org>
49              
50             =head1 COPYRIGHT AND LICENSE
51              
52             This software is copyright (c) 2011 by David Schmidt.
53              
54             This is free software; you can redistribute it and/or modify it under
55             the same terms as the Perl 5 programming language system itself.
56              
57             =cut