Allow applying a CStoreEditor personality to individual editor instances
without overwriting the default / process-wide personality.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Kyle Huckins <khuckins@catalyte.io>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
sub personality {
my( $self, $app ) = @_;
- $personality = $app if $app;
- init() if $app; # rewrite if we changed personalities
- return $personality;
+
+ if (ref($self)) {
+ # Instance-specific personality
+
+ if ($app) {
+ $self->{personality} = $app;
+ init();
+ }
+ return $self->{personality} || $personality;
+
+ } else {
+ # Process default personality
+
+ if ($app) {
+ $personality = $app;
+ init();
+ }
+ return $personality;
+ }
}
sub import {