Thread: [htmltmpl] problem: Not an ARRAY reference in Expr.pm
Brought to you by:
samtregar
From: Marcin G. <mg...@fo...> - 2007-05-02 12:44:46
|
One in every few calls to my application ends with error desctribed below. I'm not sure when it started or what stared these errors. It doesn't depend on template, number of calls or something else, seems pretty random. Important: turning off cache seems to heal it. H::T version 2.9 H::T::Expr version 0.07 Not an ARRAY reference at /usr/local/lib/perl5/site_perl/5.8.8/HTML/Template/Expr.pm line 238. Expr.pm snippet: sub output { my $self = shift; my $parse_stack = $self->{parse_stack}; my $options = $self->{options}; my ($expr, $expr_func); # pull expr and expr_func out of the parse_stack for cache mode. if ($options->{cache}) { $expr = pop @$parse_stack; $expr_func = pop @$parse_stack; } else { $expr = $options->{expr}; $expr_func = $options->{expr_func}; } # setup expression evaluators my %param; for (my $x = 0; $x < @$expr; $x++) { # <---- l. 238 is HERE ----------- my $node = $expr->[$x]; $param{"__expr_" . $x . "__"} = sub { _expr_evaluate($node, @_) }; } $self->param(\%param); I dumped variables before the loop and got this about $expr: type = SCALAR value = SCALAR(0xfc7a2a0) value2 = "<br> on-line: <b>" I can provide more info but not sure what's important. best regards -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |
From: Mathew R. <mat...@ne...> - 2007-05-03 01:35:50
|
Hi Marcin, Are you using a filter by any chance? If so, you could try temporarily disabling it and/or could you post a code snippet if its use. Mathew Marcin Gryszkalis wrote: > One in every few calls to my application ends with error desctribed below. > I'm not sure when it started or what stared these errors. > It doesn't depend on template, number of calls or something else, seems > pretty random. > Important: turning off cache seems to heal it. > > H::T version 2.9 > H::T::Expr version 0.07 > > Not an ARRAY reference > at /usr/local/lib/perl5/site_perl/5.8.8/HTML/Template/Expr.pm line 238. > > > Expr.pm snippet: > > sub output { > my $self = shift; > my $parse_stack = $self->{parse_stack}; > my $options = $self->{options}; > my ($expr, $expr_func); > > # pull expr and expr_func out of the parse_stack for cache mode. > if ($options->{cache}) { > $expr = pop @$parse_stack; > $expr_func = pop @$parse_stack; > } else { > $expr = $options->{expr}; > $expr_func = $options->{expr_func}; > } > > # setup expression evaluators > my %param; > for (my $x = 0; $x < @$expr; $x++) { # <---- l. 238 is HERE ----------- > my $node = $expr->[$x]; > $param{"__expr_" . $x . "__"} = sub { _expr_evaluate($node, @_) }; > } > $self->param(\%param); > > > > I dumped variables before the loop and got this > > about $expr: > > type = SCALAR > value = SCALAR(0xfc7a2a0) > value2 = "<br> > on-line: <b>" > > > I can provide more info but not sure what's important. > best regards > |
From: Marcin G. <mg...@fo...> - 2007-05-03 09:28:19
|
On Thursday of May 3 2007, Mathew Robertson wrote: > Are you using a filter by any chance? If so, you could try temporarily > disabling it and/or could you post a code snippet if its use. Sorry, no filters. I dumped $parse_stack and it's like this (parts of html skipped - (...)), but it's all messy, not sure if you can get anything from this... STACK:$VAR1 = [ \'<html> (...) <link rel="stylesheet" href="/others/all.css"> ', bless( [ bless( do{\(my $o = undef)}, 'HTML::Template::VAR' ), 0, 0, '3', 0 ], 'HTML::Template::COND' ), \' <link rel="stylesheet" href="/others/ajax.css"> <script src="/others/ajax_kl.js"></script> ', bless( do{\(my $o = undef)}, 'HTML::Template::NOOP' ), \' <link rel="shortcut icon" href="/favicon.ico" > (...) <br> ', bless( [ bless( do{\(my $o = '1')}, 'HTML::Template::VAR' ), 0, 0, '7', 0 ], 'HTML::Template::COND' ), \' <a href= (...) </a> ', $VAR1->[3], \'<br> on-line: <b>' ]; -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |
From: Marcin G. <mg...@fo...> - 2007-06-01 11:55:49
|
On Friday of June 1 2007, you wrote: > Did you ever resolve this? After looking at the problem again, I > suspect that some variable was being set/used incorrectly, ie: a scalar > was being set on the param, but trying to be used in a loop -> or more > specifically vice versa inside an EXPR... Unfortunately - no, the only way to solve it is to turn off cache, I use following options: my %default_options = ( die_on_bad_params => 0, search_path_on_include => 1, loop_context_vars => 1, global_vars => 1, strict => 1, cache => 1, ); after I set cache=>0 the errors don't show anymore (with cache on they show randomly, like once every 10-20 calls - with the same almost static (just several includes) page)... Any help or directions how to debug this will be appreciated. greetings -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |
From: Mathew R. <mat...@ne...> - 2007-06-26 06:36:48
|
Hi Marcin, This has been sitting in my inbox for a while, but I didn't really have an ideas. Have you tried enabling the file_cache only (ie not the memory cache)? It may help nail whether the problem is with H::T or something else. regards, Mathew Robertson Marcin Gryszkalis wrote: > On Friday of June 1 2007, you wrote: > >> Did you ever resolve this? After looking at the problem again, I >> suspect that some variable was being set/used incorrectly, ie: a scalar >> was being set on the param, but trying to be used in a loop -> or more >> specifically vice versa inside an EXPR... >> > > Unfortunately - no, the only way to solve it is to turn off cache, I use > following options: > > my %default_options = ( > die_on_bad_params => 0, > search_path_on_include => 1, > loop_context_vars => 1, > global_vars => 1, > strict => 1, > cache => 1, > ); > > > after I set cache=>0 the errors don't show anymore (with cache on they show > randomly, like once every 10-20 calls - with the same almost static (just > several includes) page)... > > Any help or directions how to debug this will be appreciated. > greetings > |
From: Marcin G. <mg...@fo...> - 2007-06-26 07:00:51
|
Hi Matthew On Tuesday of June 26 2007, you wrote: > Have you tried enabling the file_cache only (ie not the memory cache)? > It may help nail whether the problem is with H::T or something else. The HTML::Template::Expr says (in caveats section): "The module won't work with HTML::Template's file_cache or shared_cache modes, but normal memory caching should work. I hope to address this is a future version." Is above still valid or something got fixed and I can use file cache? greetings -- Marcin Gryszkalis, PGP 0x9F183FA3 jabber jid:mg...@fo..., gg:2532994 http://the.fork.pl |