TT#38200 Fix NGCP::Template to accept configuration as a list of elements

The Template class accepts both a hash reference and a hash to get the
configuration arguments. And the Dancer framework passes those as a
hash.

Change-Id: Ic9ae758bd81a2bb3108900e6f92ad91ad88f3cc9
changes/83/22283/1
Guillem Jover 8 years ago
parent ae4e1f6d3c
commit a333076038

@ -10,10 +10,16 @@ use parent qw(Template);
sub new
{
my ($this, $config) = @_;
my ($this, @args) = @_;
my $class = ref $this || $this;
$config //= {};
# The config can be passed as a hash ref or as a hash.
my $config;
if (ref $args[0] eq 'HASH') {
$config = $args[0];
} else {
$config = { @args };
}
my $self = Template->new({
ABSOLUTE => 1,

Loading…
Cancel
Save