Data::Section::Simple has a single function which returns a
part of a DATA section as a string. I'm using this module in
Locale::US as well as
Regexp::Common::profanity_us. However, in both cases, I've
needed to take the string of data and convert it into a series of
lines:
my $data = Data::Section::Simple::get_data_section('profanity');
my @line = split "\n", $data;
So I'm thinking it would be nice to be able to get the section back as
an array of lines. However, there are two approaches to this, ok 3:
- add an argument to get_data_section indicating to
return an array of lines
- write a separate function
get_data_section_as_lines
- have this single function operate in scalar or array context
What is the "best" option from a software engineering point of view?