diff options
-rw-r--r-- | lib/MDV/Draklive/Live.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm index 545c96c..d2adb1f 100644 --- a/lib/MDV/Draklive/Live.pm +++ b/lib/MDV/Draklive/Live.pm @@ -7,9 +7,17 @@ sub new { bless {}, $class; } +sub default_name_fields { + my ($live) = @_; + [ qw(name version product desktop), + if_($live->{settings}{region} ne 'all', region), + qw(arch media) + ]; +} + sub get_name { my ($live) = @_; - my $fields = $live->{name_fields} || [ qw(name version product desktop region arch media) ]; + my $fields = $live->{name_fields} || default_name_fields($live); join('-', grep { $_ } @{$live->{settings}}{@$fields}); } |