|
$m->callers() dies with argument greater than or equal to stack depth: msg#00214web.mason.user
calling $m->callers() with an argument that is greater than one less than the stack depth produces an error. for example, calling $m->callers(2) from a component that is only two components deep (called from the autohandler) dies with "Can't use an undefined value as a HASH reference at /usr/lib/perl5/site_perl/5.6.1/HTML/Mason/Request.pm line 767." this means that you can't use my $grandparent = $m->callers(2); if ( defined( $grandparent ) ) { ... } to check for existence of a particular component at a certain point in the lineage. i suppose you could do my @caller_array = $m->callers(); if ( @caller_array > 2 ) { if ( defined( $grandparent ) ) { ... } } but it doesn't seem like you should have to. the offending lines are sub callers { my $self = shift; if (defined $_[0]) { return $self->stack_entry($_[0])->{comp}; } else { return map($_->{comp}, reverse $self->stack); } } and probably should be sub callers { my $self = shift; if (defined $_[0] && defined $self->stack_entry($_[0])) { return $self->stack_entry($_[0])->{comp}; } else { return map($_->{comp}, reverse $self->stack); } } ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Does SSI work with Mason?: 00214, Dave Rolsky |
|---|---|
| Next by Date: | Website Templating Systems -- Best Practices Documentation?: 00214, Jim Gourgoutis |
| Previous by Thread: | Does SSI work with Mason?i: 00214, K Old |
| Next by Thread: | Re: $m->callers() dies with argument greater than or equal to stack depth: 00214, Dave Rolsky |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |