Subject: | Why are DESTROY and AUTOLOAD disallowed? |
I wrote the following trait:
package CDBI::Trait::QuietDestruction;
use strict;
use warnings;
use Class::Trait 'base';
our @REQUIRES = qw(
discard_changes
);
=head1 NAME
CDBI::Trait::QuietDestruction - Quietly destroy CDBI objects with changes
=head1 DESCRIPTION
This trait changes Class::DBI such that it does not warn when an
object containing unsaved changes is destroyed.
=cut
sub DESTROY {
my $self = shift;
$self->discard_changes; # Shuts up warnings
}
1;
Only to get "Error creating class for table cantatas: Trait
CDBI::Trait::QuietDestruction attempted to implement disallowed method
DESTROY". I don't see why DESTROY is disallowed, as shown above its
useful to change the destructor behavior in a trait. Furthermore,
there's no document of this fact.
AUTOLOAD might have some weird conflict with Class::Trait::Base?