line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::FileThing::Deleter; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: Goo::FileThing::Deleter.pm |
11
|
|
|
|
|
|
|
# Description: Very simple program for deleting files from TheGoo |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 02/08/2005 Version 1 |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
############################################################################### |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
3338
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
5
|
use Goo::Object; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
22
|
1
|
|
|
1
|
|
5
|
use Goo::Header; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
23
|
1
|
|
|
1
|
|
5
|
use Goo::Prompter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
227
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @ISA = ("Goo::Object"); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# run - create the output file |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
############################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub run { |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
my ($this, $thing) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $filename = $thing->get_filename(); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# check to see if it exists |
41
|
0
|
0
|
|
|
|
|
unless (-e $thing->get_full_path()) { |
42
|
0
|
|
|
|
|
|
Goo::Prompter::say("Can't delete $filename. It doesn't exist,"); |
43
|
0
|
|
|
|
|
|
exit; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
Goo::Prompter::clear(); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
Goo::Header::show("FileThing::Deleter", $thing->get_filename(), $thing->get_location()); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
Goo::Prompter::say(); |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
if (Goo::Prompter::confirm("Delete $filename?", "N")) { |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# do the deletion! |
55
|
0
|
|
|
|
|
|
unlink($thing->get_full_path()); |
56
|
0
|
|
|
|
|
|
Goo::Prompter::yell("$filename is deleted."); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Goo::FileThing::Deleter - Delete a file |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 SYNOPSIS |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
use Goo::FileThing::Deleter; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item run |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
create the output file |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SEE ALSO |
94
|
|
|
|
|
|
|
|