in reply to Re: Error.pm -- Design
in thread Error.pm -- Design

You've been more than kind and patient; this will be the last question on this topic; promise. I'm trying to figure out how the variable 'clauses' is built. Several routines pass back a lexical variable, but I'm not seeing where the combined hash is generated? thanks again.

Replies are listed 'Best First'.
Re^3: Error.pm -- Design
by ikegami (Patriarch) on Jul 25, 2006 at 16:54 UTC

    catch, finally, except and otherwise build $clauses much in the same manner as the following build_list builds $list.

    sub build_list { my $item = shift; my $list = shift || []; unshift(@$list, $item); return $list; } { # Without parens: my $list = build_list 'a', build_list 'b', build_list 'c'; print(@$list, "\n"); # abc } { # With parens: my $list = build_list('a', build_list('b', build_list('c'))); print(@$list, "\n"); # abc } { # Spelled out: my $list; $list = build_list 'c'; $list = build_list 'b', $list; $list = build_list 'a', $list; print(@$list, "\n"); # abc }