Philip Mak wrote:
>
> Is there a more efficient way of doing this:
>
> my $type = $Request->Form('type');
> my $login = $Request->Form('login');
> my $password = $Request->Form('password');
> my $SOME_VARIABLE = $Request->Form('SOME_VARIABLE');
> etc.
>
> I like to set these to real variables so that they are easier to type
> later on in my code, but declaring them like that is always a pain.
>
> I thought about doing something like:
>
> for (qw(type login password)) {
> $$_ = $Request->Form($_);
> }
>
What I like to do is:
use vars qw( $Form )
sub Script_OnStart { $Form = $Request->Form };
Then I can do:
my $type = $Form->{type};
> Or am I approaching this problem all wrong?
>
Last time someone mentioned what you wanted to do,
which is supposedly PHP like, on the modperl list,
lots of the resident experts went crazy about namespace
pollution, which is a good thing to consider, but
short aliases can be extremely useful, so if you really
want to do what you are suggesting above, go for it,
and get around the use strict stuff with the right
eval like:
eval "\$$_ = \$Request->Form('$_')"
Also, if you are tired of typing ->, the above suggestion
could be to create a hash like Embperl...
%fdat = %{$Request->Form};
so then you could $fdat{'type'}
--Josh
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks <- Web Link Checking Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]