CGI::Ex::Recipes::Delete - Implements the "delete" step!


CGI-Ex-Recipes documentation Contained in the CGI-Ex-Recipes distribution.

Index


Code Index:

NAME

Top

CGI::Ex::Recipes::Delete - Implements the "delete" step!

SYNOPSIS

Top

    http://localhost:8081/recipes/index.pl/delete/16
    ...

METHIODS

Top

info_complete

finalize

Deletes the given record found in the path_info and adds the success message to the form to be displayed.

AUTHOR

Top

Красимир Беров, <k.berov at gmail.com>

COPYRIGHT & LICENSE

Top


CGI-Ex-Recipes documentation Contained in the CGI-Ex-Recipes distribution.

package CGI::Ex::Recipes::Delete;

use utf8;
use warnings;
use strict;
use base qw(CGI::Ex::Recipes);

our $VERSION = '0.03';


sub info_complete { 1 }

sub finalize {
    my $self = shift;
    $self->dbh->prepare("DELETE FROM recipes WHERE id = ?")->execute($self->form->{'id'});

    $self->add_to_form(success => "Recipe deleted from the database");
        #make so default page displays the category in which this item is
    $self->form->{'id'} = $self->form->{step_args}{'pid'};
    return 1;
}

1; # End of CGI::Ex::Recipes::Delete

__END__