Geoffrey G. Hankerson wrote:

2. Micael Peters suggests:
my $runmode = $query->param('page');
my %rms = $self->run_modes();
return $self->$rms{$runmode};

This returns this error:
syntax error at Supersite.pm line 694, near "$rms{"
syntax error at Supersite.pm line 696, near "}"

Well, I guess I should have tested the syntax first :), but you should have seen the idea I was going for. The run_modes() method returns the same hash that you gave it in your setup() (presumably). If you specified the values as code refs, then you would have to do something more than what I was telling you. If you didn't use code ref's, but just the names of the methods as the values, then the following should work (note: I did not test this code, but you should see the general idea)


my $run_mode = $query->param('page');
my %rms = $self->run_modes();
my $next_method = $rms{$run_mode};
return $self->$next_method;

I thought all I would have to do is:
return $self->run_modes->{$runmode};

The problem with that is that $self->run_modes returns a hash, not a hash reference. You could have called run_modes() without any args and caught it's return value, then dumped it to see exactly what it was returning to you.


--
Michael Peters
Developer
Plus Three, LP


--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to