
Class::DBI::TempEssential - CDBI extension for temporary essentials

use Class::DBI::TempEssential;
# $cdbi_table ISA Class::DBI table
my @new_essential = qw/col1 col5 col7/;
my $tempEssential = new Class::DBI::TempEssential($cdbi_table,
@new_essential);
# do what you want to do with this essential setting
undef $tempEssential; # or get out of my-scope
# you have your old setting back

TempEssential modifies the Essential columns of a Class::DBI table. It reverts the original Essential columns when getting out of scope.
ARGS: $cdbi-class, @essential_columns RETURNS: $self
change the essential columns again
revert the essential columns to the original one
None by default.
When using several temp-essential columns on the same class on the same time, the user has to make sure, that the destruction work in reverse order to construction, i.e.
my $tmp1 = new Class::DBI::TempEssential($cdbi_table,@new_essential1); my $tmp2 = new Class::DBI::TempEssential($cdbi_table,@new_essential2); ... undef $tmp2; undef $tmp1;
In particular:
my $tmp = new Class::DBI::TempEssential($cdbi_table,@new_essential1); undef $tmp; # important since perl will use different distruction order $tmp = new Class::DBI::TempEssential($cdbi_table,@new_essential2);

H. Klein, <H.Klein@gmx.net>

perl.