Perl: Why does "use strict" not let me pass a parameter hash?
Posted
by Thariama
on Stack Overflow
See other posts from Stack Overflow
or by Thariama
Published on 2010-05-26T14:35:15Z
Indexed on
2010/05/26
14:41 UTC
Read the original article
Hit count: 179
perl
I hava a perl subroutine where i would like to pass parameters as a hash (the aim is to include a css depending on the parameter 'iconsize').
I am using the call:
get_function_bar_begin('iconsize' => '32');
for the subroutine get_function_bar_begin:
use strict;
...
sub get_function_bar_begin
{
my $self = shift;
my %template_params = %{ shift || {} };
return $self->render_template('global/bars /tmpl_incl_function_bar_begin.html',%template_params);
}
Why does this yield the error message:
Error executing run mode 'start': undef error - Can't use string ("iconsize") as a HASH ref while "strict refs" in use at CheckBar.pm at line 334
Am i doing something wrong here? Is there an other way to submit my data ('iconsize') as a hash?
© Stack Overflow or respective owner