Nevermind. A semicolon at the end of the otherwise block did the trick. ;-)
Thanks all. > Hi, > > Im unsure if this is 100% the correct list, but I am using Perl to form > dynamic web pages (CGI afaik?) so I'll give it a shot. > > I have a script which implements a try-catch block. Before entering the > try portion of this block, I am defining a variable and placing some > content into it, which is a hash table. > > The problem seems to be that when I go to access this variable inside the > try block, and subsequently any catch blocks, or the otherwise block, the > variable seems to be empty. > > Here is a snip of the code I am using: > > my $session = new App($query, $thisModule); > > try { > $session->{AccessControl}->checkAccess(); > &$method($session); > } catch App::AccessControlException with { > my $e = shift; > print "Content-type: text/plain\n\n"; > print "An access control exception has occurred.\n\n"; > print Dumper($e); > } otherwise { > my $e = shift; > print "Content-type: text/plain\n\n"; > print "An error has occurred."; > print Dumper($e); > } > > The first line creates a new instance of an object which contains some > runtime variables and other content based on the request being performed. > > If I chuck the following line in immediately after the first line: > > warn(Dumper($session)); > > I see the following in my webserver log file: > > $VAR1 = bless( { > 'thisModule' => 'module', > 'Request' => { > 'params' => [ > 'b', > 'c' > ], > 'what' => 'a' > }, > 'cgiQuery' => bless( { > '.parameters' => [], > 'use_tempfile' => 1, > '.charset' => 'ISO-8859-1', > '.fieldnames' => {}, > 'escape' => 1 > }, 'CGI' ) > }, 'App' ); > > This is fine, its what I want to see. > > But if I place this Dumper line inside the try block, I only see the > following: > > $VAR1 = bless( {}, 'App' ); > > So it appears that the variable has no content inside the try block. > > I dont see any complaints about the variable being undefined, so it > obviously exists, just not its content. > > Can anyone think of a reason, or does anyone know the reason, why this > would be occurring? > > Let me know if any further details are needed, or if you know of a better > list to post this question. > > Thanks, > Tom > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/