From: Ben. B. <ben...@gm...> - 2005-09-19 16:36:48
|
Hello all, What is the best way to specify an action in a parent component that a child component will execute (sometimes only under certain circumstances i.e. errors)? For example, in parent.html; In parent <%perl> sub die_sub { $m->redirect('foo.html');} $m->subexec('child.mas', die_sub=3D>\&die_sub ); $m->clear_buffer(); die; </%perl> # END parent.html And in child.mas: In child <%init> # doing stuff, oops something went wrong &$die_sub; </%init> <%args> $die_sub=3D>sub{ $m->redirect('404.html'); } # default redirect page </%args> <%flags> inherit=3D>undef </%flags> # END child.mas Finally in 404.html: Something must have gone wrong... # END 404.html Is this an acceptable way to handle errors? Is there a better way? If so, where is it documented? Thanks! |