| Newsgroups |
gmane.comp.web.mason.devel |
| Message-ID |
<[email protected]> |
Weekly todo activity, Apr 25 to May 02
New bug #539: Using 'next' or 'last' without a loop can corrupt the component stack
If you use 'next', 'last', or 'redo' in a component that has
no loop, you will exit the component and either jump back to
a caller's loop or exit the Mason request. In the former
case the Mason stack will be corrupted; in the latter case
you will probably get no output. Both things happen because
essential clean-up code is skipped over.
It would be virtually impossible to make Mason work right
under these circumstances. But I am concerned with the
_accidental_ use of 'next' etc. If you take a large block of
code from inside a loop and refactor it into another
component, you may not notice a 'next' lurking in one of the
conditional branches. Mason can limp along with a corrupted
stack for a while, and may only fail in an unpredictable way
far from the offending line. So we should at least attempt
to fix the "bad diagnostics" problem.
A pretty easy "fix" would be to surround the
component-calling code in Request::comp with a useless empty
block (which acts like a loop wrt 'next' and friends):
eval {
{
# call $comp->run
}
}
This wouldn't warn the user about the unintended use of
'next', but it would make 'next' act like a 'return' and not
corrupt the stack. I would not do this if the performance
effect was even remotely noticable, because it happens on
every component call.
Obviously if someone does a more explicit "next LABEL" or
"goto" to jump out of a component, they are on their own
(but we should still dutifully document that this will mess
things up, as the Devel::DProf manual does for example).
Thu Apr 29 Jonathan Swartz created bug
Jonathan Swartz set version_found to 0.8
Jonathan Swartz set difficulty to 2
Jonathan Swartz set severity to Normal
Jonathan Swartz set version_goal to 1.2x
http://www.masonhq.com/docs/todo/access.html?id=539
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click