MrGamoo/API/Del.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 39 CC 3 SCAR 18.4
CC
3
Cov
0%
handler
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.3
1 # -*- perl -*-
2  
3 # Copyright (c) 2010 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2010-Jan-13 12:35 (EST)
6 # Function:
7 #
8 # $Id: Del.pm,v 1.1 2010/11/01 18:41:51 jaw Exp $
9  
10 package AC::MrGamoo::API::Del;
11 use AC::MrGamoo::Debug 'api_del';
12 use AC::MrGamoo::API::Simple;
13 use AC::MrGamoo::Scriblr;
14 use strict;
15  
16 sub handler {
17 my $class = shift;
18 my $io = shift;
19 my $proto = shift;
20 my $req = shift;
21 my $content = shift;
22  
23 # validate filename
24 my $file = filename($req->{filename});
25 debug("deleting file $file");
26  
27 if( $file && -f $file ){
28 unlink $file;
29 }
30  
31 if( -f $file ){
32 reply( 500, 'Error', $io, $proto, $req );
33 }else{
34 reply( 200, 'OK', $io, $proto, $req );
35 }
36 }
37  
38 1;