Class::...de::None(3)
β¨ NAME β¨
Okay bestie, this is the Class::...de::None(3) page from User Contributed Perl Documentation, and it's all about Class::DBI::Cascade::None β do nothing upon deletion. Literally its whole brand. π
π DESCRIPTION π
This is a Cascading Delete strategy that will do nothing, leaving orphaned records behind. No cap, it just sits there looking cute while the records become orphans. π
Bestie, please clock this: it does nothing on deletion, so orphaned records stay behind. That's the whole point of this strategy.
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. That part is not optional, bestie β it needs the relationship object to do its thing. π«Ά
πΈ 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, so you can get the results either as a list or as an iterator. Very choose-your-own-adventure, iykyk. β¨
π₯ cascade
$strategy->cascade($obj);
Cascade across the related objects to $obj. That's the vibe. π
π WRITING NEW STRATEGIES π
Creating a Cascade strategy should be fairly simple, bestie. 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;
}
Iconic. Ate. Periodt. π
This little manual page is brought to you by perl v5.42.0, dated 2011-04-08, and the manual name is Class::...de::None(3). Bye bestie, slay your deletions responsibly! ππ«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: perl-Class-DBI 3.0.17-bp160.1.10 Β· GPL-1.0+ or Artistic-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms