Goo::FileThing::Deleter - Delete a file


Goo documentation Contained in the Goo distribution.

Index


Code Index:

NAME

Top

Goo::FileThing::Deleter - Delete a file

SYNOPSIS

Top

use Goo::FileThing::Deleter;

DESCRIPTION

Top

METHODS

Top

run

create the output file

AUTHOR

Top

Nigel Hamilton <nigel@trexy.com>

SEE ALSO

Top


Goo documentation Contained in the Goo distribution.

package Goo::FileThing::Deleter;

###############################################################################
# Nigel Hamilton
#
# Copyright Nigel Hamilton 2005
# All Rights Reserved
#
# Author:       Nigel Hamilton
# Filename:     Goo::FileThing::Deleter.pm
# Description:  Very simple program for deleting files from TheGoo
#
# Date          Change
# -----------------------------------------------------------------------------
# 02/08/2005    Version 1
#
###############################################################################

use strict;

use Goo::Object;
use Goo::Header;
use Goo::Prompter;

our @ISA = ("Goo::Object");


###############################################################################
#
# run - create the output file
#
###############################################################################

sub run {

    my ($this, $thing) = @_;

    my $filename = $thing->get_filename();

    # check to see if it exists
    unless (-e $thing->get_full_path()) {
        Goo::Prompter::say("Can't delete $filename. It doesn't exist,");
        exit;
    }

    Goo::Prompter::clear();

    Goo::Header::show("FileThing::Deleter", $thing->get_filename(), $thing->get_location());

    Goo::Prompter::say();

    if (Goo::Prompter::confirm("Delete $filename?", "N")) {

        # do the deletion!
        unlink($thing->get_full_path());
        Goo::Prompter::yell("$filename is deleted.");
    }

}

1;


__END__