in reply to "importing" methods?
It looks like you've a singleton 'app' and it's been passed around to invoke methods. Normally this sounds like where DI is used? even thought DI would still require you to write $obj->method. Below idea could work. but I'm not really expert in the magical part of Perl. :)
sub _get_instance { ... init singleton if not created yet. return $app; } sub log { # well there should be some easy way to somehow create function that f +orwards to singleton my $app = &_get_instance; $app->log(@_); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: "importing" methods?
by LanX (Saint) on Apr 28, 2019 at 13:09 UTC |