Checking in changes prior to tagging of version 2.30.
[MogileFS-Utils.git] / mogdelete
blob7fa478c2d13475aa26af52380eb192cb6d1bc723
1 #!/usr/bin/perl
3 =head1 NAME
5 mogdelete -- Delete keys from a MogileFS installation
7 =head1 SYNOPSIS
9 $ mogdelete --trackers=host --domain=foo --key="/hello.jpg"
11 =head1 OPTIONS
13 =over
15 =item --trackers=host1:7001,host2:7001
17 Use these MogileFS trackers to negotiate with.
19 =item --domain=<domain>
21 Set the MogileFS domain to use.
23 =item --key="<key>"
25 A key to delete. Can be an arbitrary string.
27 =back
29 =head1 AUTHOR
31 Dormando E<lt>L<dormando@rydia.net>E<gt>
33 =head1 BUGS
35 Produces a slightly weird error if key does not exist.
37 =head1 LICENSE
39 Licensed for use and redistribution under the same terms as Perl itself.
41 =cut
43 use strict;
44 use warnings;
46 use lib './lib';
47 use MogileFS::Utils;
49 my $util = MogileFS::Utils->new;
50 my $usage = "--trackers=host --domain=foo --key='/hello.jpg'";
51 my $c = $util->getopts($usage, 'key=s');
53 my $mogc = $util->client;
55 $mogc->delete($c->{key});
56 if ($mogc->errcode) {
57 die "Error deleting file: ", $mogc->errstr, "\n";