Class::DBI::Cascade::None(3pm)

Class::DBI::Cascade::None3pm

Do nothing upon deletion

Overview

This is a Cascading Delete strategy that will do nothing, leaving orphaned records behind.

It is the base class for most ofther Cascade strategies, and so provides several important methods:

Constructor

new

        my $strategy = Cascade::Class->new($Relationship);

This must be instantiated with a Class::DBI::Relationship object.

Methods

foreign_for

        my $iterator = $strategy->foreign_for($obj);

This will return all the objects which are foreign to $obj across the relationship. It's a normal Class::DBI search you can get the results either as a list or as an iterator.

cascade

        $strategy->cascade($obj);

Cascade across the related objects to $obj.

Writing new strategies

Creating a Cascade strategy should be fairly simple. You usually just need to inherit from here, and then supply a cascade() method that does the required thing with the results from foreign_for().

So, for example, Cascade::Delete is implemented simply as:

        package Class::DBI::Cascade::Delete;
        use base 'Class::DBI::Cascade::None';
        sub cascade {
                my ($self, $obj) = @_;
                $self->foreign_for($obj)->delete_all;
        }

Releases

10 releases since Debian 4.0 (Etch); the text changed 5 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 7–10
  5. 11
  6. 12–13

From libclass-dbi-perl 3.0.17-5 in Debian 13 (Trixie). Parsed by carta from the page's man source.