From 0db6f42eadd442e494f95fed75b4ff6b190674b7 Mon Sep 17 00:00:00 2001 From: Maarten Vanraes Date: Mon, 9 May 2016 00:21:17 +0200 Subject: Module: default icon is dependant on name --- lib/ManaTools/Module.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/ManaTools/Module.pm b/lib/ManaTools/Module.pm index ee2a8bb9..d4f2eb0f 100644 --- a/lib/ManaTools/Module.pm +++ b/lib/ManaTools/Module.pm @@ -51,8 +51,16 @@ use yui; has 'icon' => ( is => 'rw', isa => 'Str', + lazy => 1, + builder => '_iconInitializer', ); +sub _iconInitializer { + my $self = shift; + + return File::ShareDir::dist_file(ManaTools::Shared::distName(), sprintf('images/%s.png', $self->name())), +} + #============================================================= =head2 name -- cgit v1.2.1